The Find and Replace tool in Excel saves you from manually editing every cell
Find and Replace is a built-in Excel feature that searches for text or numbers in your spreadsheet and swaps them out for something else — all at once. You open it with Ctrl+H on Windows or Command+Option+F on Mac, type what you're looking for and what you want instead, then choose whether to replace one instance or every match in the sheet. It works across formulas, cell values, and formatting, and it's the fastest way to fix repeated mistakes or update information that appears in dozens of cells.
The tool is straightforward once you know where the options are and what each one does. Most people use it for simple text swaps, but it also handles wildcards and partial matches if you need something more precise.
Key Takeaways
- Open Find and Replace with Ctrl+H (Windows) or Command+Option+F (Mac), then type the text you want to find and what to replace it with.
- Click "Replace All" to change every match at once, or "Replace" to go through each one individually and decide which to change.
- Use "Match entire cell contents" if you want to replace only cells that contain exactly what you typed, not partial matches.
- The tool searches only the current sheet by default — if you need to search multiple sheets, you must run the command on each one separately.
- You can undo a Replace All action immediately after with Ctrl+Z, but not if you close the file first.
Opening Find and Replace and entering your search terms
Press Ctrl+H on Windows or Command+Option+F on Mac. A dialog box appears with two text fields: "Find what" and "Replace with". Type the text or number you want to search for in the "Find what" field. This is case-sensitive by default, so "Smith" and "smith" are treated as different entries — if you want to ignore case, you'll see an option for that in the dialog.
In the "Replace with" field, type what you want to put in place of the found text. If you want to delete the text entirely, leave this field blank. For example, if you're removing a prefix like "SKU-" from product codes, you'd search for "SKU-" and leave "Replace with" empty. Click in the field and make sure it's truly empty — a stray space will be inserted as a space character.
Choosing between Replace and Replace All
After you've entered your search and replacement text, you have two main options. Replace All changes every match in the sheet instantly. Use this when you're confident the replacement is correct everywhere — for instance, if you're fixing a company name that appears in 50 rows. Excel will tell you how many replacements it made.
Replace (the button without "All") finds the first match and highlights it, then waits for you to decide. You can click "Replace" to swap that one instance, "Replace All" to replace this and every other match, or "Find Next" to skip it and move to the next match. This approach is safer when you're not sure every match should be changed. For example, if you're replacing "May" with "May 2024", you might want to skip instances where "May" is part of a name like "Mayfield".
Using Match Entire Cell Contents to avoid partial replacements
By default, Find and Replace looks for your search text anywhere within a cell. If you search for "cat", it will find "cat", "catalog", "concatenate", and "category". To search for only cells that contain exactly "cat" and nothing else, check the box labeled "Match entire cell contents" before you click Replace or Replace All.
This option is essential when you're working with codes or short values where partial matches would be wrong. If you're replacing product codes and you search for "100" without this option checked, you'll also match "1001", "1002", and "10050". With the box checked, only cells containing exactly "100" will be replaced.
Searching with wildcards for flexible matches
If you need to find text that follows a pattern but isn't identical, you can use wildcards — special characters that stand in for unknown text. The asterisk (*) matches any number of characters, and the question mark (?) matches exactly one character. First, check the box labeled "Use wildcards" or "Use regular expressions" (the exact wording depends on your Excel version).
For example, if you want to find all cells starting with "Invoice" followed by any number, search for "Invoice*" and replace with "Bill*" to keep the numbers intact. Or if you're looking for three-digit numbers surrounded by dashes, search for "-???-" to match "-123-", "-456-", and so on. Wildcards are powerful but take practice — start with simple patterns and test on a copy of your data first.
Understanding what Find and Replace can and cannot do
Find and Replace works on the text and numbers you see in cells, as well as inside formulas. If a cell displays "50" because of a formula that calculates 25+25, you can search for "50" and replace it, but the formula itself will be replaced too — the cell will then contain just the number "50" instead of the formula. This is usually not what you want, so be careful when searching for values that might be formula results.
The tool searches only the current sheet by default. If your workbook has multiple sheets and you need to replace text across all of them, you must run Find and Replace on each sheet separately. There is no "search all sheets" option in standard Excel. Also, Find and Replace does not search in cell comments or in the names of sheets themselves — only in cell contents.
Undoing a Replace All if something goes wrong
If you click Replace All and immediately realize you made a mistake, press Ctrl+Z right away to undo the entire operation. Excel will restore every cell to its previous state. This works even if hundreds of replacements were made — one undo reverses them all.
However, undo only works if you haven't closed the file. Once you close and reopen the spreadsheet, the undo history is gone and you cannot recover the original text. For this reason, it's wise to save a backup copy of important files before running Replace All on large datasets. If you're nervous about a replacement, use the regular "Replace" button to go through matches one at a time instead.
Frequently Asked Questions
Can I search for line breaks or special characters?
Yes, but the method depends on your Excel version. In newer versions, you can search for special characters by typing them directly or using codes like ^n for line breaks. In older versions, you may need to enable "Use regular expressions" and use codes like \n. Check your version's help menu for the exact codes, as they vary.
What if I only want to replace text in certain columns, not the whole sheet?
Select the columns you want to search before opening Find and Replace. Highlight the column headers or drag across the cells you want included. When you open the dialog, the search will be limited to your selection. If you don't select anything first, the entire sheet is searched.
Does Find and Replace work on hidden rows or filtered data?
Yes, it searches hidden rows and filtered data by default. If you want to exclude hidden rows, you must unhide them first. For filtered data, the search includes both visible and hidden rows unless you manually delete the hidden rows before running the command.
Can I replace with a formula instead of plain text?
No, Find and Replace treats everything in the "Replace with" field as literal text or numbers. If you type "=SUM(A1:A10)", it will insert that exact text as a formula, but it won't calculate. To replace cell contents with formulas, you need to use other methods like copy-paste special or a helper column.
Why does Find and Replace say "Search key not found" when I'm sure the text is there?
The most common reason is a case mismatch — you searched for "Smith" but the cells contain "smith". Uncheck "Match case" if it's checked. Another reason is extra spaces: if you search for "John " (with a space) but the cell contains "John" (no space), it won't match. Copy the text directly from the cell and paste it into the Find field to avoid this.