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(A2,B2,C2)
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(A3,B3,C3,D3)
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(A4,B4,C4)
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(A5,B5,C5)
There is no “THE” (all uppercase) word, the result has nothing to change, just like the text in cell A5.
=SUBSTITUTE(A6,B6,C6,D6)
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.
For a more detailed explanation of the Excel REPLACE function, please read the following article:
Calculate Number of Days Between Two Dates Excel has a function that calculates the number of days between two dates,…
What is Flash Fill Excel Flash Fill automatically fills your data when Excel detects a pattern in your initial data…
What is Paste Special Paste special is a paste but you can choose the result type. As we all know,…
What is the Excel TEXTJOIN Function? The excel TEXTJOIN function is the best function to concatenate strings in Excel, has…
What is the Excel CONCAT Function? The excel CONCAT function combines all data; it could be a text, a number…
What is the Excel CONCATENATE Function? The excel CONCATENATE function combines text or numbers into a text. CONCATENATE Syntax CONCATENATE(text1,…