Frequently, you may need to find a particular data, formatting, or even cell references and then replace it with something new. Find and Replace is one of the simple but multifaceted features that may fulfill your requirement. In this article, I’ll demonstrate to you 7 methods to find and replace in Excel within the selection with the necessary explanation.
Table of Contents hide
Download Practice Workbook
Introduction to the Excel Find and Replace Feature
7 Methods to Find and Replace within Selection in Excel
1. Find and Replace in Selected Cells Only
2. Using Wildcard to Find and Replace within Selection
3. Add or Remove a Line Break Using the Find and Replace Feature
4. Changing Specific Formatting
5. Changing Cell Reference
6. Find and Replace across the Entire Workbook within Selection
7. Using the VBA Code
7.1. Find using VBA
7.2. Replace Using VBA
Conclusion
Related Articles
Download Practice Workbook
Find and Replace within Selection.xlsm
Introduction to the Excel Find and Replace Feature
The Find and Replace feature provides the advantage of searching any data and then modifying or removing the data with the new one. You may simply open the feature from the Editing ribbon in the Home tab. Then, click on the Find & Select option. Immediately, you’ll see some options e.g. Find, Replace, and so on.
To open the Find feature, click on the corresponding (Find) option.
Shortly, you’ll see the following dialog box. Under the Find tab, you’ll see a box namely Find What. In the box, you have to type the text or numbers or any data that you want to find out. After doing that, if you click on the Find All option, Excel will show you all matched occurrences with the name Workbook, Sheet, Cell, Value, etc. But if you click on the Find Next option, you’ll see the first matched occurrences instead of the occurrences.
Besides, you may easily open the Replace feature by either choosing the Replace tab from the above picture or Replace option from the Find & Select option.
After opening the following dialog box, you’ll see a box after Replace with. Here, you need to insert the data that you want to replace. Then, if you choose the Replace option, you’ll see that only a single data is replaced. But in the case of the Replace All option, all data will be replaced within seconds.
Keyboard Shortcut of the Find and Replace Feature
Alternatively, you may use the keyboard shortcut if you wish. Just press CTRL + F to open the Find feature.
Moreover, press CTRL + H to open the Replace feature.
7 Methods to Find and Replace within Selection in Excel
Let’s introduce today’s dataset where the sales report of some Items is given along with the concerning Sales Rep. Besides, Quantity, Unit Price, and Sales for each item are also provided.
Now, you’ll see the application of the Find and Replace feature.
1. Find and Replace in Selected Cells Only
In the beginning method, you’ll learn how to find and then replace a selected cell. For example, you may require to find and replace the value of the B7 cell having the spring namely Smith. Follow the steps below.
Firstly, go to the Find what box of the Find feature and type the string as shown in the following image. If you click on the Find All option, you’ll see the cell location of the cell is $B$7.
Secondly, move to the Replace tab (or press CTRL + H). And then, type Steve Smith.
After clicking on the Replace option, you’ll see the string is Steve Smith instead of only Smith.
Similarly, you might accomplish Find and Replace Multiple Values if you want.
Read More: How to Find and Replace Multiple Words at Once in Excel (7 Methods)
2. Using Wildcard to Find and Replace within Selection
Sometimes, you may need to modify or delete data containing some specific values. In such a situation, you may utilize the wildcards to find and replace within the selection. Here, I am going to show you the application of the Asterisk (*) wildcard.
Assuming that you want to find the texts containing “lia”. This may be located in the middle of a text.
➦ Firstly, you may find the texts containing special characters (“lia”). For finding this, just type the *lia* in the Find what box. Then click on the Find All option.
Immediately, you’ll get that $B$8 and $B$12 cells have the characters.
Note: To find the text that begins with “lia”, you have to insert lia*. But you need to insert *lia if you want to find the text that ends with “lia”.
➦ Next, you need to specify the text that you want to get as the replaced text. If you want to get the string James for the texts containing “lia” characters, just type the James in the box of Replace with and also keep the Find what box as it remains.
➦ After clicking on the Replace All option, you’ll get the following message which displays that Excel replaced 2 replacements.
➦ Finally, you’ll get the following output where the two cells are replaced with the James string.
Whatever, I skipped the use of Question mark (?) as wildcards to find and replace.
Read More: How to Find And Replace Values Using Wildcards in Excel
3. Add or Remove a Line Break Using the Find and Replace Feature
In addition, you may have tons of line breaks in your dataset and you want to remove them. It is quite tedious to delete the line break manually. Luckily, you may remove the line breaks using the Find and Replace feature within seconds.
In the following image, I have added a single line break (adding their product model name) for the C5 and C6 cells. Now, I want to remove the line breaks rapidly.
To execute the task, you have to press CTRL + J (the keyboard shortcut for a line break based on ASCII code) in the Find what box. And insert comma (,) and space characters in the box of the Replace with option.
Shortly, you’ll get the following output without any line breaks.
Read More: Add Text and Formula in the Same Cell in Excel (4 Examples)
Similar Readings:
- Find and Replace a Text in a Range with Excel VBA (Macro and UserForm)
- [Fixed!] Excel Find and Replace Not Working (6 Solutions)
- How to Find and Replace Multiple Values in Excel with VBA (3 Examples)
- Find and Replace from List with Macro in Excel (5 Examples)
- How to Replace Special Characters in Excel (6 Ways)
4. Changing Specific Formatting
Furthermore, you might change the formatting of a cell or multiple cells using the Find and Replace feature within the selection in Excel.
Let’s say, you have the following formatting (yellow-colored) in some cells. But you want to change the yellow-colored formatting to blue-colored formatting.
For changing the formatting, click on the drop-down list of the Format option in the Find and Replace dialog box, and click on the Choose Format from Cell.
Then, pick the format by clicking over a cell containing existing formatting.
Again, click on the second Format option, and choose the Format option.
Then, specify the blue color from the Fill tab.
After pressing OK, you’ll get the following previews, and click on the Replace All option.
Eventually, you’ll get the changed formatting as depicted in the following screenshot.
Related Content: Replace Text of a Cell Based on Condition in Excel (5 Easy Methods)
5. Changing Cell Reference
Moreover, you can change the cell reference if necessary.
The used formula in the H5 cell returns the output (Sales) for the corresponding Sales Rep.
Clearly, the same formula would not work for the below cells if you copy the formula unless you change the cell reference from $G$5 into $G$6.
Surely, you can do this in two ways. Either you can remove the absolute reference before the column number or use the Find and Replace feature. Just insert the $G$5 in Find what box and $G$6 in Replace with box.
After clicking on the Replace option, you’ll get your desired output.
Read More: How to Replace Text in Excel Formula (7 Easy Ways)
6. Find and Replace across the Entire Workbook within Selection
More importantly, you might find and replace the selected data for all the working sheets of any workbook.
For example, I want to find David and then replace it with David Bowie. To accomplish the task, insert David in the Find what box and David Bowie in the box of the Replace with option.
Then, choose Workbook instead of Sheet from the drop-down list of the Within option.
If you click on the Replace All option, Excel will show a message of accomplishing 4 replacements along the entire workbook.
For example, if you move to another worksheet within the same workbook, you’ll get the changed output.
Related Content: How to Find and Replace Values in Multiple Excel Files (3 Methods)
7. Using the VBA Code
If you are accustomed to using VBA code in Excel, you may use the Find and Replace here also. However, you must insert a module to enter the VBA code.
Firstly, open a module by clicking Developer > Visual Basic.
Secondly, go to Insert > Module.
7.1. Find using VBA
Then, copy the following code into the newly created module to find the string i.e. David.
Sub Find()Dim Rng As Range Set Rng = Sheets("Find&Replace_VBA").UsedRange.Find("David")MsgBox Rng.Address End Sub
Here, I declared Rng as Range. Then, I set Rng with the VBA Find function (also specified the string “David” and the UsedRange property to find the specified string. Besides, I used the Sheets function along with the current sheet name.
Next, if you run the code (the keyboard shortcut is F5 or Fn + F5), you’ll see the following output.
7.2. Replace Using VBA
Again, use the following code to replace the specified string.
Sub Replace()Sheets("Find&Replace_VBA").UsedRange.Replace What:="David", Replacement:="Steve"End Sub
In the above code, I used the VBA Replace function. Then, I specified “David” after the What option that I want to remove and “Steve” after the Replacement option that I want to get as the replaced string.
After running the code, you’ll get the following output.
Note: Here, I discussed the basic VBA Find and Replace function. You may explore 11 ways to Find and Replace using the VBA.
Read More: Excel VBA: How to Find and Replace Text in Word Document
Conclusion
That’s the end of today’s session. I strongly believe from now you may execute the find and replace within selection in Excel. Anyway, if you have any queries or recommendations, please share them in the comments section below
Related Articles
- Data clean-up techniques in Excel: Adding text to cells
- How to Use the Substitute Function in Excel VBA (3 Examples)
- Replace Special Characters in Excel (6 Ways)
- How to Find and Replace Asterisk (*) Character in Excel
- How to Find and Replace in Excel Column (6 Ways)
FAQs
Can you find and replace within a formula? ›
Select the cells that have the formula in which you want to replace the reference. If you want to replace in the entire worksheet, select the entire worksheet. Go to Home –> Find and Select –> Replace (Keyboard Shortcut – Control + H).
How do you automate multiple find and replace in Excel? ›The easiest way to find and replace multiple entries in Excel is by using the SUBSTITUTE function. The formula's logic is very simple: you write a few individual functions to replace an old value with a new one.
Why is Excel find and replace not finding anything? ›Sometimes the Find & Replace feature won't work because the data you are looking for is actually missing from the worksheet due to Excel file corruption. In this case, the best thing you can do is to repair the file using the Restore function.
How do I find and replace within a selection in Excel? ›Press Ctrl+H or go to Home > Find & Select > Replace. In Find what, type the text or numbers you want to find. You can further define your search: Within: To search for data in a worksheet or in an entire workbook, select Sheet or Workbook.
How do I find and replace selected cells in Excel? ›To replace cell content:
From the Home tab, click the Find & Select command, then select Replace... from the drop-down menu. The Find and Replace dialog box will appear. Type the text you want to find in the Find what: field. Type the text you want to replace it with in the Replace with: field, then click Find Next.
- Select Replace or press Ctrl + H. ...
- In the Find what box, type the text you want to search for.
- Select Find Next to see where the text appears in your file. ...
- In the Replace with box, type the text you want.
- Select Replace to change the text or select Replace All to change all instances of this text in your file.
Find and Replace in Google Sheets
Similarly, you can also find and replace multiple values in Google Sheets. Select the range where you want to replace values (here, B2:B19), and in the Menu, go to Edit > Find and replace (or use the keyboard shortcut CTRL + H).
- Select the cell or range of cells that contains the formulas. If the formula is an array formula, select the range that contains the array formula. ...
- Click Copy .
- Click Paste .
- Click the arrow next to Paste Options. , and then click Values Only.
Find/Replace with formatting
Another option is the ability to replace one set of text with another and apply formatting to the new text at the same time. To demonstrate, press the key combination CTRL-H on your keyboard to open the Replace tab of the Find and Replace dialog box.
- Click the Replace button on the Home tab.
- Click More to expand the dialog box.
- Click the Format button.
- Select the type of formatting you want to replace.
- Specify the formatting you want to replace and click OK.
- Click in the Replace With field.
- Click the Format button again.
How do you conditionally format every change in value in Excel? ›
Select any cell to which the rule applies and click Conditional Formatting > Manage Rules… In the Rules Manager dialog box, click the rule you want to modify, and then click the Edit Rule… button. In the Edit Formatting Rule dialog window, make the required changes and click OK to save the edits.
Why is find replace not working? ›Have you made a selection of text? If so, the replace operation will work only within that selection. Have you cleared the formatting? (Unless the formatting is necessary for what you are trying to do.) Is Track Changes turned on? (Some functions using wildcards don't work as expected if Track Changes is on.)
Which option does the Find and Replace feature support? ›Find and Replace helps you to find words or formats in a document and can let you replace all instances of a word or format. This is particularly handy in long documents. To use Find and Replace, use the shortcut Ctrl+H or navigate to Editing in the Home tab of the ribbon, then choose Replace.
How do you find and replace in Excel without losing formatting? ›- Press F5 key, a dialog pops out for you to select a range to find and replace, see screenshot:
- Click OK, and the specific string in the selected cell are replace with other and keep the formatting.
To quickly find and replace text in a specific column, use the Ctrl+Shift+F shortcut. This will open the Find and Replace dialog box. Then, click the Options button and select the Match Entire Cell Contents check box.
How do I replace a character in a string in Excel? ›Use SUBSTITUTE when you want to replace specific text in a text string; use REPLACE when you want to replace any text that occurs in a specific location in a text string.
How do you find and replace only in filtered cells in Excel? ›Select cells you will replace in the filter range, and press Alt + ; keys simultaneously to select only visible cells. 2. Type the value that you will replace with, and press the Ctrl + Enter keys at the same time. Then you will see all selected cells in filtered range are replaced by the typed values at once.
What is the formula to replace text in Excel? ›=REPLACE(old_text, start_num, num_chars, new_text)
The REPLACE function uses the following arguments: Old_text (required argument) – This is the text we wish to replace some characters. Start_num (required argument) – The position, within old_text, of the first character that you want to replace.
Both features appear together, but they perform separately. The Find function allows you to locate a particular number or text string, while the Replace function helps you replace a particular number or text string with something else.
Can we replace one type value with another type value in Microsoft Excel? ›In Power Query, you can replace one value with another value in a selected column. You can replace specific values or the whole value in a cell.
How do you use the Find function in Excel? ›
- Find_text Required. The text you want to find.
- Within_text Required. The text containing the text you want to find.
- Start_num Optional. Specifies the character at which to start the search. The first character in within_text is character number 1.
- On your computer, open a spreadsheet in Google Sheets.
- Click Edit. ...
- Next to "Find," type the word you want to find, If you want to replace the word, enter the new word next to "Replace with."
- To search for the word, click Find. ...
- Optional: Narrow your search by using an option below.
Advanced Find and Replace for Excel makes it easy to search across multiple spreadsheets and workbooks, select or replace all found values in a click. It can simultaneously search in values, formulas, hyperlinks, and comments with case-sensitive, case-insensitive or exact match.
How do you check for multiple values in Excel? ›Another way to get an Excel IF to test multiple conditions is by using an array formula. To complete an array formula correctly, press the Ctrl + Shift + Enter keys together. In Excel 365 and Excel 2021, this also works as a regular formula due to support for dynamic arrays.
How do I find and replace parts of a formula in Excel? ›You can use find and replace (Ctrl + Shift + H or on the Home Ribbon, click on the Find & Select button under editing). Once the form pops open, select Look In "Formulas" and then type in the Find what and Replace with values. e.g. Sales and New_Sales. You can choose to replace just the one found or replace all.
What is the use of replace () function? ›REPLACE replaces part of a text string, based on the number of characters you specify, with a different text string.
How do I check if a cell contains a specific text in Excel? ›- Select the range of cells that you want to search. ...
- On the Home tab, in the Editing group, click Find & Select, and then click Find.
- In the Find what box, enter the text—or numbers—that you need to find.
If you need to compare two cells for contents, including a case sensitive comparison of letters, use the EXACT function. As its name indicates, the EXACT function can check for an exact match between text strings, including upper and lower case.
How do you use advanced find and replace? ›- Click Find button list arrow.
- Select Advanced Find.
- Type the word you're looking for in the Find box. By default, the Find and Replace dialog box only shows the basics—a search field. ...
- Click the More button.
- Check the advanced criteria you want to use. ...
- Click Find Next. ...
- Click Close when you're done.
Detailed Solution. Find and Replace is not just for finding and replacing a specific word with another word; it can also be used to change a format throughout your document. Document name can be changed by saving the file with a different name or by right clicking on the file.
Which option is used to change any specific data from another specific data? ›
Shift registers can be used to change the data from special code to temporal code.
What are the 3 conditional formatting options? ›They are grouped into three categories: Data Bars are horizontal bars added to each cell, much like a bar graph. Color Scales change the color of each cell based on its value. Each color scale uses a two- or three-color gradient.
How do I create a dynamic conditional formatting in Excel? ›- We can accomplish this by utilizing a formula in the Conditional Formula rule. ...
- In the New Formatting Rule dialog box, select the Rule Type “Use a formula to determine which cells to format” and enter the following formula: =$B$6 > $B$3.
- Select the cells you want to apply conditional formatting to. Click the first cell in the range, and then drag to the last cell.
- Click HOME > Conditional Formatting > Highlight Cells Rules > Text that Contains. ...
- Select the color format for the text, and click OK.
Sometimes the Find & Replace feature won't work because the data you are looking for is actually missing from the worksheet due to Excel file corruption. In this case, the best thing you can do is to repair the file using the Restore function.
Why can't I search for a number in Excel? ›To work around this issue, set the filter criteria to Show All on each worksheet in your workbook before you perform the search. To do this, follow these steps: Start Excel, and then open the workbook that you want to search. On the Data menu, point to Filter, and then click Show All.
Why is control find not working in Excel? ›Check that your serach options are set to look in Values, not Formulas. Make sure you don't have multiple cells selected (otherwise, Search will only look in selected cells). Make sure "Match whole cell" isn't selected , unselect Match Entire cell contents.
What is find and replace method? ›Find and replace basic text
, type the word or phrase that you want to find, and Word will highlight all instances of the word or phrase throughout the document. To replace found text: Select the magnifying glass, and then select Replace. In the Replace With box, type the replacement text.
- Select Replace or press Ctrl + H. ...
- In the Find what box, type the text you want to search for.
- Select Find Next to see where the text appears in your file. ...
- In the Replace with box, type the text you want.
You use the Find and Replace dialog box when you want to find and optionally replace small amounts of data, and when you are not comfortable using a query to find or replace data.
How do you automate find and replace in Excel? ›
- Select the range of cells where you want to replace text or numbers. ...
- Press the Ctrl + H shortcut to open the Replace tab of the Excel Find and Replace dialog. ...
- In the Find what box type the value to search for, and in the Replace with box type the value to replace with.
- Click the cell that contains the formula.
- In the formula bar. ...
- To calculate the selected portion, press F9.
- To replace the selected portion of the formula with its calculated value, press ENTER.
=REPLACE(old_text, start_num, num_chars, new_text)
The REPLACE function uses the following arguments: Old_text (required argument) – This is the text we wish to replace some characters. Start_num (required argument) – The position, within old_text, of the first character that you want to replace.
Click View in the toolbar, then choose Show Find & Replace. in the Find & Replace window, then choose Find & Replace. You can also select other options, such as Whole Words and Match Case, to refine your search.
Can you do a formula within a formula in Excel? ›The AVERAGE and SUM functions are nested within the IF function. You can nest up to 64 levels of functions in a formula. Click the cell in which you want to enter the formula. Excel inserts the equal sign (=) for you.
How do you replace a part of a formula in multiple cells? ›You can use find and replace (Ctrl + Shift + H or on the Home Ribbon, click on the Find & Select button under editing). Once the form pops open, select Look In "Formulas" and then type in the Find what and Replace with values. e.g. Sales and New_Sales. You can choose to replace just the one found or replace all.
How do I replace a character in a specific position in Excel? ›- Start with =REPLACE( function.
- Type or select the range that contains your text B2,
- Continue with the position that replacement start 10,
- Next enter the number of characters after the start position 4,
- Enter the text to replace with "XXXX"
- Type ) to close function and finish the formula.
Use SUBSTITUTE when you want to replace specific text in a text string; use REPLACE when you want to replace any text that occurs in a specific location in a text string.
How does find function work in Excel? ›What is the FIND Function? The FIND Function[1] is categorized under Excel TEXT functions. The function will return the position of a specified character or sub-string within a supplied text string. In financial analysis, we can use this function to locate specific data.
How do I replace columns in Excel? ›Press and hold the Shift key, and then drag the column to a new location. You will see a faint "I" bar along the entire length of the column and a box indicating where the new column will be moved. That's it! Release the mouse button, then leave the Shift key and find the column moved to a new position.
How do I find and replace only one column in numbers? ›
Re: Restricting Find/Replace to single column
if you want to select the whole column click on the header and press ctrl+SpaceBar then click on ctrl+H to replace the elemnts you need .
Another way to get an Excel IF to test multiple conditions is by using an array formula. To complete an array formula correctly, press the Ctrl + Shift + Enter keys together. In Excel 365 and Excel 2021, this also works as a regular formula due to support for dynamic arrays.
How to apply the same formula to multiple cells in Excel with different values? ›- Select the cell with the formula and the adjacent cells you want to fill.
- Click Home > Fill, and choose either Down, Right, Up, or Left. Keyboard shortcut: You can also press Ctrl+D to fill the formula down in a column, or Ctrl+R to fill the formula to the right in a row.
If you need to do more than one logical test in a formula, you can combine multiple IF functions in one formula. This is called a nested formula, because the additional IF functions act as arguments, nested within another IF function.