Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to count the number of words in a cell or a range cells in Excel?

You can easily count the number of words in MS Word, but Excel doesn't have a built-in tool for counting the number of words in a worksheet. However, you can count the number of words in Excel with following methods:

Count number of words with formula

Count number of words in a single cell with User Defined Functions

Count number of words in specified range with VBA code

Easily count the number of words with Kutools for Excel (several clicks)


Easily count number of specific character in a cell:

Kutools for Excel's COUTCHAR utility helps you easily count number of a specific character appearing in a text string in a cell. Download the full feature 60-day free trail of Kutools for Excel now!

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download the free trial Now!

Office Tab Enable Tabbed Editing and Browsing in Office, and Make Your Work Much Easier...
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
  • Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
  • More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words...
  • Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum...
  • Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns...
  • Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Create Mailing List and Send Emails by Cell's Value...
  • Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
  • More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.

Count the number of words with formula

Here are two formulas for you to count words in a single cell and in a range cells.

Count words in a single cell

Please enter this formula =IF(LEN(TRIM(A2))=0,0,LEN(TRIM(A2))-LEN(SUBSTITUTE(A2," ",""))+1) into the Formula Bar, and then press the Enter key.

Note: In the formula, A2 is the cell you will count number of words inside.

You can see the result as below screenshot shown:

Count words in a range of cells with array formula

If you want to count the words in a range of cells, please enter formula =SUM(IF(LEN(TRIM(A2:A3))=0,0,LEN(TRIM(A2:A3))-LEN(SUBSTITUTE(A2:A3," ",""))+1)) into the formula bar, and then press the Shift + Ctrl + Enter keys simultaneously to get the result. See screenshot:

Note: A2:A3 is the range with words you will count.


Count the number of words with User Defined Functions

Also, you can count the words in a cell with the User Defined Functions, please do as follows:

1. Press Alt + F11 keys together to open the Microsoft Visual Basic for applications window.

2. In the winodw, click Insert > Module, then copy and paste below VBA code into the Module. See screenshot:

VBA code: Count number of words in a cell.

Function intWordCount(rng As Range) As Integer
'Update by Extendoffice 2018/3/7
    intWordCount = UBound(Split(Application.WorksheetFunction.Trim(rng.Value), " "), 1) + 1
End Function

2. Press the Alt + Q keys to close the Microsoft Visual Basic for Applications winodw. Select a blank cell in your worksheet, enter formula “=intwordcount(A2)” into the Formula Bar, and then press the Enter key to get the result. See screenshot:

Note: In the formula, A2 is the cell you will count number of words inside.

If you want to count number of words in a certain range, please apply the following method.


Office Tab - Tabbed Browsing, Editing, and Managing of Workbooks in Excel:

Office Tab brings the tabbed interface as seen in web browsers such as Google Chrome, Internet Explorer new versions and Firefox to Microsoft Excel. It will be a time-saving tool and irreplaceble in your work. See below demo:

Click for free trial of Office Tab!

Office Tab for Excel


Count number of words in specified range with VBA code

The following VBA code can help you quickly count number of words in a specified range.

1. Press Alt + F11 keys together to open the Microsoft Visual Basic for applications window.

2. In the winodw, click Insert > Module, then copy and paste below VBA code into the Module. See screenshot:

VBA code: Count number of words in selected range.

Sub CountWords()
    Dim xRg As Range
    Dim xRgEach As Range
    Dim xAddress As String
    Dim xRgVal As String
    Dim xRgNum As Long
    Dim xNum As Long
    On Error Resume Next
    xAddress = ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("Please select a range:", "Kutools For Excel", xAddress, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    If Application.WorksheetFunction.CountBlank(xRg) = xRg.Count Then
        MsgBox "Words In Selection Is: 0", vbInformation, "Kutools For Excel"
        Exit Sub
    End If
    For Each xRgEach In xRg
        xRgVal = xRgEach.Value
        xRgVal = Application.WorksheetFunction.Trim(xRgVal)
        If xRgEach.Value <> "" Then
            xNum = Len(xRgVal) - Len(Replace(xRgVal, " ", "")) + 1
            xRgNum = xRgNum + xNum
        End If
    Next xRgEach
    MsgBox "Words In Selection Is: " & Format(xRgNum, "#,##0"), vbOKOnly, "Kutools For Excel"
    Application.ScreenUpdating = True
End Sub

3. Press the F5 key to run the code. In the popping up Kutools for Excel dialog box, please select the range you will count number of words inside, and then click the OK button. See screenshot:

Then another Kutools for Excel dialog box pops up to show you the total number of words in seleted range. See screenshot:


Count the number of words with Kutools for Excel (only clicks)

You can try the Count words in range utility of Kutools for Excel to easily count number of words in a cell or a range with only several clicks.

Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days.

1. Select a cell for returning the result, then click Kutools > Formula Helper > Count words in range. See screenshot:

2. In the Formula Helper dialog box, specify the cell or range with words you need to count in the Range box, and then click the OK button. See screenshot:

Then you will get the number of words in specified cell or range.

Tip.If you want to have a free trial of this utility, please go to download the software freely first, and then go to apply the operation according above steps.


Easily count the number of words with Kutools for Excel

Kutools for Excel includes more than 300 handy Excel tools. Free to try with no limitation in 60 days. Download the free trial now!


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    W1z · 8 months ago
    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
    • To post as a guest, your comment is unpublished.
      crystal · 6 months ago
      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.
  • To post as a guest, your comment is unpublished.
    W1z · 8 months ago
    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?
  • To post as a guest, your comment is unpublished.
    jaspreet · 10 months ago
    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
  • To post as a guest, your comment is unpublished.
    David · 11 months ago
    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?
    • To post as a guest, your comment is unpublished.
      Jan · 3 months ago
      This is exactly the problem I have... :( Did you found a solution?
  • To post as a guest, your comment is unpublished.
    Chris · 11 months ago
    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
  • To post as a guest, your comment is unpublished.
    Ann · 11 months ago
    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?
  • To post as a guest, your comment is unpublished.
    Dj · 1 years ago
    In cell +1.2+0.25+2+0.8+06 this are in cell count of no not total = 5 please let me know how to calculate in Excel cell
    • To post as a guest, your comment is unpublished.
      Ex2000 · 1 years ago
      =IF(LEN(TRIM(A1))=0,0,LEN(TRIM(A1))-LEN(SUBSTITUTE(A1,"+",""))+1), basically change " " (which is a space) to your delimiter (+) and make sure column of +1.2+0.25+2+0.8+06 is TEXT format
  • To post as a guest, your comment is unpublished.
    Matt · 1 years ago
    Thank you! The first formula works great for my purposes.
  • To post as a guest, your comment is unpublished.
    Big Dave · 1 years ago
    The "User defined function" only works if the words are exactly one space apart. If there is more than one space this function adds another word to the count for each extra space. I tried it! You should too!
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Dear Dave,
      The code of the "User defined function" is updated with the problem solved. Thank you for your comment.
  • To post as a guest, your comment is unpublished.
    Bell · 1 years ago
    What would the formula be for counting average word length of a paragraph rather than the number of words or characters?
  • To post as a guest, your comment is unpublished.
    BAldev · 2 years ago
    Ex
    Different date
    1 2 3 4 5 6 7 8 9 10 11
    SRT SRT SRT SRT SRT SRT SRT SRT SRT SRT SRT

    how to count total number IN SRT TO EXCEL FORMULA
    • To post as a guest, your comment is unpublished.
      crystal · 2 years ago
      Dear BAldev,
      Would you please provide a screenshot of your spreadsheet showing what you are exactly trying to do?
      Thank you for your comment.
  • To post as a guest, your comment is unpublished.
    satish yadav · 2 years ago
    WORD COUNT FORMULA
    EXAMPAL PPPPPPPPP TOTAL P FORMULA

    AAAAAAAA TOTAL A FORMULA

    PLESE SAND FORMULAS THIS EMAIL ID
    • To post as a guest, your comment is unpublished.
      crystal · 2 years ago
      Dear satish yadav,
      Please try the LEN formula: =LEN(A1) to count total number of characters in a certain cell.
      Thank you for your comment!
  • To post as a guest, your comment is unpublished.
    vinay · 3 years ago
    Hello,

    I want to know the solution for the below problem.

    "I have a string of words that I would want to limit to 12 Characters by deleting the last words

    For example "Hi how are you doing" should be "Hi how are"

    basically the idea behind this is I want to leave a max of 12 characters,
    and let it delete the words that run over 12+ so that the final string could be less than 12

    "Hello how do you do sir" should become "Hello how do"

    and

    "That elephant is large" should become "That" not "That elephan"

    Please let us know the solution, thanks
    • To post as a guest, your comment is unpublished.
      crystal · 2 years ago
      Dear vinay,
      You can limit the characters length in a cell before entering content with the Data Validation function. Hope the below screenshot can help you.
  • To post as a guest, your comment is unpublished.
    apelah · 3 years ago
    This is terrible there must be an alternative formula, and you should update your posts
    • To post as a guest, your comment is unpublished.
      crystal · 2 years ago
      Dear apelah,
      The posts have been updated. Thank you for you comment!
  • To post as a guest, your comment is unpublished.
    Puneet Gogia · 3 years ago
    =SUM(IF(LEN(TRIM(A1:C7))=0,0,LEN(TRIM(A1:C7))-LEN(SUBSTITUTE(A1:C7," ",""))+1))

    Will Not Work if one of the cell in the range has a single word.
    • To post as a guest, your comment is unpublished.
      Linh · 2 years ago
      The formula works well for me even if a single word cell included in the range, I'm using MS 2016.
    • To post as a guest, your comment is unpublished.
      Deepak · 3 years ago
      It is correct it does not work. any solution..