Site icon ExcelNotes

How to Use REPLACE Function

The REPLACE function replaces part of the text string with new text based on the position and the number of characters you specified.

Formula:

=REPLACE(old_text, start_num, num_chars, new_text)

Explanations:

– Old text is required, the text string that you want to be replaced;

– Start_num is required, the start point you want to be replaced in the old text string;

– Num_chars is required, the number of characters you want to be replaced in the old text string;

– New_text is required, the text that will replace the old characters.

Cautions:

– Spaces are counted as characters.

– The new text needs a quotation sign.

– When the num_chars is longer than the number of characters after the starting point, all characters after the starting point will be replaced by the new text string.

– When Start_num is less than 1 (e.g., -5), the result returns the error of #VALUE!

Example: Change letters "replace" in the text string "how to use replace function" with "REPLACE".

=REPLACE(A1,12,7, "REPLACE")

The result returns "how to use REPLACE function".

Download: REPLACE Function

Exit mobile version