New: ready-to-use spreadsheet templatesExplore the collection  →
Home/Formulas/SUBSTITUTE
TEXT · GOOGLE SHEETS

SUBSTITUTE
replace matching text inside a string.

Use SUBSTITUTE to replace separators inside text. This guide shows the exact structure, a working example and the mistakes most likely to break it.

JosephineVerified by JosephineReviewed July 25, 2026
THE FORMULA=SUBSTITUTE(text_to_search, search_for, replace_with, [occurrence_number])
A

text_to_searchsource text

B

search_fortext to find

C

replace_withreplacement

D

occurrence_numberoptional single match

TRY IT YOURSELF

Change the sheet.
Watch the answer update.

Edit any highlighted cell below. The example recalculates immediately.

LIVE PLAYGROUND=SUBSTITUTE(A2,"-","/")
fx=SUBSTITUTE(A2,"-","/")
A · TEXT
2
3
4
5
RESULTINV/2026/104Updates live

Try changing a value above. This example runs entirely in your browser.

IN PLAIN ENGLISH

How the formula
thinks.

  1. 01

    text_to_searchsource text

  2. 02

    search_fortext to find

  3. 03

    replace_withreplacement

  4. 04

    occurrence_numberoptional single match

COMMON FIXES

When SUBSTITUTE
doesn’t behave.

WRONG RESULT

Wrong result

Check that every range starts and ends on the same rows, and that numbers are stored as numbers.

FORMULA PARSE ERROR

Formula parse error

Check commas, quotation marks and closing parentheses. Your locale may use semicolons instead of commas.

UNEXPECTED BLANKS

Unexpected blanks

Test the source cells for hidden spaces, empty strings and inconsistent data types.

fxNeed help with SUBSTITUTE?Fix my formula →