Figure 1. Replace One Character With Another in Excel.
If our aim is to replace/switch one character with a different one in Excel, we have to utilize the SUBSTITUTE function.
Generic Formula
=SUBSTITUTE(ref,old,new)
We can replace a specific text in a given string by using the SUBSTITUTE formula.
How to use the Excel SUBSTITUTE Function.
We are going to demonstrate how to use the SUBSTITUTE Function to replace all instances of an old text with a specified new text.
- Enter the text string or number values containing the old text/character we wish to substitute, into labeled columns of our worksheet.
Figure 2. Replace One Character With Another in Excel.
Be sure to leave blank cells for Excel to return the NEW text string or number values.
- The SUBSTITUTE Formula that we will enter into cell B2 above is as follows;
=REPLACE(A2,18,4,2019)
Figure 3. Replace One Character With Another in Excel.
Our goal here is to substitute the “2012” portion of the OLD text string, with “2019”, which is returned in cell B2.
- Modify the SUBSTITUTE formula in cell B2 above, and enter into cell B3;
=REPLACE(A3,4,1,"-")
Figure 4. Replace One Character With Another in Excel.
Note
We have to modify the SUBSTITUTE formula based on the exact position of the characters we wish to replace within the text string.
In our worksheet example the numbers 18,4 correspond with the exact position of “2012” in the old text string while the numbers 4,1, correspond with the exact position of the “-” in our old number value.
Figure 5. Final Result.
Instant Connection to an Expert through our Excelchat Service:
Our live Excelchat Service is here for you. We have Excel Experts available 24/7 to answer any Excel questions you may have. Guaranteed connection within 30 seconds and a customized solution for you within 20 minutes.
Leave a Comment