How many times does a word appear in a cell? Measure how much shorter the text gets when you remove the word, then divide by the word’s length — a classic LEN/SUBSTITUTE count.
The example
Counting a word inside a sentence.
| A | B | |
|---|---|---|
| 1 | Text | Count of "the" |
| 2 | the cat and the dog | 2 |
The formula
Length difference divided by word length:
How it works
Removal reveals the count:
SUBSTITUTE(LOWER(A2), "the", "")deletes every “the”; the text gets shorter.- The length lost =
LEN(A2) − LEN(removed)— the total characters of all the “the”s. - Divide by
LEN("the")to get the number of occurrences. LOWERon both makes the count case-insensitive; drop it for case-sensitive counting.
Substrings count too. Counting “the” will also catch it inside “there” and “other.” To count whole words, pad with spaces — count " the " in " "&A2&" " — so only standalone words match.
Try it: interactive demo
Text and a word to count.
Variations
Whole words only
Pad with spaces:
Case-sensitive
Drop LOWER:
Count across a range
Sum per cell:
Pitfalls & errors
Substrings inflate the count. “the” matches inside “there.” Pad with spaces to count whole words.
Empty word divides by zero. Guard against a blank search term.
Case. LOWER both sides for case-insensitive; otherwise it’s exact-case.
Practice workbook
Frequently asked questions
How do I count how many times a word appears in a cell in Excel?
How do I count only whole words?
How do I make it case-sensitive?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class