What does it do?

Substitutes new_text for old_text in a text string.

Formula breakdown:

=SUBSTITUTE(text, old_text, new_text, [instance num])

What it means:

=SUBSTITUTE(This cell, By this text character, To this text character, [In the 1st, 2nd…instance it occurs])


When you needed to replace a specific text in each word, and there is a pattern, Excel has just the formula for you.

The SUBSTITUTE formula in Excel can help you replace one specific text with another easily.

In our example below, we have a list of part numbers.

We want to replace the second dash  –  with the number sign  # . This formula is able to do this for us.

I explain how you can do this and please go to the bottom of the page to see the animated gif tutorial:

DOWNLOAD EXCEL WORKBOOK

 

STEP 1: We need to enter the Substitute function next to the cell that we want to clean the data from:

=SUBSTITUTE

 

Substitute 01

 

STEP 2: The Substitute arguments:

text

Which text do we want to change?

Reference the cell that contains the text or value:

=SUBSTITUTE(C9,

 

Substitute 02

 

 old_text

Which text / characters do we want to replace?

We want to change the dash    so type it in with double quotations:

=SUBSTITUTE(C9, “-“,

 

Substitute 03

 

new_text

Which text / characters do we want to replace it with?

We want to change it into the number sign  #  so type it in with double quotations:

=SUBSTITUTE(C9, “-“, “#”,

 

Substitute 04

 

[instance num]

Which specific instance are we targeting the substitution on?

This parameter is optional. In our scenario, we want the second dash    only to be substituted. So place in the number 2:

=SUBSTITUTE(C9, “-“, “#”, 2)

 

Substitute 05

 

STEP 3: Do the same for the rest of the cells by dragging the SUBSTITUTE formula all the way down using the left mouse button.

Note that all of the parts are now changed to your new part values:

Substitute 06

Substitute

 

HELPFUL RESOURCE:

How to Combine VLOOKUP and IFERROR to Replace the #N/A Error in Excel

 

If you like this Excel tip, please share itEmail this to someone

email

Pin on Pinterest

Pinterest

Share on Facebook

Facebook

Tweet about this on Twitter

Twitter

Share on LinkedIn

Linkedin

Share on Google+

Google+

Related Posts

Cleaning Data with Excel’s PROPER Formula   What does it do? Capitalizes the first letter in a text string and any other letters in the text that follow a space. Converts all other letters to lowercase letters. Formula breakdown: =PROPER(text) What it means: =PROPER(this text cell) There are...
Count Text Occurrences with Excel’s SUBSTITU... What does it do? It replaces specific text in a text string i.e. Substitutes new text for old text in a text string. Formula breakdown: =SUBSTITUTE(text, old_text, new_text, ) What it means: =SUBSTITUTE(This cell, From this TEXT character, To this TEXT character, )...
Workday Formula in Excel What does it do? Adds/Subtracts a specified number of workdays to a Date, which will give you a Future/Past Date Formula breakdown: =WORKDAY(start_date, days, ) What it means: =WORKDAY(specified date, number of work days to add/subtract, ) If you want to cal...
Concatenate With A Line Break   What does it do? Joins two or more text strings into one string. The item can be a text value, number, or cell reference. Formula breakdown: =CONCATENATE(text1, , , ...) What it means: =CONCATENATE(the first text, the second text, and so on...) ...