跳到主要內容

在Excel中快速統計總字數/特定字數

雖然 MS Word 提供了易於使用的字數統計功能,但相較之下,Excel 不包含專門為計算工作表中的字數而設計的內建工具。在本綜合指南中,我們將探索各種方法來計算一個單元格或一系列單元格中的單字總數,以及計算特定單字的數量。

計算單元格/單元格範圍中的單字總數

計算單元格中特定單字的數量/單元格的數量


計算單元格/單元格範圍中的單字總數

在本節中,我們將介紹一些快速有效的方法來計算 Excel 中單一儲存格或一系列儲存格中的單字總數。

使用公式計算總字數

● 計算單一儲存格中的總單字數

如果您想取得單一儲存格中的總單字數,請套用下列公式:

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

然後,按 Enter 獲得結果的關鍵,請參見屏幕截圖:

 

● 計算儲存格範圍內的總單字數

要計算一系列儲存格中的單字數,您可以使用下列陣列公式:

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

然後,按 Ctrl + Shift + Enter 鍵組合在一起即可取得指定儲存格範圍內的單字總數。看截圖:


使用有用的功能計算單字總數

Excel的Kutools 提供了一個簡單有效的方法來計算工作表中的字數。這 計算總字數 該功能可讓您快速找出一個單元格或一系列單元格中有多少個單詞,而無需複雜的公式。對於任何在 Excel 中處理大量文字的人來說,它都是一個很棒的工具,可以讓字數統計變得簡單而有效率。

下載並安裝 Kutools for Excel,請執行以下步驟:

  1. 按一下空白儲存格輸出計算結果,然後按一下 庫工具 > 公式助手 > 公式助手.
  2. 公式助手 對話框中,單擊 計算總字數 ,在 選擇一個公式 部分。
  3. 然後去 參數輸入 部分,選擇要計算總字數的儲存格或儲存格範圍。
  4. 最後點擊 OK 按鈕。

結果:

您將獲得指定單元格或單元格範圍中的單字總數。看截圖:

保養竅門:
  1. 要應用此功能,您應該 下載並安裝 首先。
  2. 公式助手 功能收集了 40 多個常用公式,簡化了 Excel 中的各種常見任務和計算。

使用使用者定義函數計算總字數

在 Excel 中,您還可以建立使用者定義的函數來計算單一儲存格或儲存格區域中的總單字數。請依照以下步驟進行:

  1. 按住 ALT + F11 鍵,然後打開 Microsoft Visual Basic for Applications 窗口。
  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. 然後,按 Enter 獲得結果的關鍵:

計算單元格中特定單字的數量/單元格的數量

在本節中,我們將向您展示計算特定單字在 Excel 中的一個儲存格或一系列儲存格中出現的次數的簡單方法。

使用公式計算特定單字的數量

● 計算單一儲存格中特定單字的數量

若要計算特定單字在單一儲存格中出現的次數,請套用下列公式:

=(LEN(A2)-LEN(SUBSTITUTE(A2, "Excel","")))/LEN("Excel")
備註:在以上公式中, A2 是您要計算特定單字出現次數的儲存格,並且「Excel” 是您想要計算其出現次數的單字。

然後,按 Enter 獲得結果的關鍵,請參見屏幕截圖:

尖端不區分大小寫來計算儲存格中的特定單字數

上面的公式區分大小寫,這意味著它區分大小寫字母。它將精確地計算公式中出現的特定單字的出現次數。例如,「Excel」和「excel」將被視為不同的單字。

如果您需要計算給定單字的出現次數(無論大小寫),則應修改公式以使其不區分大小寫。

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

     

    ● 計算儲存格範圍內特定單字的數量

    若要計算多個儲存格中特定單字的出現次數,請套用下列陣列公式:

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

    然後,按 Ctrl + Shift + Enter 同時按鍵計算所選單元格範圍內特定單字的數量。看截圖:

    尖端不區分大小寫以計算一系列單元格中的特定單字

    要在 Excel 中以不區分大小寫的方式對單元格區域中的特定單字進行計數,您可以修改公式,使其不區分大小寫字母。 (記得按 Ctrl + Shift + Enter 同時按鍵以獲得正確的結果。)

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


      使用智慧功能計算特定單字的數量

      Excel的Kutools 使得計算單一單元格或單元格區域中的特定單字變得非常容易。只需選擇單元格,告訴 Kutools 您要查找的單詞,它會快速為您計算它們 - 不需要複雜的公式!對於需要快速、簡單的方式在 Excel 中處理文字資料的任何人來說,此工具非常有用。

      1. 按一下空白儲存格輸出計算結果,然後按一下 庫工具 > 公式助手 > 公式助手.
      2. 公式助手 對話框中,單擊 數一個字 ,在 選擇一個公式 部分。
      3. 然後去 參數輸入 部分,選擇要計算特定單字數量的儲存格或儲存格範圍 文本 盒子;選擇包含該單字的儲存格或輸入您要計入的特定單字 Word 框;
      4. 最後點擊 OK 按鈕。

      結果:

      您將獲得單一單元格或單元格區域中特定單字的數量。看截圖:

      保養竅門:
      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