How to Count Words in Excel Column (5 Useful Ways)

Let’s consider a dataset with 2 columns, where the first column shows the Product ID and the second column shows a list of Best Seller Books. We’ll use this in B4:C13 cells for the first four methods.

Dataset to show how to count words in Excel column


Method 1 – Count the Number of Words in a Cell with the LEN Function

  • Use the following formula in the result cell:
=LEN(TRIM(C5))-LEN(SUBSTITUTE(C5," ",""))+1

How to Count Words in Excel Column Using LEN Function

Formula Breakdown:

  • The SUBSTITUTE function replaces all the spaces in the text in the C5 cell.
  • The LEN function returns the length of the text without any spaces in between.
  • We subtract the length of the text without any space from the total length of the text and add 1 to get the total word count.
  • The TRIM function removes any unnecessary spaces from the cell.

Method 2 – Using the SUMPRODUCT Function to Count Words in a Column

  • Use the following formula inside the result cell.
=SUMPRODUCT(LEN(TRIM(C5:C13))-LEN(SUBSTITUTE(C5:C13," ",""))+1)

Here, C5:C13 represents the range of Best Seller Books (array1 argument).

How to Count Words in Excel Column Using SUMPRODUCT Function

Formula Breakdown:

  • This formula is similar to the previous method, so the same functions are used however, there is a slight modification in the last step.
  • The formula for the word count is nested inside the SUMPRODUCT function, which adds up all the word counts in the range C5:C13 and shows the total count in the E5 cell.
  • Press Ctrl + Shift + Enter to apply the formula in older Excel versions since it’s an array formula.

Method 3 – Counting Specific Words in a Column

  • The word we’ll be searching is located in F5.
  • The formula for the F5 cell is below:
=SUMPRODUCT((LEN(C5:C13)-LEN(SUBSTITUTE(C5:C13, F4,"")))/LEN(F4))

Here, F4 refers to The (old_text argument).

How to Count Words in Excel Column Using SUMPRODUCT Function

Formula Breakdown:

  • Here, dividing the total number of words returned by the SUMPRODUCT function by the number of words of the text gives back the number of times the word or text appears in the column.

Method 4 – Creating a Custom Function to Count the Number of Words

  • Go to the Developer tab and then to Visual Basic.

Using VBA Code

  • Insert a Module where you’ll paste the VBA code.

Using VBA Code

  • You can copy the code from here and paste it into the window as shown below.
Function WordCount(rng As Range) As Integer
'This function helps you to count the number of words'
WordCount = UBound(Split(rng.Value, " "), 1) + 1
End Function

Using VBA Code

  • Close the VBA window and return to your worksheet.
  • Type an Equal sign followed by the newly-made WordCount function.
  • The function takes only one argument so enter any cell reference containing text and press Enter.

How to Count Words in Excel Column Using VBA Code


Method 5 – Count Specific Words in a Cell with the LEN Function

Suppose we have a dataset shown below with only one column containing text strings.

Dataset 2


Case 5.1 – Count Specific Words in a Cell (Case-Sensitive) with SUBSTITUTE

  • Use the following function:
=(LEN(B5)-LEN(SUBSTITUTE(B5,$E$4,"")))/LEN($E$4)

In this example, the B5 cell refers to the Text column, while the E4 cell represents the text which is being counted.

How to Count Words in Excel Column Using LEN Function


Case 5.2 Count Specific Words in a Cell (Case-Insensitive) with UPPER or LOWER Inside SUBSTITUTE

  • Use the following function:
=(LEN(B5)-LEN(SUBSTITUTE(UPPER(B5),UPPER($E$4),"")))/LEN($E$4)

In this formula, the UPPER function converts the target word and the searching range to the same case.

How to Count Words in Excel Column Using LEN Function


Download the Practice Workbook


<< Go Back to Count Words | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Eshrak Kader
Eshrak Kader

Eshrak Kader is a dedicated professional with a BSc. Degree in Naval Architecture and Marine Engineering from Bangladesh University of Engineering and Technology. He boasts a rich background in Microsoft Office Suite, and over the past year, he has authored over 120 insightful articles for the ExcelDemy. Currently, Eshrak leads a team of 5 in the ExcelDemy Video project and enjoys problem-solving and making videos on Excel. Eshrak’s passion for continuous learning underscores his commitment to excellence in... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo