Replace part of the string with the new text string - Speicify start number and number of characters to replace
Description: The original text string or a reference to a cell containing the text you want to modify.
Example: "Hello World" or A1 (if the text is in cell A1).
Description: The position in the old_text where the replacement begins (1 for the first character).
Example: 6 (to start replacing from the 6th character).
Description: The number of characters in old_text that you want to replace with new_text.
Example: 5 (to replace 5 characters).
Description: The text string that will replace the specified characters in old_text.
Example: "Excel" (to replace the specified characters with "Excel").
Scenario | Formula | Result |
---|---|---|
Replace "cat" with "dog" in "blackcat" | =REPLACE("blackcat", 6, 3, "dog") | blackdog |
Replace "Hello" to "Hi" starting at position 1 | =REPLACE("Hello", 1, 2, "Hi") | Hillo |
Replace "2024" with "2024" in "Happy 2025" | =REPLACE("Happy 2024", 7, 4, "2025") | Happy 2025 |
Replace the middle digits of a phone number | =REPLACE("03214567890", 4, 4, "XXXX") | 0321XXXX90 |
Replace "Microsoft" with "Google" in "Microsoft Excel" | =REPLACE("Microsoft Excel", 1, 9, "Google") | Google Excel |
Hide part of an email address | =REPLACE("user@example.com", 2, 4, "****") | u****@example.com |