SUBSTITUTE function in Excel
Substitutes new text for old text in a text string
=SUBSTITUTE(text, old_text, new_text, [instance_num])SUBSTITUTE syntax and parameters
Four arguments, three required.
- textstringRequired
The text or the reference to a cell containing text for which you want to substitute characters.
- old_textstringRequired
The text you want to replace.
- new_textstringRequired
The text you want to replace old_text with.
- instance_numnumberOptional
Specifies which occurrence of old_text you want to replace with new_text. If you specify instance_num, only that instance of old_text is replaced. Otherwise, every occurrence of old_text in text is changed to new_text.
SUBSTITUTE examples
Formulas you'll actually reuse.
Strip the hyphens out of a phone number or SKU:
=SUBSTITUTE(A2, "-", "")Result
"NYC10422"Replace only the first space — the fourth argument picks which occurrence:
=SUBSTITUTE(A2, " ", "-", 1)Result
"Maria-Lopez Garcia"
SUBSTITUTE in Google Sheets
Same name — your formula ports as-is.
Try SUBSTITUTE in the playground
Edit the example — nothing to install.
Preloaded with the SUBSTITUTE formula from Example 1 — change anything and watch it respond.
Related functions
More ways Excel gets this done.
- ARRAYTOTEXTReturns an array of text values from any specified rangeTextNo Google Sheets equivalent
- CHARReturns the character specified by the code numberTextGoogle Sheets
- CLEANRemoves all nonprintable characters from textTextGoogle Sheets
- CODEReturns a numeric code for the first character in a text stringTextGoogle Sheets
- CONCATCombines the text from multiple ranges and/or strings, but it doesn't provide the delimiter or IgnoreEmpty arguments.TextGoogle Sheets
- CONCATENATEJoins several text items into one text itemTextGoogle Sheets