REPLACE Function in Excel: Replace Characters by Position

⏱ 1 min readUpdated 28 September 2026

TextLevel: IntermediateAvailable in: Excel 2007+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Related functions

REPLACE swaps characters at a given position — useful for masking.

Syntax

=REPLACE(old_text, start_num, num_chars, new_text)
Argument What it means
start_num First character to replace.
num_chars How many to replace.

Examples

Example 1

=REPLACE(A2, 1, 6, "XXXXXX")

Mask the first six digits of a 10-digit mobile number.

SUBSTITUTE · MID

📚 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