Count the number of words in a cell in Excel
This article explains how to count total words in a cell with a formula in Excel.
How to count the number of words in a cell in Excel?
Text_string: The text string or sentence for which you want to count total words. It can be:
1. The text string enclosed in quotation marks;
2. Or a reference to a cell containing the text string.
How to use this formula?
Supposing you have a list with different sentences in each cell, and want to count the number of words for each cell and return the results. Please do as follows.
1. Select a blank cell to output the result.
2. Enter the below formula into it and press the Enter key.
3. Select the first result cell, drag the Fill Handle to apply the formula to other cells. See screenshot:
How this formula works?
- 1. LEN(SUBSTITUTE(B5," ","")): First, the SUBSTITUTE function removes all spaces from the specific cell (all spaces in the cell will be replaced with empty text string). After that, the LEN function calculates the length of the text string without spaces. Here the result is 19.
- 2. LEN(TRIM(B5)): If there are extra spaces in B5, the TRIM function will remove them and only keep a single space between words. And then the LEN function calculates the length of the text string in B5 with spaces and return 23.
- 3. LEN(TRIM(B5))-LEN(SUBSTITUTE(B5," ",""))+1: Now the length of the string with spaces (23) subtracts the string length without spaces (19), and as the number of words is equal to the number of spaces + 1, we need to add 1 to the final word count. Here the total words are 5.
Excel LEN function
The LEN function returns the number of characters in a text string.
Excel SUBSTITUTE function
The SUBSTITUTE function replaces text or characters within a text string with another text or characters.
Excel TRIM function
The TRIM function removes all extra spaces from text string and only keeps single spaces between words.
The Best Office Productivity Tools
Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings
300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save
80% time for you.
- Designed for
1500 work scenarios, helps you solve
80% Excel problems.
- Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
- Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
- One second to switch between dozens of open documents!
- Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
- Increases your productivity by
50% when viewing and editing multiple documents.
- Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.