Wauvel

Excel like a finance pro.

← The library

Text function

REPLACE

Replaces characters at a position with other text.

CommonDifficulty 1100 · ProficientUsage rank #161 of 520
Practice · 3 questions →

When to use it

Replaces a run of characters by position and length with new text. For fixed-layout strings; SUBSTITUTE is for matching content.

The shape of it

Syntax
=REPLACE(old_text, start_num, num_chars, new_text)

Worked examples

  • Replace by position

    =REPLACE("Excel 2019",7,4,"365") Excel 365

    Four characters from position 7 become 365.

  • Reformat

    =REPLACE("5551234567",1,3,"(555) ") (555) 1234567

    Reformat a phone number.

  • Insert a prefix

    =REPLACE(A2,1,0,"ID-") ID-4471

    A length of 0 inserts without removing.

Worth knowing

  • Insert text with length 0.
  • Mask data: REPLACE(card,1,12,REPT("*",12)).
  • REPLACEB works in bytes.

Where it goes wrong

  • #VALUE! for a start below 1.
  • Returns text even if the input was a number.

Related

Learn the moves here — or let Wauvel run them on your numbers.

Meet your AI CFO →

One CFO-grade Excel tip a week

A short, practical email for finance operators — functions, shortcuts, and the moves that save an afternoon. Free, unsubscribe anytime.