When dealing with text data in Excel, it’s often useful to know how many words are contained in a cell. Whether you’re processing survey responses, analyzing customer feedback, or managing content, being able to count words can provide valuable insights.

In this blog post, we’ll explore different methods to count words in a cell using Excel formulas, ensuring you can handle any text data efficiently.

Counting Words in a Cell

Here are the Excel formulas to Count Words in a Cell, We have provided wide range of examples to count the words with different delimiters.

Basic Word Count Formula

The simplest way to count words in a cell is by using a formula that manipulates the spaces between words. Assuming that words in a cell are separated by spaces, you can use the following Excel formula to count words in cell:

=IF(LEN(TRIM(A1))=0,0,LEN(TRIM(A1))-LEN(SUBSTITUTE(A1," ",""))+1)


  • TRIM(A1): Removes any extra spaces from the beginning and end of the text in cell A1.
  • SUBSTITUTE(A1, ” “, “”): Removes all spaces in the text.
  • LEN(…): Counts the number of characters in the text.
  • The formula essentially calculates the number of spaces and adds one to determine the number of words.

Counting Words in a Cell Separated by Comma Using Excel Formulas

When working with data in Excel, you might encounter situations where words within a cell are separated by commas instead of spaces. This scenario is common in data exported from other software or when dealing with lists formatted in a single cell. In this section, we’ll go through a simple Excel formula to count words in a cell when they are separated by commas.

Formula to Count Words Separated by Comma

If your text is separated strictly by commas without any spaces, you can use a simplified version of the word count formula:

=IF(LEN(TRIM(A1)) = 0, 0, LEN(TRIM(A1)) - LEN(SUBSTITUTE(A1, ",", "")) + 1)

Handling Multiple Delimiters

In some cases, text may use different delimiters such as commas, semicolons, or even tabs. To count words separated by multiple delimiters, you can modify the formula as follows:



  • Additional SUBSTITUTE functions are added for each delimiter (commas and semicolons in this case).
  • This formula will count the number of delimiters and add one to determine the word count.

Using VBA User-Defined Functions (UDF) to Count Words in a Cell

For more complex scenarios or regular use, creating a User-Defined Function in Excel VBA can provide a more robust solution:

Function CountWords(rng As Range) As Integer

Dim WordArray() As String

WordArray = Split(Application.Trim(rng.Text), " ")

CountWords = UBound(WordArray) + 1

End Function


  • Simply enter =CountWords(A1) in Excel to get the word count for cell A1.
  • This VBA function splits the cell content by spaces and counts the elements in the resulting array.

Mastering the Art of Word Counting with Examples

The following example helps you understand how to deal with different scenarios while counting words in a Cell. Check the example below and download the example file provide below.

Example Data and Formulas for Counting Words in Excel

To provide a clear understanding of how different formulas can be applied to count words in Excel, here’s a detailed table showcasing various scenarios. This table includes example data, descriptions of the context, the formulas used, and the results of those formulas:

Data Description Formula Result
apple orange banana Words separated by spaces =LEN(TRIM(A2))-LEN(SUBSTITUTE(A2,” “,””))+1 3
apple,orange,banana,grape Words separated by commas =LEN(TRIM(A3))-LEN(SUBSTITUTE(A3,”,”,””))+1 4
apple; orange; banana; grape Words separated by semicolons =LEN(TRIM(A4))-LEN(SUBSTITUTE(A4,”;”,””))+1 4
apple, orange; banana.grape Multiple delimiters =LEN(TRIM(A5))-LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A5,”,”,””),”;”,””),”.”,””))+1 4
“” (empty cell) No text =IF(LEN(TRIM(A6))=0,0,LEN(TRIM(A6))-LEN(SUBSTITUTE(A6,” “,””))+1) 0
” ” (spaces only) Only spaces =IF(LEN(TRIM(A7))=0,0,LEN(TRIM(A7))-LEN(SUBSTITUTE(A7,” “,””))+1) 0
1234 5678 Numeric ‘words’ =LEN(TRIM(A8))-LEN(SUBSTITUTE(A8,” “,””))+1 2
Hello,World No space after comma =LEN(TRIM(A9))-LEN(SUBSTITUTE(A9,”,”,””))+1 2
John Doe;Jane Smith Names separated by semicolon =LEN(TRIM(A10))-LEN(SUBSTITUTE(A10,”;”,””))+1 2

Download Example File

For a hands-on experience and to test these formulas directly within Excel, download the example file provided through the link below. This Excel file is pre-populated with the data and formulas from the table, allowing you to see the formulas in action and modify them as needed for your specific data:

Download Example file


Counting words in Excel cells can be approached in various ways depending on your specific needs. The formulas provided offer flexibility for basic word counts, while the VBA approach allows for more extensive customization and reuse across your Excel projects.

Understanding how to manipulate and analyze text data in Excel with these techniques will enhance your data analysis skills, making you a more proficient Excel user.

Excel Formula to Count Words in a Cell

Share This Story, Choose Your Platform!

Leave A Comment