Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Wildcard Find Replace Filter Formulas

· 5 min read · Home Tech

In this article
  1. What Wildcards Does Excel Support?
  2. Using Wildcards in Find and Replace
  3. Wildcards in Filtering
  4. Wildcards in Formulas
  5. How to Escape Wildcards in Formulas
  6. Common Mistakes and Limitations
  7. Alternatives to Wildcards
  8. Frequently Asked Questions

Excel wildcards let you find, replace, and filter text using patterns instead of exact matches. This article explains how the three wildcard characters work in Find & Replace, filters, and formulas, with examples and common pitfalls.

What Wildcards Does Excel Support?

Excel supports three wildcard characters, each with a specific meaning:

  • Asterisk (*) – matches any sequence of characters (including zero characters). For example, Jo* matches "John", "Jo", and "Jordan".
  • Question mark (?) – matches exactly one character. For example, J?n matches "Jan" and "Jon", but not "John".
  • Tilde (~) – escapes the next character, so you can search for a literal asterisk or question mark. For example, ~* finds cells containing an asterisk.

These wildcards work in the Find and Replace dialog, in AutoFilter, and in several functions like COUNTIF, SUMIF, VLOOKUP, and MATCH (when using exact match). They do not work in all functions – for instance, XLOOKUP and FILTER do not support wildcards by default.

Using Wildcards in Find and Replace

To use wildcards in Find and Replace:

  1. Press Ctrl+F to open Find, or Ctrl+H for Replace.
  2. Type your pattern in the "Find what" box. For example, s* finds any cell starting with "s".
  3. Check "Match entire cell contents" if you want the pattern to match the whole cell, not just a part of it.
  4. Click "Find All" to list matches or "Replace All" to replace them.

For example, to replace all text that starts with "temp" and ends with any three digits, use temp??? in Find what and enter the replacement text. If you need to find a literal asterisk, type ~*.

Wildcards in Filtering

Excel's AutoFilter also supports wildcards. When you click the filter arrow on a column and type in the search box, you can use an asterisk or question mark. For example, typing *east* in the search box filters rows where the cell contains "east" anywhere. Typing J?n filters to "Jan" and "Jon".

One limitation: the filter search box does not allow a leading asterisk in some versions – typing *east may not work as expected. A common workaround is to use a helper column with a formula like =ISNUMBER(SEARCH("east",A2)) and filter on that column for TRUE.

Wildcards in Formulas

Several functions accept wildcards when the match type is exact (0 or FALSE). Here are the most common:

  • COUNTIF(range, "*east*") – counts cells containing "east".
  • SUMIF(range, "s*", sum_range) – sums values where the corresponding cell starts with "s".
  • VLOOKUP("*"&A1&"*", table, col, FALSE) – finds the first cell containing the value in A1.
  • MATCH("J?n", range, 0) – returns the position of the first cell that matches the pattern.

Note that SEARCH and FIND do not support wildcards – they search for literal text. If you need case-insensitive wildcard matching, use COUNTIF or SUMIF instead.

How to Escape Wildcards in Formulas

If you need to match a literal asterisk or question mark in a formula, you must escape it with a tilde. For example:

  • COUNTIF(A1:A10, "~*") – counts cells that contain an asterisk.
  • COUNTIF(A1:A10, "~?") – counts cells that contain a question mark.
  • COUNTIF(A1:A10, "*~**") – counts cells that start and end with an asterisk (the middle ~* is the literal asterisk).

This is especially important when cleaning data that contains punctuation.

Common Mistakes and Limitations

Here are the most frequent issues users run into:

  • Wildcards not working in XLOOKUP or FILTER – these functions do not support wildcards. Use VLOOKUP or MATCH with exact match instead, or use FILTER with ISNUMBER(SEARCH(...)).
  • Case sensitivity – COUNTIF and SUMIF are not case-sensitive. If you need case-sensitive matching, use SUMPRODUCT with EXACT.
  • Leading asterisk in filters – some versions ignore a leading asterisk in the filter search box. Use a helper column instead.
  • Overlooking the tilde – forgetting to escape wildcards when searching for literal characters leads to unexpected matches.
  • Matching entire cell – by default, Find and Replace matches substrings. Use the "Match entire cell contents" checkbox to restrict to whole-cell matches.

Alternatives to Wildcards

If wildcards are not sufficient, consider these alternatives:

  • Regular expressions (RegEx) – not built into Excel, but you can use VBA or the newer REGEXTEST, REGEXEXTRACT, and REGEXREPLACE functions if you have Microsoft 365 (current channel).
  • Power Query – has its own text matching options, including "Contains" and "Starts With" filters, which are easier to use than wildcards for some tasks.
  • Helper columns – use LEFT, RIGHT, MID, or SEARCH to create a logical flag, then filter or sum based on that flag.

For example, to filter rows where column A ends with "2024", you could use a helper column with =RIGHT(A2,4)="2024" and filter on TRUE.

Frequently Asked Questions

Why doesn't my wildcard work in VLOOKUP?

VLOOKUP supports wildcards only when the last argument is FALSE (exact match). If you use TRUE (approximate match), wildcards are ignored. Also, the wildcard must be part of the lookup value, not the table array.

Can I use wildcards in conditional formatting?

Yes, you can use wildcards in formulas for conditional formatting rules. For example, to highlight cells containing "east", use a formula like =COUNTIF(A1,"*east*")>0 applied to the range.

How do I find a literal question mark in a cell?

Use ~? in Find and Replace or in formulas. For example, =COUNTIF(A1:A10,"~?") counts cells that contain a question mark.

Does Excel support wildcards in the FILTER function?

No, the FILTER function does not support wildcards. Use FILTER with ISNUMBER(SEARCH("text",range)) to achieve a similar result.

Are wildcards case-sensitive in Excel?

No, wildcard matching in Find, Replace, and functions like COUNTIF is not case-sensitive. For case-sensitive wildcard matching, you need to use SUMPRODUCT with EXACT and array logic.

Can I use wildcards in data validation?

Data validation does not support wildcards directly. You can create a custom formula that uses COUNTIF to validate against a pattern, but it is not as straightforward as using wildcards in a filter.