FormulaCamp
Completed
← Google Sheets functions
Google Sheets function

SUBSTITUTE in Google Sheets

SUBSTITUTE with worked examples you can test in the live grid. The argument details are in the Excel guide.

In Google Sheets

The arguments and common errors are covered in the SUBSTITUTE Excel guide; check the function help in Google Sheets for its own argument list.

Worked examples in Google Sheets

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

Google Sheets is used here only as a descriptive product name. FormulaCamp is not affiliated with Google.