Excel functions / References & tools

Wildcard characters

Match part of some text with *, ? and ~ in COUNTIF, SUMIF, lookups and Find.

At a glance

*Any number of characters, including none. "*tea" matches Green tea and Mint tea.
?Exactly one character. "?at" matches cat and hat, but not that.
~Treats the next * or ? as a real character. "~*" finds an actual asterisk.

How it works

Wildcards let a condition match text you only partly know. They work in COUNTIF, SUMIF, AVERAGEIF and their -IFS versions, in MATCH, VLOOKUP and XLOOKUP (with match mode 2), and in the Find and Replace box.

Combine them with a cell by joining with &: ="*"&E1&"*" matches any text containing whatever is typed in E1.

Example

D2=COUNTIF(A2:A5,"*tea")
ABCD
1ProductAmount
2Green tea103
3Coffee30
4Mint tea24
5Black tea36
6

Result: 3. Three of the products end in tea.

Tips

Practise Wildcard characters

Try it yourself in a real spreadsheet, with instant feedback on every answer.

Start the exercise

Related