跳到主要内容

在Excel中快速统计总字数/特定字数

虽然 MS Word 提供了易于使用的字数统计功能,但相比之下,Excel 不包含专门为计算工作表中的字数而设计的内置工具。在本综合指南中,我们将探索各种方法来计算一个单元格或一系列单元格中的单词总数,以及计算特定单词的数量。

计算单元格/单元格范围中的单词总数

计算单元格中特定单词的数量/单元格的数量


计算单元格/单元格范围中的单词总数

在本节中,我们将介绍一些快速有效的方法来计算 Excel 中单个单元格或一系列单元格中的单词总数。

使用公式计算总字数

● 计算单个单元格中的总单词数

如果您想获取单个单元格中的总单词数,请应用以下公式:

=IF(LEN(TRIM(A2))=0,0,LEN(TRIM(A2))-LEN(SUBSTITUTE(A2," ",""))+1)

然后,按 输入 获得结果的关键,请参见屏幕截图:

 

● 计算单元格范围内的总单词数

要计算一系列单元格中的单词数,您可以使用以下数组公式:

=SUM(IF(LEN(TRIM(A2:A4))=0,0,LEN(TRIM(A2:A4))-LEN(SUBSTITUTE(A2:A4," ",""))+1))

然后,按 Ctrl + Shift + Enter 键组合在一起即可获取指定单元格范围内的单词总数。看截图:


使用有用的功能计算单词总数

Kutools for Excel 提供了一种简单有效的方法来计算工作表中的字数。这 计算总字数 该功能可让您快速找出一个单元格或一系列单元格中有多少个单词,而无需复杂的公式。对于任何在 Excel 中处理大量文本的人来说,它都是一个很棒的工具,可以让字数统计变得简单而高效。

下载并安装 Kutools for Excel,请执行以下步骤:

  1. 单击空白单元格输出计算结果,然后单击 库工具 > 公式助手 > 公式助手.
  2. 公式助手 对话框中,单击 计算总字数 ,在 选择一个公式 部分。
  3. 然后去看看 参数输入 部分,选择要计算总字数的单元格或单元格范围。
  4. 最后点击 OK 按钮。

结果:

您将获得指定单元格或单元格范围中的单词总数。看截图:

Tips:
  1. 要应用此功能,您应该 下载并安装 首先。
  2. 公式助手 功能收集了 40 多个常用公式,简化了 Excel 中的各种常见任务和计算。

使用用户定义函数计算总字数

在 Excel 中,您还可以创建用户定义的函数来计算单个单元格或单元格区域中的总单词数。请按照以下步骤进行:

  1. 按住 ALT + F11 键,然后打开 Microsoft Visual Basic应用程序 窗口。
  2. 点击 插页 > 模块,然后将以下代码粘贴到“模块窗口”中。
    VBA代码:计算一个单元格或一系列单元格中的总单词数
    Function CountWords(rng As Range) As Integer
    'Updateby Extendoffice
        Dim cell As Range
        Dim totalWords As Integer
        totalWords = 0
        For Each cell In rng
            If Len(Trim(cell.Value)) > 0 Then
                totalWords = totalWords + UBound(Split(Trim(cell.Value), " "), 1) + 1
            End If
        Next cell
        CountWords = totalWords
    End Function
    
  3. Alt+Q 键关闭 Microsoft Visual Basic for Applications 窗口。选择一个空白单元格来放置结果,然后输入或复制以下公式:
    计算一系列单元格的数量: =计数字数(A2:A4)
    计算单个细胞的数量: =计数字数(A2)
  4. 然后,按 输入 获得结果的关键:

计算单元格中特定单词的数量/单元格的数量

在本节中,我们将向您展示计算特定单词在 Excel 中的一个单元格或一系列单元格中出现的次数的简单方法。

使用公式计算特定单词的数量

● 计算单个单元格中特定单词的数量

要计算特定单词在单个单元格中出现的次数,请应用以下公式:

=(LEN(A2)-LEN(SUBSTITUTE(A2, "Excel","")))/LEN("Excel")
备注:在以上公式中, A2 是您要计算特定单词出现次数的单元格,并且“Excel” 是您想要计算其出现次数的单词。

然后,按 输入 获得结果的关键,请参见屏幕截图:

Tips:不区分大小写来计算单元格中的特定单词数

上面的公式区分大小写,这意味着它区分大小写字母。它将精确地计算公式中出现的特定单词的出现次数。例如,“Excel”和“excel”将被视为不同的单词。

如果您需要计算给定单词的出现次数(无论大小写),则应修改公式以使其不区分大小写。

