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.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Code | New year | Card | Hidden |
| 2 | AB-2025 | 4111-2222-3333-4444 | ||
| 3 | CD-2025 | 5500-1111-2222-3333 | ||
| 4 | EF-2025 | 6011-0000-9999-8888 | ||
| 5 | GH-2025 | 3714-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.