When using Microsoft Excel’s Find and Replace tool, you typically search for exact matches. For example, if you want to change the word “Manager” to “Director,” Excel effortlessly scans the document and makes the swap. But what if your data is inconsistent? What if you need to find and delete all email addresses in a column, but every employee has a different name before the @company.com domain? You cannot type every single name into the search box. Instead, you must use wildcard characters. Wildcards are special symbols that act as placeholders for unknown text, allowing you to perform incredibly powerful, pattern-based searches across massive datasets.
The Asterisk (*) Wildcard
The asterisk (*) is the most commonly used wildcard. It represents any number of characters, from zero to infinity.
Imagine a spreadsheet column containing hundreds of product codes, some starting with “PROD-” and ending with different serial numbers (e.g., PROD-1234, PROD-99X, PROD-ABC). You want to delete all these codes but leave the other text in the column intact.
- Press
Ctrl + H(Windows) orCmd + Shift + H(Mac) to open the Find and Replace dialogue box. - In the Find what: box, type:
PROD-* - Leave the Replace with: box completely empty.
- Click Replace All.
Excel will find every string that begins with “PROD-” and delete it, regardless of how many letters or numbers follow the hyphen.
Similarly, if you wanted to find every email address from a specific domain (e.g., [email protected], [email protected]), you would search for *@apple.com.
The Question Mark (?) Wildcard
While the asterisk represents an unlimited string of characters, the question mark (?) is highly specific: it represents exactly one single character.
This is extremely useful for correcting standardized formatting or spelling variations. For example, suppose you have a list of names where “Smith” was sometimes spelled as “Smyth.”
- Open the Find and Replace dialogue box.
- In the Find what: box, type:
Sm?th - In the Replace with: box, type:
Smith - Click Replace All.
Excel will find both “Smith” and “Smyth” and standardize them. It will not find “Smooth”, because “oo” is two characters, and the single question mark only allows for one.
You can use multiple question marks if needed. Searching for 20?? would find any four-digit year starting with 20 (like 2021 or 2024).
Searching for Actual Asterisks or Question Marks
Because Excel treats * and ? as magical wildcards by default, a problem arises if you actually need to search for a literal asterisk or question mark in your text (e.g., finding all sentences that end in a question mark). If you just type ? into the search box, Excel will think you are searching for any single character in the entire spreadsheet.
To tell Excel to treat the symbol as normal text, you must place a tilde (~) directly in front of it. The tilde acts as an “escape” character.
- To find a literal question mark, type
~?in the Find what: box. - To find a literal asterisk, type
~*in the Find what: box.
Excel will temporarily disable the wildcard functionality and execute a standard text search for that specific punctuation mark.