Go Back

Replace one character with another

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.

  1. 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.

  1. 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.

  1. 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.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

I need to find every cell with only one character in it and replace those cells with empty space
Solved by S. Q. in 28 mins
I need to find and replace text in an excel spreadsheet base on content variables. The find and replace is larger than the 256 character limit.
Solved by F. L. in 26 mins
I need a formula that will find a certain employee ID in one worksheet and replace it with a different ID number in another worksheet.
Solved by X. Y. in 16 mins

Leave a Comment

avatar