Textmedium

REPLACE()

Replaces part of a string with another string at a specific character position.

Syntax
fx
=REPLACE(text, position, length, new_text)
Arguments
ArgumentDescription
textThe text whose part will be replaced.
positionThe position where the replacement begins (1-indexed).
lengthThe number of characters in the text to be replaced.
new_textThe text which will be inserted in place of the removed segment.
Example
fx
=REPLACE("apple", 2, 3, "X")

Paste this into Google Sheets to run it. The live playground on this site covers 24 of the 61 functions, and REPLACE isn't one of them yet.

Related formulas
SUBSTITUTE()
Replaces existing text with new text in a string. Match by content.
MID()
Returns a segment of a string starting at a given position, for a given length.
LEFT()
Returns a substring from the beginning of a specified string.
Used by
SUBSTITUTE()
Replaces existing text with new text in a string. Match by content.