REPLACE

Description

REPLACE replaces part of a text string with another text string.

Syntax

REPLACE ( orig_text, start_position, num_chars, repl_text )

 

Parameter

Description

orig_text

The original text string.

start_position

The character position where the replacement begins. If start_position is greater than the number of characters in orig_text, repl_text is appended to the end of orig_text. If start_position is less than 1, #VALUE! is returned.

num_chars

The number of characters to replace. If this argument is negative, #VALUE! is returned.

repl_text

The replacement text string.

Examples

This function returns "For the year: 1994":

REPLACE("For the year: 1993", 18, 1, "4")

 Note:

If an Invalid formula syntax warning appears, check whether the comma is set as the list separator in your regional settings on the Windows Control Panel. If a different character is set as the list separator, use this character in the above examples in place of the comma. (Windows XP: Access the Windows Control Panel and select Regional and Language Options. On the Regional Options tab page, click Customize. On the Numbers tab page, check which character is the default list separator on your computer. Use this character in the above examples instead of the comma.

Also, see

MID

SEARCH

TRIM

REPLACEB