FormulaCraft

How to use COUNTIF with a wildcard in Excel and Google Sheets

Topic:COUNTIF & COUNTIFS
Excel & Google Sheets
=COUNTIF(A2:A5,"*apple*")

Verified example

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

Product
Green Apple
Banana
Pineapple
Apple Juice

=COUNTIF(A2:A5,"*apple*")3

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. 1Click the cell where you want the count.
  2. 2Type =COUNTIF(A2:A100, then enter your wildcard pattern in quotes.
  3. 3Use * to match zero or more characters: "apple*" matches anything starting with apple; "*apple" matches anything ending with it; "*apple*" matches anywhere.
  4. 4Use ? to match exactly one unknown character, e.g., "app?e" matches apple or appie.
  5. 5Press Enter to see the count.

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

What if I want to match a literal asterisk?

Prefix it with a tilde: "~*" matches a real asterisk character rather than acting as a wildcard.

Can I use wildcards with COUNTIFS?

Yes, COUNTIFS supports the same * and ? wildcards in any of its criteria arguments.

More on COUNTIF & COUNTIFS

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: