How to Use SUBSTITUTE in Google Sheets

By Tomosuke Hasegawa · Updated Oct 29, 2026 · Beginner · 5 min read · includes 2 free exercises

In short: SUBSTITUTE replaces existing text with new text inside a string. The formula is =SUBSTITUTE(text_to_search, search_for, replace_with, [occurrence_number]). Without the last argument, every match is replaced.

What SUBSTITUTE does

SUBSTITUTE swaps one piece of text for another inside a cell. Use it to remove hyphens from phone numbers, fix a repeated typo or change a separator, without editing each cell by hand.

SUBSTITUTE syntax

=SUBSTITUTE(text_to_search, search_for, replace_with, [occurrence_number])

A step-by-step example

Cell A2 holds a phone number with hyphens.

A
1Phone
2090-1234-5678

To remove all the hyphens:

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

This returns 09012345678. Here is why:

  1. Sheets finds every - in the text.
  2. It replaces each one with an empty string, which removes it.

Replace only one occurrence

Add the fourth argument to choose which match changes. To replace just the first hyphen with a slash:

=SUBSTITUTE(A2, "-", "/", 1)

This returns 090/1234-5678. Google's help page notes that you can replace one instance or all of them, but not a chosen subset of several in a single call.

Common SUBSTITUTE mistakes

Try it yourself

Use the phone number above (A2 holds 090-1234-5678). Type your formula into the box, starting with =, then press Check.

Exercise 1: Remove the hyphens

Write a formula that removes every hyphen from the text in A2.

Hint: replace "-" with empty quotes.

Exercise 2: Only the first one

Write a formula that replaces only the first hyphen in A2 with a slash (/).

Hint: the fourth argument is the occurrence number.

What to learn next

Syntax and rules in this guide were checked against Google's SUBSTITUTE help page. See all guides.