REPLACE Function in Excel

REPLACE replaces characters at a specific position with new text.

1 min read · Updated 17 Oct 2026 · By Md. Saiful Islam · বাংলায় পড়ুন

What is the REPLACE Function

The REPLACE function replaces characters at a specific position in a text string with new text. Unlike SUBSTITUTE which replaces by content, REPLACE replaces by position.

Formula: =REPLACE(old_text, start_num, num_chars, new_text)

Practical Example 1

A2 contains 2024-2025. Replace the first 4 characters with 2025.

Type: =REPLACE(A2, 1, 4, 2025)

Result: 2025-2025

Practical Example 2

Mask the first 8 digits of a phone number.

Type: =REPLACE(A2, 1, 8, **)

Result: ****5678

Practical Example 3

Insert text in the middle of a string.

Type: =REPLACE(A2, 3, 0, NEW)

Result: the text with NEW inserted at position 3

When to Use It

REPLACE is used for masking sensitive data, for inserting text at specific positions, for reformatting strings by fixed width, and for any formula where position-based replacement is needed.

Get one practical IE tip every week

Join IE and production professionals learning with in2eff.