[Table of Contents] [docx version]

SpreadsheetML Reference Material - Table of Contents

SUBSTITUTE

Syntax:

SUBSTITUTE ( string , old-string , new-string [ , occurence ] )

Description: Produces a new string that is string with one or all occurrences of old-string replaced by new-string.

Arguments:

Name

Type

Description

string

text

Designates a string.

old-string

text

Designates a string.

new string

text

Designates a string.

occurence

number

The occurrence number of the old-string characters within string-1 that is to be replaced by the string designated by new-string. If omitted, all occurrences of old-string characters shall be replaced.

 

Return Type and Value: text – A string that is string with one or all occurrences of old-string replaced by new-string.

However, if occurance < 0, #VALUE! is returned.

[Example:

SUBSTITUTE("abcaaabca","a","xx") results in xxbcxxxxxxbcxx
SUBSTITUTE("abcaaabca","a","",10) results in bcbc
SUBSTITUTE("abcaaabca","a","xx",3) results in abcaxxabca

end example]