Replace in String [REPLACE]

Replaces a given number of characters within a string with another string, starting from a specified position.

Syntax

REPLACE (“OldText”, Position, NumberOfCharacters, “NewText”)

Note: The required separator (comma or semi-colon) automatically corresponds to your computer’s location settings.

Data Types of the Arguments

Old and new text: String

Starting Position: Integer

Number of Characters: Integer

Data Type of the Result

String

Example

In the string “2017”, start at position 3, and replace two characters with “18”

Expression

REPLACE (“2017”, 3, 2, “18”)

Result

2018

Notes

Use Substitute Strings [SUBSTITUTE] to replace one string with another, in all instances or a particular instance.

Use REPLACE to change a particular string to another string, with a given starting position.

  • Was this Helpful ?
  • YesNo