Text
All versions
◉ 13 views
=REPLACE()
REPLACE replaces part of a text string, based on the number of characters you specify, with a different text string.
Applies To:
Excel for Microsoft 365Excel for Microsoft 365 for MacExcel 2024Excel 2024 for MacExcel 2021Excel 2021 for MacExcel 2019Excel 2016
=REPLACE(old_text, start_num, num_chars, new_text)
Hover argument names in the table for details.
Output typeText
Popularity50 / 100
VolatileNo
Dynamic ArrayNo
📥 Download sample .xlsx — Coming soon
▦ Try in Playground
Dedicated file for this function — safe & lightweight · sample data + live formulas
⬇ Download Sample Workbook
A dedicated .xlsx for =REPLACE() with Persian sample data & live formulas — open in Excel and practice.
- Sheet “Sample” — data table + formula in place
- Sheet “Guide” — syntax, arguments & tips from this page
- Instant & secure (token + rate limit)
🧠 🧠 Quiz this function
%d questions — syntax, example & errors — test yourself!
◧ Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
old_text |
Text | Required | Text in which you want to replace some characters. |
start_num |
Number | Required | The position of the character in old_text that you want to replace with new_text. |
num_chars |
Number | Required | The number of characters in old_text that you want REPLACE to replace with new_text. |
new_text |
Text | Required | The text that will replace characters in old_text. |
▣ Examples
▦ Data
| Cell | Value |
|---|---|
A2 |
abcdefghijk |
A3 |
2009 |
A4 |
123456 |
A5 |
abcdefghijk |
A6 |
2009 |
A7 |
123456 |
Replaces five characters in abcdefghijk with a single * character, starting with the sixth character (f).
=REPLACE(A2,6,5,"*")
Result:
abcde*k
Replaces the last two digits (09) of 2009 with 10.
=REPLACE(A3,3,2,"10")
Result:
2010
Replaces the first three characters of 123456 with a single @ character.
=REPLACE(A4,1,3,"@")
Result:
@456
✦ Tips
- The REPLACEB function is deprecated. In workbooks set to Compatibility Version 2, REPLACE has improved behavior with Surrogate Pairs, counting them as one character instead of two. Variation Selectors (commonly used with emojis) will still be counted as separate characters. For more information, see The Unicode standard.
💬 Comments & Q&A 0 approved
🔒 Your comment will be published after review.Share your thoughts — visible after admin approval
No comments yet — be the first!