Excel SUBSTITUTE Function: Supported versions
- All Excel versions
Excel SUBSTITUTE Function: Syntax
SUBSTITUTE(text, old_text, new_text, [instance_num])
Arguments
| text | The string where you want to do the substitution. |
| old_text | The text you want to substitute. |
| new_text | The text you want to substitute the old_text with. |
| [instance_num] | Optional. The instance of old_text you want to substitute. If omitted, all instances of old_text will be replaced with new_text. |
Examples
Substitute all instances
When using the SUBSTITUTE function in Excel, if you omit the [instance_num] argument, Excel replaces all instances of the old_text with the new_text. For instance, in the formula =SUBSTITUTE(A2, "Power", "Force"), if the cell A2 contains the text "Power is powerful," both instances of the word "Power" will be replaced with "Force," resulting in the text "Force is forceful." This functionality makes the SUBSTITUTE function a powerful tool for text manipulation in Excel, allowing for comprehensive replacements within a given text string.
=SUBSTITUTE("By the Power of Grayskull… I Have the Power!","Power","Force")
Substitute specific instance
=SUBSTITUTE("By the Power of Grayskull… I Have the Power!","Power","Force",2)
Excel SUBSTITUTE Function: Summary and Tips
- Use the REPLACE function to replace any text in a specific location. For example, to replace a 5 character text starting from the 4th character: =REPLACE(old_text,4,5,new_text)
- The Excel SUBSTITUTE function is case-sensitive.
- To remove a specific character or text, replace it with an empty string (""). =SUBSTITUTE(text," ","")
- Use the SUBSTITUTE function in a nested form to substitute different characters with a single formula. For example, to remove space and dash characters, use: =SUBSTITUTE(SUBSTITUTE(text," ",""),"-","")


