Difference between revisions of "Manuals/calci/SUBSTITUTE"

From ZCubes Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
=SUBSTITUTE(txt, otext, ntext, instnum)=
 
=SUBSTITUTE(txt, otext, ntext, instnum)=
 +
<div style="font-size:30px">'''SUBSTITUTE (Text,OldText,NewText,InstanceNumber) '''</div><br/>
  
 
where  
 
where  
*<math>txt</math> is the text or reference to cell containing text, from which certain string is to be substituted,
+
*<math>Text</math> is the text or reference to cell containing text, from which certain string is to be substituted,
*<math>otext</math> is the old text to be replaced,
+
*<math>OldText</math> is the old text to be replaced,
*<math>ntext</math> is the new text that replaces the characters in old text,
+
*<math>NewText</math> is the new text that replaces the characters in old text,
*<math>instnum</math> is the instance number that specifies which occurrence needs to be replaced.
+
*<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.
  
SUBSTITUTE() substitutes specific instances of old text with new text in a text string.
 
  
 
== Description ==
 
== Description ==
 
+
SUBSTITUTE (Text,OldText,NewText,InstanceNumber)
SUBSTITUTE(txt, otext, ntext, instnum)
 
 
 
 
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 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.
*If <math>txt</math> is entered directly as a part of argument, it should be enclosed in quotation marks (e.g. "TEXT").
+
*If <math>Text</math> is entered directly as a part of argument, it should be enclosed in quotation marks (e.g. "TEXT").
*<math>otext</math> and <math>ntext</math> should be enclosed in quotation marks (e.g. "TEXT").
+
*<math>OldText</math> and <math>NewText</math> should be enclosed in quotation marks (e.g. "TEXT").
*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>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>instnum</math> is optional. If omitted, all instances mentioned in old text are replaced by new text.
+
*Argument <math>InstanceNumber</math> is optional. If omitted, all instances mentioned in old text are replaced by new text.
*<math>instnum</math> should be an integer &gt; 0, else Calci displays #NULL error message.
+
*<math>InstanceNumber</math> should be an integer &gt; 0, else Calci displays #NULL error message.
  
 
== Examples ==
 
== Examples ==

Revision as of 17:01, 13 August 2018

SUBSTITUTE(txt, otext, ntext, instnum)

SUBSTITUTE (Text,OldText,NewText,InstanceNumber)


where

  • Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle Text} is the text or reference to cell containing text, from which certain string is to be substituted,
  • is the old text to be replaced,
  • Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle NewText} is the new text that replaces the characters in old text,
  • Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle InstanceNumber} 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

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 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle Text} is entered directly as a part of argument, it should be enclosed in quotation marks (e.g. "TEXT").
  • Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle OldText} and Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle NewText} should be enclosed in quotation marks (e.g. "TEXT").
  • If string specified in Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle OldText} is not part of the reference string Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle Text} , Calci returns the original string Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle Text} as a result.
  • Argument Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle InstanceNumber} is optional. If omitted, all instances mentioned in old text are replaced by new text.
  • Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle InstanceNumber} 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

SUBSTITUTE

See Also

References