Count the number of words separated by comma in Excel

While working on a Project somewhere I needed to count the number of words in a particular cell. In this tutorial we’ll be learning to Count the number of words in a cell in Excel. The tutorial explained in step by step and worksheet is attached.

I have used two Excel functions LEN() and SUBSTITUTE() for the calculations.

Step 1. Calculate the length

In this step first we have to calculate the number characters in a cell using LEN() function. It count and returns the number of characters in a cell including the spaces,commas and other characters.

=LEN(Cell Number)

1 Length

Step 2. Removing the Special characters, punctuation marks and spaces

To count the number of words we have to remove the commas in our case using SUBSTITUE() function. It replaces the words or character with the desired value in a string.

=SUBSTITUTE("OriginalText","TextToRemove","TextToReplacewith")

Here I am replacing comma with none so all the commas are removed as you can see in cell E11.
2 Substitute

Step 3. Calculating the new length

Now we have to calculate the length/number of character in the string removing the commas

3 Length of the subsitute

 

 

Step 4. Counting the words

This is the final step to calculate the number of words. So the calculation goes like this

Length of original string- Length of substituted string string+1
=1+E10-E12

here +1 because the comma ends before the last word.

4 number of words

Note- The calculation can be done in just one cell, I have shown in different cells just to explain the steps and working of the functions. Following formula is used for single cell calculation.

=LEN(E4)-LEN(SUBSTITUTE(E4,",",""))+1

5 single cell calculation

The same logic can be applied if words are separated by space or any other character, you just have to remove all the other(,!# etc.) characters.

Download the worksheet here!

9 comments

Leave a Reply

Your email address will not be published. Required fields are marked *