Each time I write a tutorial I use the Google Keyword tool to find search phrases that are relevant. I use these phrases as tags on my post to help you find it easier in Google and other search engines.
The Google keyword tool spits out a list of phrases which I then export into Excel like the example below.
Then from the list above I need to create a list of comma separated phrases.
The problem is I first need to remove the square brackets and then I need to join all of the phrases together separated by a comma and a space.
There are a few ways I can do this.
- Use Text to Columns to remove the square brackets then use a CONCATENATE or & (ampersand) formula to join the text together, or
- Use Find & Replace and then CONCATENATE to join the text together, or another way is to
- Use the SUBSTITUTE function to remove the square brackets and then join the text together using a cheeky Find and Replace trick in Microsoft Word.
Since most people know how to use Find & Replace (if you don’t, sign up for our online training here), and I’ve already written a tutorial on CONCATENATE, I’m going to cover the SUBSTITUTE function today.
How to Use SUBSTITUTE
First let’s tackle the text in cell A4 which is [excel substitute]
In cell C4 I will enter the following SUBSTITUTE Formula:
This formula is actually using the SUBSTITUTE function to replace multiple items.
The SUBSTITUTE formula in orange is replacing the left square bracket with nothing and the SUBSTITUTE formula in blue is replacing the right square bracket with a comma and a space.
How the SUBSTITUTE Function Works
SUBSTITUTE Function Syntax
=SUBSTITUTE(text, old_text, new_text, [instance_num])
Text = the cell the text is in
Old_text = the text you want to replace. You need to put this in “double quotes”. Note this is case sensitive.
New_text = the new text you want. Again, in double quotes. If you want to replace it with nothing then simply enter two double quotes “”.
Instance_num = this specifies which occurrence of old_text you want to replace. If omitted, every instance of old_text is replaced.
Ok, now I have my formula in cell C4 I can copy it down the column then I’m ready to join the text together.
How to Join the Text Together
This is almost blasphemy for a devout Excel fan, but this is the quickest way so here goes!
- Copy your new text from column C.
- Open Microsoft Word…take a deep breath as you go to the other side
- In Word Paste special > Unformatted Text
- CTRL+H (for Find & Replace)
- Enter a ^p in the ‘Find what’ box. ^p is the end of the paragraph in Word.
- Enter nothing in the ‘Replace with’ box.
Tada… your text now looks like this:
excel substitute, substitute function in excel, substitute function excel, substitute formula excel, excel substitute function, excel substitute formula, excel substitute multiple, excel formula substitute, substitute excel formula,
You might be saying to yourself that I could have done that all in Word using Find & Replace and you’d be right, but that would be admitting that Word is better at some things than Excel and I can’t bring myself to do that :) Plus you wouldn’t have learnt how to use the SUBSTITUTE function.