=(LEN(A2)-LEN(SUBSTITUTE(A2, "Excel","")))/LEN("Excel")

     

    ● 计算单元格范围内特定单词的数量

    要计算多个单元格中特定单词的出现次数,请应用以下数组公式:

    =SUM((LEN(A2:A3)-LEN(SUBSTITUTE(A2:A3, "Excel", "")))/LEN("Excel"))

    然后,按 Ctrl + Shift + Enter 同时按键来计算所选单元格范围内特定单词的数量。看截图:

    Tips:不区分大小写以计算一系列单元格中的特定单词

    要在 Excel 中以不区分大小写的方式对单元格区域中的特定单词进行计数,您可以修改公式,使其不区分大小写字母。 (记得按 Ctrl + Shift + Enter 同时按键以获得正确的结果。)

    =SUM((LEN(A2:A3)-LEN(SUBSTITUTE((UPPER(A2:A3)), UPPER("Excel"), "")))/LEN("Excel"))


      使用智能功能计算特定单词的数量

      Kutools for Excel 使得计算单个单元格或单元格区域中的特定单词变得非常容易。只需选择单元格,告诉 Kutools 您要查找的单词,它会快速为您计算它们 - 不需要复杂的公式!对于需要快速、简单的方式在 Excel 中处理文本数据的任何人来说,此工具非常有用。

      1. 单击空白单元格输出计算结果,然后单击 库工具 > 公式助手 > 公式助手.
      2. 公式助手 对话框中,单击 计算一个单词的数量 ,在 选择一个公式 部分。
      3. 然后去看看 参数输入 部分,选择要计算特定单词数量的单元格或单元格范围 文本 盒子;选择包含该单词的单元格或输入您要计入的特定单词 Word 框;
      4. 最后点击 OK 按钮。

      结果:

      您将获得单个单元格或单元格区域中特定单词的数量。看截图:

      Tips:
      1. 这个功能是 区分大小写,它会准确地计算特定单词出现的次数。
      2. 要应用此功能,请 下载并安装 Kutools for Excel 第一的。 Kutools for Excel 提供了 40 多个常用公式,简化了 Excel 中的各种常见任务和计算。

      相关文章:

      • 轻松计算独特且独特的值
      • 通常,在 Excel 中,唯一值是在列表中只出现一次且没有任何重复的值,而不同值是所有不同的值(唯一值 + 第一次重复出现)。 在处理大型数据集时,您可能需要计算单元格列表中重复项中唯一值和不同值的数量,如下图所示。 本教程将介绍一些快速技巧,用于计算 Excel 中的唯一值和不同值。
      • 计算字符、字母和数字的数量
      • 当您在Excel中的单元格中键入数据列表时,如下面的屏幕截图所示,您要计算所有字符的总数,或者仅计算字母的数量,或者仅计算单元格中的数字。 现在,我将讨论Excel中基于此的方法。
      • 按颜色(背景、字体、条件格式)对单元格进行计数/求和
      • 在日常任务中,颜色标记是快速区分和突出显示关键数据的流行方法。 但是,我们如何根据特定颜色(填充颜色、字体颜色、条件格式)对单元格数据进行计数或求和? 默认情况下,Excel 不提供按颜色进行计数或求和的直接功能。 尽管如此,通过一些技巧和间接方法,我们仍然可以实现这一目标。 本文将探讨如何按颜色对数据进行计数或求和。
      • Excel 中非空白单元格的计数
      • 本教程展示了在 Excel 中计算非空白单元格的五种方法。 所有方法都非常容易遵循,只需不到 10 秒即可获得结果。
      Comments (32)
      No ratings yet. Be the first to rate!
      This comment was minimized by the moderator on the site
      Thanks a lot for sharing this formula. I pasted it and changed the cell reference to fit my sheet. Thanks a lot.
      This comment was minimized by the moderator on the site
      OMG THANK YOU FOR THIS GOOD INFO
      This comment was minimized by the moderator on the site
      If the cell is empty is is incorrectly displaying a count of 1. To correct this I changed the formula to:


      =IF(LEN(TRIM(A1)) > 0, LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1),",",""))+1, 0)
      This comment was minimized by the moderator on the site
      You are the best. The formula worked for me effortlessly. Kudos!!!
      This comment was minimized by the moderator on the site
      is there any function will count if i kept cells in one color??? ( i mean to know if filled with same colour is there any formula to count the number of colour boxes)
      This comment was minimized by the moderator on the site
      Is a chance that this function will count only unique words. For example if word exist in a range two times will count only one, will not count duplicates
      This comment was minimized by the moderator on the site
      Hi,
      For counting only the unique words in a range, please apply this formula (please replace A1:A9 with the range based on your needs): =SUMPRODUCT(1/COUNTIF(A1:A9,A1:A9)). Thank you for your comment.
      This comment was minimized by the moderator on the site
      Is chance that this formula will count only unique words. My question is if word will exist 2 times in range will count that word only once without counting duplicates?
      This comment was minimized by the moderator on the site
      I need to clip words from a paragraph like this

      "Advised that device is out of warranty and that no repair available so we would recommend that this unit be removed from svc and replaced if they need a device that will provide audible prompts. Sales rep will go to the customer site and advise them of this.
      Closing case while wait"
      I want to specify a word and in return I want the preceding and succeeding word to come along with the one I specify, like if I specify "svc" output should be "from svc and" .
      please Help
      This comment was minimized by the moderator on the site
      It is telling me: "The formula you typed contains error. Please make sure you have typed in the arguments according to the remark of the formula!"


      Every cell contains only one word. I also double checked, everything is "text".
      Is there a solution to this problem?
      This comment was minimized by the moderator on the site
      This is exactly the problem I have... :( Did you found a solution?
      This comment was minimized by the moderator on the site
      This is superb. Thank you - just what I needed!!

      PS Only.... I thought I was pretty clued up with using excel and now it's made me realise I am a mere novice compared to some!! :-D
      This comment was minimized by the moderator on the site
      Hi and thank you for this - the first formula is just what I need, but is there a way to automatically apply it to the same cell in each row please: D1, E1, F1 etc?
      There are no comments posted here yet
      Load More
      Please leave your comments in English
      Posting as Guest
      ×
      Rate this post:
      0   Characters
      Suggested Locations