FormulaCraft

How to count occurrences of a word in a cell in Excel and Google Sheets

Topic:Text manipulation
Excel & Google Sheets
=(LEN(A2)-LEN(SUBSTITUTE(LOWER(A2),LOWER(B2),"")))/LEN(B2)

Verified example

Computed by a real spreadsheet engine on the sample data below.

TextWordCount
the cat sat on the matthe
apple banana appleapple
hello worldworld
one one one oneone

=(LEN(A2)-LEN(SUBSTITUTE(LOWER(A2),LOWER(B2),"")))/LEN(B2)2

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Put the text you want to search in column A (e.g., A2) and the word to count in column B (e.g., B2).
  2. 2Enter the formula =(LEN(A2)-LEN(SUBSTITUTE(LOWER(A2),LOWER(B2),"")))/LEN(B2) in an empty cell.
  3. 3LOWER() makes the search case-insensitive. Remove LOWER() if you need case-sensitive counting.
  4. 4The formula subtracts the length after removing the word from the original length, then divides by the word length to get the count.
  5. 5Press Enter. The result is the number of times the word appears in the cell.

Tips

Need it for your exact data?

Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.

Frequently asked

Does this count partial matches, like 'cat' inside 'catch'?

Yes. SUBSTITUTE replaces all occurrences including partial matches. To count whole-word matches only, pad the search word with spaces or use more advanced pattern matching.

How do I count occurrences across a whole range of cells?

Use COUNTIF for whole-cell matches, or sum the per-cell formula over a range: =SUMPRODUCT((LEN(A2:A6)-LEN(SUBSTITUTE(LOWER(A2:A6),LOWER(B2),"")))/LEN(B2)).

More on Text manipulation

See all →

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: