| Line 17: |
Line 17: |
| | SUBSTITUTE("WELCOME", "COME", "DONE", 1) returns ''WELDONE'' | | SUBSTITUTE("WELCOME", "COME", "DONE", 1) returns ''WELDONE'' |
| | | | |
| − | In above example, first occurrence of original text is replaced with new text. | + | 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. | | *SUBSTITUTE function can be used to replace specific occurrences of the text. |
| Line 24: |
Line 24: |
| | *If string specified in <math>otext</math> is not part of the reference string <math>txt</math>, Calci returns the original string <math>txt</math> as a result. | | *If string specified in <math>otext</math> is not part of the reference string <math>txt</math>, Calci returns the original string <math>txt</math> as a result. |
| | *Argument <math>instnum</math> is optional. If omitted, all instances mentioned in old text are replaced by new text. | | *Argument <math>instnum</math> is optional. If omitted, all instances mentioned in old text are replaced by new text. |
| − | *<math>instnum</math> should be positive integer greater than zero, else Calci displays #NULL error message. | + | *<math>instnum</math> should be an integer > 0, else Calci displays #NULL error message. |
| | | | |
| | == Examples == | | == Examples == |
| Line 48: |
Line 48: |
| | |} | | |} |
| | | | |
| − | =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. 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. Returns '''abc888abc888''' as output. |