
REPLACE
The REPLACE function returns a string value where a specified number of characters of a given string value have been replaced with a new string value.
REPLACE(source-string, start-pos, replace-length, new-string)
source-string: Any value.
start-pos: A number value specifying the position within the specified string at which the action should begin. start-pos must be greater than or equal to 1. If start-pos is greater than the number of characters in source-string, new-string is added to the end of source-string.
replace-length: A number value specifying the number of characters to be replaced. replace-length must be greater than or equal to 1. If replace-length is greater than or equal to the length of source-string and start-pos is 1, the returned string is equal to new-string.
new-string: The value used as a replacement. new-string can contain any value. It does not have to be the same length as existing string.
Examples |
---|
=REPLACE("received applicant’s forms", 10, 9, "Frank") returns "received Frank’s forms". =REPLACE(6060606, 2, 2, 30303) returns "6303030606". |