How to Count Cells Containing a Word in Excel

Count text cells that contain a word anywhere using COUNTIF with * wildcards — from a typed word, a cell, or with an exclusion.

You will learn to

  • Count cells containing a word with "*word*"
  • Build the wildcard pattern from a cell
  • Exclude cells that contain a second word

How it works

COUNTIF normally needs an exact match, but the asterisk wildcard (*) stands for "any characters". So =COUNTIF(B2:B11,"*password*") counts every cell with "password" anywhere in it — at the start, middle or end. The match is not case-sensitive.

To make the word changeable, join the asterisks to a cell: "*"&E2&"*". COUNTIFS can combine a "contains" test with a "does not contain" test using "<>*word*", which is useful for separating one kind of request from another in free-text data such as ticket subjects or product descriptions.

=COUNTIF(B2:B11,"*password*")