Replaces part of a text string with a different text string based on the number of characters you specify.
Sintaxis
REPLACE(old_text, start_num, num_chars, new_text)Argumentos
old_textobligatorio
The text string that contains the characters you want to replace.
start_numobligatorio
The position of the first character in old_text that you want to replace.
num_charsobligatorio
The number of characters in old_text that you want to replace.
new_textobligatorio
The text that will replace the characters in old_text.
The REPLACE function is used to swap a specific portion of a text string with new text. It is particularly useful for cleaning data or formatting strings by targeting character positions rather than specific content.
=REPLACE("2023-01", 1, 4, "2024")→2024-01Replaces the first 4 characters ('2023') with '2024'.
Identify the target text
Select the cell containing the string you wish to modify.
Define the replacement range
Determine the starting position and the number of characters to remove.
Enter the new text
Provide the replacement string and complete the function.
REPLACE swaps text based on position, while SUBSTITUTE swaps text based on matching content.