Syntax
| Parameter | Description |
|---|---|
| text | Parameter of the SUBSTITUTE function. |
| old_text | Parameter of the SUBSTITUTE function. |
| new_text | Parameter of the SUBSTITUTE function. |
| [instance] | (Optional.) Parameter of the SUBSTITUTE function. |
Examples
Remove dashes from phone numbers
=SUBSTITUTE(A2, "-", "")
Replace old with new text
=SUBSTITUTE(A2, "Corp.", "Corporation")
Replace only the 2nd occurrence
=SUBSTITUTE(A2, "-", "|", 2)
Common Errors
The instance_num (4th argument) is less than 1. It must be a positive integer or omitted to replace all.
Very rare. SUBSTITUTE returns the original text unchanged if the old_text is not found — it does not error.
Tips
SUBSTITUTE is case-sensitive. SUBSTITUTE("Hello","hello","Hi") returns "Hello" unchanged. Use a nested UPPER/LOWER if needed.
To remove a character, substitute with empty string: =SUBSTITUTE(A1, " ", "") removes all spaces.
Nest SUBSTITUTE calls: =SUBSTITUTE(SUBSTITUTE(A1,"-","")," ","") removes both hyphens and spaces.
Try SUBSTITUTE in Viztab
Import your data and use SUBSTITUTE with 370+ other formulas. No signup required.
Open Viztab