SUBSTITUTE Function in Excel: Replace Specific Text

⏱ 1 min readUpdated 28 September 2026

TextLevel: BeginnerAvailable in: Excel 2007+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Example 2
  5. Power combo
  6. Related functions

SUBSTITUTE replaces existing text with new text — all occurrences or just the n-th one.

Syntax

=SUBSTITUTE(text, old_text, new_text, [instance_num])
Argument What it means
instance_num Which occurrence to replace (all if omitted).

Examples

Example 1

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

Remove all dashes from a phone number.

Example 2

=LEN(A2)-LEN(SUBSTITUTE(A2, ",", ""))+1

Count items in a comma list.

Power combo

=TRIM(RIGHT(SUBSTITUTE(A2, " ", REPT(" ", 100)), 100))

Last word of a text in every Excel version.

REPLACE · TRIM · LEN

📚 Part of the free Excel course: Beginner → Expert · Try it in the Formula Lab or ask the AI Helper.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong