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, [instance num])

What it means:

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

I can recall the countless times when I was given a list of names from the HR department and the last name was not separated from the first name by a comma.

It drove me nuts!!!

I had to manually edit the names one by one, so that it would look like <last name>, <first name>.

Turns out, the SUBSTITUTE formula in Excel would have done this task very easily!

In our example below, we have a list of names.  We want to replace the space with a comma followed by the space.  The SUBSTITUTE 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:



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


Substitute - Add Comma 01


STEP 2: The Substitute arguments:


Which cell do we want to make changes to?

Reference the cell that contains the text or value:


Substitute - Add Comma 02


Which text / characters do we want to replace?

We want to change the space so type it in:


Substitute - Add Comma 03


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

We want to replace it into the comma followed by a space, so type it in:

=SUBSTITUTE(C9, ” “, “, “)

Substitute - Add Comma 04

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 names are now changed to having your needed commas:

Substitute - Add Comma 05

Substitute - Add Comma





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


Pin on Pinterest

Share on Facebook

Tweet about this on Twitter

Share on LinkedIn

Share on Google+

Related Posts

Getting the remainder with Excel’s MOD Formu... What does it do?Gives you the remainder after dividing one number with anotherFormula breakdown:=MOD(number1, number2)What it means:=MOD(a number, divided by this number)In Excel it is very easy to divide two numbers.But how about if you need to ge...
CountIfs Formula in Excel What does it do?Counts the number of cells that matches your specified conditionsFormula breakdown:=COUNTIFS(range1, criteria1, , , ...)What it means:=COUNTIFS(range of cells to check1, condition to check against1, , , ...)Do you have a scenario where ...
Cleaning Data with Excel’s TRIM Formula What does it do?Removes unneeded spaces in your text, except single spaces in between wordsFormula breakdown:=TRIM(text)What it means:=TRIM(text that you want extra spaces to be removed)In the quest for cleaner data, one of the common scenarios is remo...
Round Off Numbers with Excel’s ROUND Formula What does it do?Rounds a number to the nearest decimal based on your specified number of digitsFormula breakdown:=ROUND(number, num_digits)What it means:=ROUND(the number, number of decimal places to round off)Ever had the need to round off numbers? ...