Skip to content

Excel function guide · Text

SUBSTITUTE function in Excel

SUBSTITUTE replaces specific text inside a value with other text, for example every hyphen in a phone number with nothing. By default it replaces every occurrence; an optional fourth argument replaces only one.

Syntax

=SUBSTITUTE(text, old_text, new_text, [instance_num])
ArgumentRequired?What it means
textRequiredThe text or cell to change.
old_textRequiredThe text to find. Case-sensitive.
new_textRequiredWhat to put in its place. Use "" to delete it.
instance_numOptionalWhich occurrence to replace (1 = the first). Left out, every occurrence is replaced.

SUBSTITUTE examples

Every example uses this small table. The results are what Excel shows in the cell.

AB
1PhoneProduct code
2020-7946-0018lamp_desk_small
30161-496-0753chair_office_mesh
40113-496-0021arm_monitor_dual
  1. 1. Remove a character

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

    Result: 02079460018

    Every hyphen is replaced with nothing. The result is text, so the leading 0 survives.

  2. 2. Swap one character for another

    =SUBSTITUTE(B2, "_", " ")

    Result: lamp desk small

    Underscores become spaces.

  3. 3. Only one occurrence

    =SUBSTITUTE(A3, "-", " ", 1)

    Result: 0161 496-0753

    instance_num 1 replaces only the first hyphen.

Try it now

Practise SUBSTITUTE in a live sheet.

Type each formula yourself. Answers are checked by the same engine as the full course. No account needed.

Try it · SUBSTITUTE
0 XP
C2
A
B
C
D
E
F
1
Phone
Product code
Digits only
Readable name
2
020-7946-0018
lamp_desk_small
3
0161-496-0753
chair_office_mesh
4
0113-496-0021
arm_monitor_dual
5
6
7
8
Double-click or start typing to edit

Step 1 of 3

In C2, remove every hyphen from the phone number in A2.

Common SUBSTITUTE mistakes

Practise this in Excel Quest

FIND, SEARCH & SUBSTITUTE Members

Course 7 · Text & Data Cleaning · 14 min

Split “Last, First” names, pull email domains, strip phone formatting and flag urgent notes.

This lesson is included in Formula Quest memberships. A free account starts you on the free lessons of the Excel Quest curriculum.

Related functions

All Excel function guides