REPLACE

Splices a string into the specified string, replacing the characters in the original string from a range of characters.

Syntax

=REPLACE(string, start, count, replacement)

Arguments

ArgumentTypeDescription
stringStringThe specified string
startNumberThe index of the specified string in which to start the replacement
countNumberThe number of characters to replace
replacementStringThe string to splice into the specified string

📘

Start is 1-based (i.e. an index of 1 is used for the first character).

Examples

=REPLACE("Hello!", 6, 0, " world")"Hello world!"
At the start index of 6, between "o" and "!", insert the string " world"

=REPLACE("Hello world!", 7, 6, "there")"Hello there"
At the start index of 7, between " " and "w", replace the next 6 characters with the string "there"