Wildcards in Excel: match partial text with * and ?

Updated October 29, 2026 · 3 min read

In Excel, * matches any number of characters and ? matches exactly one. =COUNTIF(A2:A7,"*a*") counts names containing an a. Wildcards work in COUNTIF, SUMIF, COUNTIFS, SUMIFS, VLOOKUP and MATCH.

The examples use the same sales table as the practice box below.

A RepB SalesE RegionH Hired
2Dana1,250East3/12/2018
3Luis830West7/1/2021
4Priya2,100East11/20/2016
5Marcus475North2/15/2023
6Jen990West9/3/2019
7Omar1,600East1/27/2020

The three symbols

SymbolMeansExample
*Any number of characters, including none"J*" matches Jen
?Exactly one character"?uis" matches Luis
~Treat the next * or ? as a real character"~*" matches an asterisk

Examples

  • =COUNTIF(A2:A7,"*a*") returns 4: Dana, Priya, Marcus and Omar.
  • =COUNTIF(A2:A7,"?????") returns 1: Priya, the only five-letter name.
  • =SUMIF(A2:A7,"M*",B2:B7) returns 475, the sales for names starting with M.
  • =VLOOKUP("No*",J2:L4,2,FALSE) returns Cara Lim, the manager for North.

Using a cell with a wildcard

Join the wildcard to a cell: =COUNTIF(A2:A7,"*"&C1&"*") counts names containing whatever is typed in C1. This is how simple search boxes work in spreadsheets.

Where wildcards don't work

  • In a plain comparison. =IF(A2="J*","Yes","No") looks for the actual text "J*". Use =IF(COUNTIF(A2,"J*"),"Yes","No") instead.
  • In XLOOKUP, unless you set match_mode to 2.
  • On numbers. "12*" won't match 1250, since wildcards only match text.

Try it: Count names with an a

In B8, count how many rep names in A2:A7 contain the letter a anywhere.

B8

Graded live, like a real Excel test. Press New numbers to prove you didn't memorize the answer. More practice

Questions people ask

Are wildcards case sensitive?

No. "j*" and "J*" match the same names.

Does Google Sheets support wildcards?

Yes, in COUNTIF, SUMIF, VLOOKUP and MATCH, the same as Excel.

Practice on a real spreadsheet

CellReady grades your formula the moment you press Enter and tells you why a wrong answer is wrong. The first 7 lessons are free, with no sign-up to start.

Start lesson one

Related guides

Excel COUNTIF function: count cells that meet a condition

How to use COUNTIF in Excel with numbers, text and cell references, plus COUNTIFS for two conditions and a live exercise.

Excel COUNTIFS function: count with two or more conditions

How to use COUNTIFS in Excel to count rows that meet several conditions, including number ranges, dates and OR logic, with a live exercise.

Excel VLOOKUP function: find a value in a table

How VLOOKUP works in Excel, why you should always end it with FALSE, how to lock the table with $, its limits, and a live exercise.