Log in
x
or
x
x
Register
x

or
0
0
0
s2sdefault

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.

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


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
intWordCount = UBound(Split(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.


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 120 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 120 handy Excel tools. Free to try with no limitation in 60 days. Download the free trial now!


Recommended Productivity Tools

Office Tab

gold star1 Bring handy tabs to Excel and other Office software, just like Chrome, Firefox and new Internet Explorer.

Kutools for Excel

gold star1 Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!

gold star1 200 New Features for Excel, Make Excel Much Easy and Powerful:

  • Merge Cell/Rows/Columns without Losing Data.
  • Combine and Consolidate Multiple Sheets and Workbooks.
  • Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
  • Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
  • More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...

Screen shot of Kutools for Excel

btn read more      btn download     btn purchase

Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
People in conversation:
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    BAldev · 4 months 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 · 4 months 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 · 6 months 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 · 4 months 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 · 1 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 · 4 months 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 · 1 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 · 4 months ago
      Dear apelah,
      The posts have been updated. Thank you for you comment!
  • To post as a guest, your comment is unpublished.
    Puneet Gogia · 1 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 · 5 months 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 · 1 years ago
      It is correct it does not work. any solution..