REPLACE and SUBSTITUTE are both used to easily replace or substitute specific text or values within a range of cells. In this article, we will explore the differences between the “replace” and “substitute” functions and provide examples of how they are used.
SUBSTITUTE: This function replaces specific text or values within a range of cells by substituting the character or characters you give Excel.
In this example, we want to change the number “90” to “80.” To do this, we will use the SUBSTITUTE function. Here’s a step-by-step guide:
- In a cell, type =SUBSTITUTE(
- Select the cell you want to make chanes to.
- Add a comma, and then input the characters you wish to change. In this example, “90”.
- Add a comma, and then input the text you wish to change it into. In this, example, “80”.
- Close the parentheses and then press Enter.
Both instances of 90 in the example are replaced with 80. However, you only want to change the second instance of “90,” the one after “English.” To do this, we will add an extra argument in the function. The formula should now be: =SUBSTITUTE(D2,90,80,2). This tells Excel to only substitute the second instance of 90 in the cell.
REPLACE: This function changes a character in a string in a cell based on where the character’s specific position is.
In the same example above, we want to change the second instance of “90” to “80.” Instead of using SUBSTITUTE, we will be using REPLACE. Here’s a step by step guide
- In a cell, type =REPLACE(
- Select the cell you want to make changes to.
- Add a comma, and then input the position of the character you wish to change. In this example, it is on the 23rd position.
- Add a comma, and then input the number of characters you wish to change. In this instance, only two characters: “90”
- Add a comma, and then input the text you want to replace on the string. In this case, changing 90 to 80.
- Close the the parentheses and then press Enter.
Replacing text using Find and Replace. In this example, we want to replace all instances of “US” and “CA” in the column Center Code with “USA” and “CANADA,” respectively. Instead of using the REPLACE or SUBSTITUTE formulas, we will use the Find and Replace feature in Excel. Here’s a step-by-step guide.
- Highlight the range of cells you wish to replace.
- In the Home tab, click Find & Select, and then Replace.
- In the “Find what” Text box, input the text you wish to replace. In this example, “US”
- In the “Replace with” Text box, input the text you wish to replace the original with. In this example, “USA”
- Click “Replace all” if you want to replace all instances of “US”, otherwise, if you want to replace only one cell, click “Find next” until your specific cell is highlighted and then click “Replace.” Since we want all instance of “US”to be replaced, we will click “Replace All”
Excel’s “replace” and “substitute” functions are powerful tools for data manipulation and analysis. The replace function allows you to replace specific characters within a cell based on their position, while the substitute function allows you to replace specific characters within a cell based on the character itself. The “Find and Replace” feature in Excel is a quick and easy way to replace text in a worksheet. It can be used to replace multiple occurrences at once or to step through occurrences one by one. Mastering these functions and features in Excel can greatly improve your efficiency and effectiveness in working with data.