FormulaCamp
Completed
← All functions
Text

SUBSTITUTE

Replaces text by its content.

Syntax

SUBSTITUTE(text, old_text, new_text, [instance_num])

Example: =SUBSTITUTE(A2,"-","")

Available in: All versions

SUBSTITUTE replaces specific text inside a string: =SUBSTITUTE(text, old_text, new_text, [instance_num]). It is the tool for removing dashes from phone numbers, swapping characters or replacing only the nth occurrence.

When to use it

Arguments explained

Worked examples

Remove dashes

A
1Phone
2555-123-4567

Formula: C1: =SUBSTITUTE(A2,"-","")

Result: 5551234567

An empty string as new_text deletes the old text.

Replace one occurrence only

A
1List
2a,b,c,d

Formula: C1: =SUBSTITUTE(A2,",",";",2)

Result: a,b;c,d

The fourth argument 2 limits the change to the second comma.

Count a character

A
1Tags
2red,green,blue

Formula: C1: =LEN(A2)-LEN(SUBSTITUTE(A2,",",""))

Result: 2

Removing every comma shortens the text by the number of commas.

Try it

A tiny spreadsheet with example data. Edit the formula or any number and see the result.

Formula in D2: =SUBSTITUTE(A5,"-","/")

Example spreadsheet for SUBSTITUTE
ABCD
1TextOtherResult
2Alice Johnsonalice johnsonSKU/2026/0415
3[email protected][email protected]
4 extra spaces
5SKU-2026-0415
6iced coffee, tea, sugar
7Order 417 shipped
Result in D2: SKU/2026/0415
Practice this in a lesson: Find and Replace

Common errors and how to fix them

Related functions

Frequently asked questions

What is the difference between SUBSTITUTE and REPLACE?
SUBSTITUTE finds text and swaps it. REPLACE swaps characters at a given position and length.
Can SUBSTITUTE replace several different characters?
Nest SUBSTITUTE calls, one per character.
Is SUBSTITUTE case sensitive?
Yes.
Does SUBSTITUTE support wildcards?
No. Wildcards are not applied in SUBSTITUTE.

More in Text