Note: The other languages of the website are Google-translated. Back to English

## Count specific words in a range in Excel

This article explains a formula to count the number of times a specific word appears in a range of cells in Excel. #### How to count specific words in a range of cells in Excel?

Generic formula

=SUMPRODUCT((LEN(rng)-LEN(SUBSTITUTE(rng,txt,"")))/LEN(txt))

Arguments

Rng: The range contains the text string you will count specific word inside.

Txt: The specific word you want to count. It can be:
1. The word enclosed in quotation marks;
2. Or a reference to a cell containing the word.

How to use this formula?

Supposing you want to count number of a word “tool” in range B5:B8, you can get it down as follows.

Select a blank cell, enter the below formula into it and then press the Enter key.

Tips: You can directly copy and paste the formula into selected cell.

=SUMPRODUCT((LEN(B5:B8)-LEN(SUBSTITUTE(B5:B8,"tool","")))/LEN("tool")) Notes:

• 1. Please change the range B5:B8 and word “tool” to your own needs;
• 2. If the word is not found, it will return 0;
• 3. The formula is case-sensitive;
• 4. If you want to count specific word in a range of cells and ignore the case, please use the UPPER function inside the SUBSTITUTE as the below formula shown:
• =SUMPRODUCT((LEN(B5:B8)-LEN(SUBSTITUTE(UPPER(B5:B8),UPPER("tool"),"")))/LEN("tool"))
• How this formula works?

=SUMPRODUCT((LEN(B5:B8)-LEN(SUBSTITUTE(B5:B8,"tool","")))/LEN("tool"))

• 1. LEN(B5:B8): The LEN function calculates the total string length for each cell in range B5:B8, it will be returned as an array numbers {47;23;23;15};
• 2. LEN(SUBSTITUTE(B5:B8,"tool","")): Here the SUBSTITUTE function removes the specific word “tool” from each cell in range B5:B8, and then the LEN function calculates the length for each cell in range B5:B8 without the specific word “tool”. It returns the array numbers as {35;19;19;15};
• 3. (LEN(B5:B8)-LEN(SUBSTITUTE(B5:B8,"tool","")): This section of the formula now is turned to {47;23;23;15}-{35;19;19;15}. After subtracting, the result is {12;4;4;0};
• 4. LEN("tool"): The LEN function here calculates the length for “tool”, and returns the result 4;
• 5. LEN(B5:B8)-LEN(SUBSTITUTE(B5:B8,"tool","")))/LEN("tool"): As above mentioned, this part will display as {12;4;4;0}/4. Divide 4 from each number of the array and have the result {3;1;1;0};
• 6. SUMPRODUCT({3;1;1;0}): The SUMPRODUCT function sums the numbers in the array and returns the total count of “tool” in range B5:B8.

#### Related functions

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 SUMPRODUCT function
The SUMPRODUCT function can be used to multiply two or more columns or arrays together, and then get the sum of products.

Excel UPPER function
The Excel UPPER function converts all letters of a given text to uppercase.

#### Related formulas

Count occurrences of specific characters in an Excel cell
This tutorial introduces how to apply formulas based on the LEN and SUSTITUTE functions to count the number of times a specific character appears in an Excel cell.

Count specific characters in a range of cells
This tutorial introduces some formulas to count the number of times a specific character appears in a range in Excel.

Count specific words in a cell in Excel

Count number of characters in a cell in Excel
The total characters not only includes all letters, but also all spaces, punctuation marks and symbols in the cell. Follow this tutorial to easily count the total characters in a cell with the LEN function in Excel.

Count number of characters in a range in Excel
This article explains a formula to count total characters that appear in a range of cells in Excel.

### The Best Office Productivity Tools

#### Kutools for Excel - Helps You To Stand Out From Crowd

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. #### Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

• 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. 