Spreadsheet Practice

How to find and replace text with a formula in Excel

Formula (Excel and Google Sheets)

=SUBSTITUTE(A2,$E$1,$G$1)

Use =SUBSTITUTE(A2,"old","new"). It replaces every occurrence of the old text, and the original cell stays unchanged.

Result on the example
one result per row in B2, filled down to B6
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in B2, filled down to B6. Change any input and the result updates, or edit the formula to experiment.

How it works

SUBSTITUTE swaps every copy of the text in E1 for the text in G1. Unlike Ctrl+H, it leaves the original column alone and updates when the inputs change. It is case-sensitive, which is why "gray" in the last row isn't replaced.

=SUBSTITUTE(A2,$E$1,$G$1)

Result"Desk lamp - Graphite"

  1. A2"Desk lamp - Gray"

    The value in A2.

  2. $E$1"Gray"

    The value in E1.

  3. $G$1"Graphite"

    The value in G1.

  4. SUBSTITUTE(A2,$E$1,$G$1)"Desk lamp - Graphite"

    SUBSTITUTE: Replaces matching text.

    • textA2"Desk lamp - Gray"
    • old_text$E$1"Gray"
    • new_text$G$1"Graphite"

In Google Sheets

The same formula works in Google Sheets: =SUBSTITUTE(A2,$E$1,$G$1). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=IFERROR(REPLACE(A2,SEARCH($E$1,A2),LEN($E$1),$G$1),A2)Desk lamp - Graphite, Office chair - Graphite mesh, Monitor arm - Silver…Different resultCase-insensitive: SEARCH finds the text whatever its case and REPLACE swaps it. It replaces only the first match. The last row also becomes "Cable tray - Graphite".

Common mistakes

  • SUBSTITUTE matches inside longer words too: replacing "Gray" also changes "Grayson".
  • REPLACE is a different function: it swaps characters at a position, not a piece of text. Use SUBSTITUTE when you know the text.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Find and replace text with a formula

In B2, replace the text in E1 with the text in G1, and fill down to B6.

Questions

How do I replace several different words?

Nest SUBSTITUTE: =SUBSTITUTE(SUBSTITUTE(A2,"Gray","Graphite"),"Oak","Walnut").

How do I replace only the first occurrence?

Add the instance number: =SUBSTITUTE(A2,$E$1,$G$1,1).

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.