Difference between revisions of "Manuals/calci/SUBSTITUTE"
Jump to navigation
Jump to search
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | =SUBSTITUTE( | + | <div style="font-size:30px">'''SUBSTITUTE (Text,OldText,NewText,InstanceNumber) '''</div><br/> |
where | where | ||
− | *<math> | + | *<math>Text</math> is the text or reference to cell containing text, from which certain string is to be substituted, |
− | *<math> | + | *<math>OldText</math> is the old text to be replaced, |
− | *<math> | + | *<math>NewText</math> is the new text that replaces the characters in old text, |
− | *<math> | + | *<math>InstanceNumber</math> is the instance number that specifies which occurrence needs to be replaced. |
+ | **SUBSTITUTE(), substitutes specific instances of old text with new text in a text string. | ||
− | |||
== Description == | == Description == | ||
− | + | SUBSTITUTE (Text,OldText,NewText,InstanceNumber) | |
− | SUBSTITUTE( | ||
− | |||
For Example, | For Example, | ||
− | |||
SUBSTITUTE("WELCOME", "COME", "DONE", 1) returns ''WELDONE'' | SUBSTITUTE("WELCOME", "COME", "DONE", 1) returns ''WELDONE'' | ||
− | + | In above example, first instance of old text is replaced with new text. | |
− | In above example, first | ||
− | |||
*SUBSTITUTE function can be used to replace specific occurrences of the text. | *SUBSTITUTE function can be used to replace specific occurrences of the text. | ||
− | *If <math> | + | *If <math>Text</math> is entered directly as a part of argument, it should be enclosed in quotation marks (e.g. "TEXT"). |
− | *<math> | + | *<math>OldText</math> and <math>NewText</math> should be enclosed in quotation marks (e.g. "TEXT"). |
− | *If string specified in <math> | + | *If string specified in <math>OldText</math> is not part of the reference string <math>Text</math>, Calci returns the original string <math>Text</math> as a result. |
− | *Argument <math> | + | *Argument <math>InstanceNumber</math> is optional. If omitted, all instances mentioned in old text are replaced by new text. |
− | *<math> | + | *<math>InstanceNumber</math> should be an integer > 0, else Calci displays #NULL error message. |
== Examples == | == Examples == | ||
Line 48: | Line 43: | ||
|} | |} | ||
− | =SUBSTITUTE(A1,"TUTE", "TUTION",1) : Replaces first instance of old text with new text. Returns '''SUBSTITUTION''' as output. | + | =SUBSTITUTE(A1,"TUTE", "TUTION",1) : Replaces first instance of old text with new text. <br />Returns '''SUBSTITUTION''' as output. |
− | =SUBSTITUTE(A2,"123","888",2) :Replaces second instance of old text with new text. Returns '''abc123abc888''' as output. | + | =SUBSTITUTE(A2,"123","888",2) :Replaces second instance of old text with new text. <br />Returns '''abc123abc888''' as output. |
− | =SUBSTITUTE(A2,"123","888") : Replaces all instances of old text with new text. Returns '''abc888abc888''' as output. | + | =SUBSTITUTE(A2,"123","888") : Replaces all instances of old text with new text. <br />Returns '''abc888abc888''' as output. |
=SUBSTITUTE(A3,"Cost", "Selling") : Returns '''Selling Price''' as output. | =SUBSTITUTE(A3,"Cost", "Selling") : Returns '''Selling Price''' as output. | ||
+ | |||
+ | ==Related Videos== | ||
+ | |||
+ | {{#ev:youtube|YvHrFS-sfiU|280|center|SUBSTITUTE}} | ||
== See Also == | == See Also == | ||
Line 62: | Line 61: | ||
*[http://en.wikipedia.org/wiki/Autocorrection Find and Replace] | *[http://en.wikipedia.org/wiki/Autocorrection Find and Replace] | ||
*[http://en.wikipedia.org/wiki/String_operations#String_substitution String Substitution] | *[http://en.wikipedia.org/wiki/String_operations#String_substitution String Substitution] | ||
+ | |||
+ | |||
+ | |||
+ | *[[Z_API_Functions | List of Main Z Functions]] | ||
+ | |||
+ | *[[ Z3 | Z3 home ]] |
Latest revision as of 17:01, 13 August 2018
SUBSTITUTE (Text,OldText,NewText,InstanceNumber)
where
- is the text or reference to cell containing text, from which certain string is to be substituted,
- is the old text to be replaced,
- is the new text that replaces the characters in old text,
- SUBSTITUTE(), substitutes specific instances of old text with new text in a text string.
is the instance number that specifies which occurrence needs to be replaced.
Description
SUBSTITUTE (Text,OldText,NewText,InstanceNumber) For Example, SUBSTITUTE("WELCOME", "COME", "DONE", 1) returns WELDONE In above example, first instance of old text is replaced with new text.
- SUBSTITUTE function can be used to replace specific occurrences of the text.
- If is entered directly as a part of argument, it should be enclosed in quotation marks (e.g. "TEXT").
- and should be enclosed in quotation marks (e.g. "TEXT").
- If string specified in is not part of the reference string , Calci returns the original string as a result.
- Argument is optional. If omitted, all instances mentioned in old text are replaced by new text.
- should be an integer > 0, else Calci displays #NULL error message.
Examples
SUBSTITUTE | ||
abc123abc123 | ||
Cost Price |
=SUBSTITUTE(A1,"TUTE", "TUTION",1) : Replaces first instance of old text with new text.
Returns SUBSTITUTION as output. =SUBSTITUTE(A2,"123","888",2) :Replaces second instance of old text with new text.
Returns abc123abc888 as output. =SUBSTITUTE(A2,"123","888") : Replaces all instances of old text with new text.
Returns abc888abc888 as output. =SUBSTITUTE(A3,"Cost", "Selling") : Returns Selling Price as output.
Related Videos
See Also
References