The excel SUBSTITUTE function replaces the old text to the new text by matching the same word. The SUBSTITUTE function works in case sensitive and has no support for a wildcard character.
SUBSTITUTE(text, old_text, new_text, [instance_num])
text, required, the text for which you want to change.
old_text, required, the text to replace.
new_text, required, the text to replace with.
instance_num, optional, which old_text occurrence you want to replace with new_text. If omitted, Excel replaces every occurrence of old_text to new_text.
The following is an example of the SUBSTITUTE function usage and the results.
SUBSTITUTE Function #1
The instance_num argument is optional; if you omit the argument, then excel replaces all “g” letters to “d” letter.
The result is a doodle.
SUBSTITUTE Function #2
If you put number 1 in instance_num argument, then excel only replace the first “g” letter and ignores all the “g” letters afterward.
The result is doogle.
SUBSTITUTE Function #3
There are two “the” words, first at the beginning of the sentence with the large “T” letter. Second in the middle of the sentence with all lowercase letters.
The SUBSTITUTE function works in case sensitive, replace only the word with the same letter. Excel replaces the second “the” word.
The result is The Quick Brown Fox Jumps Over a Lazy Dog.
SUBSTITUTE Function #4
There is no “THE” (all uppercase) word, the result has nothing to change, just like the text in cell A5.
SUBSTITUTE Function #5
The SUBSTITUTE function has no support for wildcard character. If there are “?” (question mark) or “*” (asterisk) character, Excel considers as “ordinary” character instead of a wildcard character.
There is no “g???” word in cell A6, the results remain unchanged, like the text in cell A6.
Besides the SUBSTITUTE function, Excel has another function to change the text, namely the REPLACE function. What is the difference between the SUBSTITUTE function and the REPLACE function?
The SUBSTITUTE function changes the text based on the specified word, while the REPLACE function changes the text based on the specified position.
If you know the word to be changed, use the SUBSTITUTE function. If you know the position of the text to be changed, use the REPLACE function.