REPLACE (replace text in a text string)

<< Click to Display Table of Contents >>

REPLACE (replace text in a text string)

Syntax:

REPLACE(Text, Start, Count, NewText)

Description:

This replaces a specific part of a text string with other text.

Text is the original text string.

Start is the position of the first character to be replaced.

Count is the number of characters to be replaced.

NewText is the replacement text.

Example:

REPLACE("aaaaaa", 3, 2, "bb") returns aabbaa

REPLACE("aaaaaa", 3, 4, "bb") returns aabb

REPLACE("cccccc", 3, 2, "dddddddd") returns ccddcc

REPLACE("cccccc", 3, 4, "dddddddd") returns ccdddd

REPLACE("cccccc", 3, 6, "dddddddd") returns ccdddddd

See also:

FIND, SEARCH, MID, SUBSTITUTE, LEFT, RIGHT, REPT