REPLACE
Name
Replace
Description
Replaces part of a text string with a different text string.
Syntax
REPLACE(Old_text, Start_char, Num_chars, New_text)
Remarks
Arguments are as follows:
Argument | Description |
---|---|
Old_text | Original text in which you want to replace characters. |
Start_char | Starting position in the original text to begin the replacement. |
Num_chars | Number of characters in the original text that you want to replace with characters from the new text. |
New_text | New text that will replace characters in the original text. |
Use the REPLACE function to replace a specified number of characters in a specified location with other characters. Use the SUBSTITUTE function to replace specific text with other text.
See also FIND and SUBSTITUTE.
Data Type
Accepts string data for the Old_text argument, numeric data for the Start_char argument, numeric data for the Num_chars argument, and string data for the New_text argument. Returns string data. For more information, see Data Type for Each Cell Type.
Example
The following formula replaces three characters with one character, starting with the sixth character in the provided text:
fpSpread1.Formula = "REPLACE(""abcdefghijk"", 6, 3, ""%"")" equals "abcde%ijk"