Excel REPLACE Function allows you to replace a specified number of characters within a text string with new text. It’s a useful tool for making changes to your data quickly and efficiently.
Syntax
REPLACE(old_text, start_num, num_chars, new_text)
Arguments
old_text | The original text in which you want to make replacements. |
start_num | The position in the old_text where the replacement should begin. |
num_chars | The number of characters to replace in old_text. |
new_text | The text that you want to replace the old_text with. |
How to use
Let’s dive into using the REPLACE function with some examples:
1 |
=REPLACE("Hello, World", 7, 5, "Universe") |
This formula replaces “World” in the text with “Universe,” starting from the 7th character, resulting in “Hello, Universe.”
1 |
=REPLACE("OpenAI is amazing!", 8, 2, "") |
In this example, we start at the 8th character and replace the following 2 characters with an empty string, effectively removing them: “OpenAI amazing!”
1 |
=REPLACE("Replace every vowel with 'X'", 1, 1, "X") |
This formula replaces the first vowel in the text with “X,” making it “Rexplace every vowel with ‘X’.”
Excel’s REPLACE function is a handy tool for manipulating text within your spreadsheets. It’s easy to use and can save you a lot of time when you need to make specific changes to your data.