Monday, July 21, 2008

SUBSTITUTE()

SUBSTITUTE() - This function substitutes new text for old text in a string.

Syntax

SUBSTITUTE(text; search_text; new text; occurrence)

text is the text in which text segments are to be exchanged.

search_text is the text segment that is to be replaced (a number of times).

new text is the text that is to replace the text segment.

occurrence (optional) indicates which occurrence of the search text is to be replaced. If this parameter is missing the search text is replaced throughout.


Example:

=SUBSTITUTE("321032103210";"0";"Hello") returns 321Hello321Hello321Hello

=SUBSTITUTE("321032103210";"0";"Hello";2) returns 3210321Hello3210

No comments:

Relax. Kick your shoes off and watch a video.