How to Use the SUBSTITUTE Function in Microsoft Excel

When working with Microsoft Excel, the SUBSTITUTE function is a powerful tool that can help users replace specific text or characters with new ones across a range of cells or within a single cell. This can be incredibly helpful when working with large amounts of data or when trying to standardize text across multiple cells. In this article, we will take a closer look at how to use the SUBSTITUTE function in Microsoft Excel.
Syntax of the SUBSTITUTE Function:
The syntax for the SUBSTITUTE function is as follows:
=SUBSTITUTE(text, old_text, new_text, [instance_num])
Text: The text or cell containing the text which needs to be replaced.
Old Text: The specific text or character that you want to replace.
New Text: The replacement for the old text.
Instance_num: The occurrence of old_text that you want to replace. If not provided, all instances of old_text will be replaced.
Using the SUBSTITUTE Function in Excel:
1. Open your Excel file and click on the cell where you want to use the SUBSTITUTE function.
2. In this cell, enter the following formula:
=SUBSTITUTE(A2, “Old Text”, “New Text”)
Here, A2 is the cell that contains the original text, “Old Text” is the specific text that you want to replace, and the “New Text” is the text that you want to replace it with.
3. Press Enter, and the result will appear in the cell.
If you want to replace all occurrences of the old text, you can use the SUBSTITUTE function without the instance number argument. In this case, the formula would look like this:
=SUBSTITUTE(A2, “Old Text”, “New Text”)
This will replace every instance of “Old Text” found in cell A2 with “New Text.”
If you only want to replace a specific instance of the text, you can include the instance number argument in the formula. For example, if you only want to replace the second occurrence of “Old Text,” the formula would look like this:
=SUBSTITUTE(A2, “Old Text”, “New Text”, 2)
The “2” specified at the end of the formula tells Excel to replace only the second instance of “Old Text” found in cell A2.
You can also use the SUBSTITUTE function with a range of cells. If you want to replace text across a range of cells, simply select the range and enter the formula. The SUBSTITUTE function will automatically replace the old text with the new text in all the cells within the range.
Conclusion:
The SUBSTITUTE function in Microsoft Excel is a powerful tool that can save you a lot of time when working with large amounts of data. Whether you need to replace text across a range of cells or within a single cell, the SUBSTITUTE function can help you do it easily and quickly. With the information provided in this article, you should now be able to use the SUBSTITUTE function effectively to accomplish your Excel tasks.