TX Sheet Control

REPLACE Function

Function

Replace part of a text, given by its position. old_text is the text, start_num the position of the first character to replace, from 1, num_chars the number of characters to replace and new_text the text to insert. A num_chars of 0 inserts new_text without removing anything, and a start_num after the end appends it. A start_num less than 1 or a negative num_chars returns #VALUE!.

Syntax

REPLACE(old_text, start_num, num_chars, new_text)

Category: Text. Minimum arguments: 4. Maximum arguments: 4.

Available for supported offline calculation.

Examples

=REPLACE("abcd",2,2,"XY")

The formula returns aXYd.

Cell and range examples require appropriate input values in the referenced cells. Handle invalid arguments, formula errors and array and spill constraints.

See Also