Count Cells That Contain Text

Excel Formulas › Count

All versionsCOUNTIFWildcards

To count how many cells contain a word or fragment — every product with “Pro” in the name, every address that mentions “TX” — use COUNTIF with wildcards. The * matches any characters around your text.


Quick formula: to count cells in A2:A8 that contain “Pro”:
=COUNTIF(A2:A8, "*Pro*")
The asterisks mean “any text before and after,” so it matches the word anywhere in the cell.

Functions used (tap for the full reference guide):

The example

Count the products whose name contains “Pro.”

AB
1Product
2Widget Pro
3Gadget
4Pro Mouse
5Cable
6Count with “Pro”:2

The formula

The count of “Pro” products:

=COUNTIF(A2:A5, "*Pro*") // Widget Pro + Pro Mouse = 2

How it works

Wildcards turn COUNTIF into a “contains” counter:

  1. The criteria "*Pro*" matches any cell with “Pro” somewhere inside.
  2. COUNTIF tallies the matching cells — 2.
  3. "Pro*" counts only cells that start with Pro; "*Pro" only those that end with it.
  4. Use ? for a single character: "A?" matches A1 and AX but not ABC.

Count cells that do NOT contain text with the <> operator: =COUNTIF(A2:A8, "<>*Pro*") — though blanks behave oddly, so combine with COUNTA if needed.

Try it: interactive demo

Live demo

Type a fragment to count (wrapped in * automatically).

Count:

Variations

Contains AND another condition

COUNTIFS with a wildcard plus a second test:

=COUNTIFS(A2:A8, "*Pro*", B2:B8, "West")

Count that do NOT contain

Use the not-equal operator:

=COUNTIF(A2:A8, "<>*Pro*")

Use a cell value as the fragment

Concatenate wildcards around a cell:

=COUNTIF(A2:A8, "*"&E1&"*")

Pitfalls & errors

No wildcards = exact match. =COUNTIF(A2:A8, "Pro") counts only cells equal to exactly “Pro.” Add * for “contains.”

COUNTIF is case-insensitive. “pro” and “PRO” both match. Use SUMPRODUCT with FIND for a case-sensitive count.

Numbers stored as text may not match a numeric-looking wildcard the way you expect. Keep the data type consistent.

Practice workbook

📊
Download the free Count Cells That Contain Text practice workbook
The product list with live COUNTIF wildcard counts, the COUNTIFS and not-contains variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I count cells that contain specific text in Excel?
Use COUNTIF with wildcards: =COUNTIF(A2:A8, "*Pro*") counts cells containing "Pro" anywhere. The asterisks match any characters before and after.
How do I count cells that start with or end with text?
Anchor the wildcard: "Pro*" counts cells starting with Pro and "*Pro" counts cells ending with Pro.
How do I count cells that do not contain a word?
Use the not-equal operator with wildcards: =COUNTIF(A2:A8, "<>*Pro*"). Combine with COUNTA if blank cells need special handling.

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

Related formulas: Sum if cell contains · COUNTIFS with multiple criteria · Check if a cell contains text

Function references: COUNTIF · COUNTIFS