
Wildcard characters in Excel are symbols that stand in for unknown text. There are three: the asterisk (*) matches any number of characters, the question mark (?) matches exactly one character, and the tilde (~) tells Excel to treat * or ? as a normal character. They work in functions such as COUNTIF, SUMIF, VLOOKUP and XLOOKUP, and in Find and Replace. The sample data is made up.
The three wildcards
- * matches any run of characters, including none.
Ann*matches "Ann", "Annabel" and "Ann Lee". - ? matches one character.
A?nmatches "Ann" and "Ayn", but not "Alan". - ~ is the escape character.
~*finds a real asterisk, and~?finds a real question mark.

Count cells that contain a word with COUNTIF
To count cells that contain "pen" anywhere:
=COUNTIF(A2:A50, "*pen*")
This counts "pen", "open" and "pencil case". To count cells that start with "pen", use "pen*". To count cells that end with it, use "*pen". See our COUNTIFS guide for several conditions together.

Sum with a partial match
SUMIF takes wildcards in the criteria too. To add the amounts in B for every product that starts with "Desk":
=SUMIF(A2:A50, "Desk*", B2:B50)
Use a wildcard from a cell
When the search word is in a cell, join the symbols to it with &:
=COUNTIF(A2:A50, "*" & E1 & "*")
Change E1 and the count updates.
Wildcards in lookups
VLOOKUP with exact match (the last argument 0 or FALSE) accepts wildcards:
=VLOOKUP("Ann*", A2:C50, 3, FALSE)
XLOOKUP needs the match mode set to 2 to use wildcards: =XLOOKUP("Ann*", A2:A50, C2:C50, "Not found", 2). Without it, XLOOKUP treats * as a normal character. Both return the first match only. The two functions are compared in XLOOKUP vs VLOOKUP.

Find and Replace with wildcards
Press Ctrl+H. In Find what, type Ann* to find any text that starts with Ann. Be careful with Replace All, because * can match more than you expect. Click Find All first and check the list.
Find a real asterisk or question mark
Put a tilde before the symbol. To count cells that contain a question mark, use =COUNTIF(A2:A50, "*~?*"). Without the tilde, ? would match any single character.

Wildcards do not work with numbers
COUNTIF with "1*" counts text that starts with 1, but not the number 100, because numbers are not text. To match number patterns, convert them to text or use a formula such as SUMPRODUCT with LEFT. Our LEFT, RIGHT and MID guide shows how.
Where wildcards do not work
They do not work in IF comparisons such as =A2="Ann*", which only tests for that exact text. They also do not work in SEARCH or FIND the way people expect: SEARCH accepts wildcards, but FIND does not.
Questions and answers
Are wildcards case sensitive?
No. COUNTIF and similar functions ignore case.
Do wildcards work in Google Sheets?
COUNTIF, SUMIF and similar functions accept * and ? in Google Sheets. Regular expressions are also available there, as covered in our REGEXEXTRACT guide.
Can I use more than one wildcard?
Yes. "*pen*red*" matches text that has "pen" followed later by "red".
Why does my wildcard match too much?
The asterisk matches any length. Use ? for single characters, or add more fixed text to the pattern.
