Excel REPLACE function🔤 Replace by position
The REPLACE function: Replace by position. Hide part of a code before sharing. This page shows the syntax, a worked example with its result and how the formula reads.
What does REPLACE do?
Replace by position. Hide part of a code before sharing
REPLACE syntax
=REPLACE(old_text, start_num, num_chars, new_text)
Arguments in square brackets [ ] are optional · argument names follow Microsoft's documentation
REPLACE example with the result
=********
👑 Ready-to-use example formula for VIP supporters only · Become VIP
Formula in cell B2 Yellow cells = result
| A | B | |
|---|---|---|
| 1 | Code | Masked |
| 2 | ABC-123 | XXX-123 |
How it reads: From character 1, replaces 3 characters with XXX
Frequently asked questions about REPLACE
What does REPLACE do?
Replace by position. Hide part of a code before sharing
What does the REPLACE example return?
The example formula in cell B2 gives XXX-123.
Which Excel versions have REPLACE?
It has been in Excel for many versions and works in the versions in common use today, including Excel for Microsoft 365.
🕸️ More text formulas and related ones
Source: support.microsoft.com
Checked 17 November 2026 · by Black Sheep Barn · example results are calculated by the app's example engine, for learning