In Word you can easily count the words simply by clicking “Word Count” from the Review ribbon. But what if you have your text in Excel? There is no built-in word count function in Excel, so we have to find another way.
In a previous post I showed how to count characters in a text string using the LEN function. We will use the same function, with a twist, to do a word count.
Count words in one cell
First, let’s calculate the total length of the text in A2, including spaces:
Then, let’s find out how long it would be without the spaces. We’ll use the SUBSTITUTE function to remove the spaces:
The difference between the two results – 6 – is the number of spaces between the words, so we have to add 1 to get the word count. If we combine the two formulas and add 1, we get this formula:
Sometimes there are extra spaces between the words or after the last word. You can use the TRIM function around the cell reference to get rid of them before you count the words:
Count words in multiple cells
If you want to do a word count on multiple cells, all you have to do is to change the cell reference (A2) to a range (A2:A4) and wrap the SUM function around it:
This is an array formula, so you have to press Ctrl+Shift+Enter to make it work. The curly brackets only appear in the formula field to show that it’s an array formula – you don’t have to type it.
More easy tricks:
- How to use Excel to Count Characters in a Text String
- Use a wildcard in Excel to make SUMIFS and COUNTIFS more flexible
- How to Create an HTML Table with Excel
Are you using a non-English version of Excel? Click here for translations of the 100 most common functions.