ExcelUnpackUnpack Excel, one formula at a time.
Log inSign up

Lesson 54 · Text search

REPLACE in Excel

REPLACE swaps characters by position. You say where to start, how many characters to remove and what to put there. It is great for codes with a fixed layout.

Practice this lesson →Pro lesson. The first 4 lessons are free.

What you will learn

  • Replace characters at a position with REPLACE

How it works

=REPLACE(A2,4,4,"2026") starts at character 4, removes 4 characters and puts "2026" there.

Formulas at a glance

=REPLACE(text, start, how many, new)The pattern to follow

Example

Write the formula to change 2025 to 2026 in the first code.

ABCD
1CodeNew yearCardHidden
2AB-20254111-2222-3333-4444
3CD-20255500-1111-2222-3333
4EF-20256011-0000-9999-8888
5GH-20253714-4963-5398-4312

Click B2 and type =REPLACE(A2,4,4,"2026"), then press Enter.

The answer is AB-2026.

When to use it

  • Changing the year inside a code
  • Hiding part of an ID
  • Fixing characters always in the same place

Common mistakes

  • Counting from 0The first character is 1.
  • Using REPLACE to swap a wordUse SUBSTITUTE when you know the text, not the position.
  • Wrong "how many"Count exactly how many characters to remove.

Practice it on a real sheet

Reading is a start. Doing it is how it sticks. This lesson walks you through every click on a live spreadsheet and checks each answer.

REPLACE in Excel: how it works, with examples · ExcelUnpack