Difference between revisions of "Manuals/calci/REPLACE"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with "<div id="6SpaceContent" class="zcontent" align="left"> <font color="#484848"><font face="Arial, sans-serif"><font size="2">'''REPLACE'''</font></font></font><font color="#4...")
 
Line 1: Line 1:
<div id="6SpaceContent" class="zcontent" align="left">
+
=REPLACE(otext, snum, noc, ntext)=
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">'''REPLACE'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">(</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">'''otxt'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">,</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">'''snum'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">,</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">'''noc'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">,</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">'''ntext'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">)</font></font></font>
+
*where <math>otext</math> is the original or old text
 +
*<math>snum</math> is the position of character in old text
 +
*<math>noc</math> is the number of characters
 +
*<math>ntext</math> is the new text that replaces the characters in old text.
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">where otx</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">'''t'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">   is text that want to replace some characters and</font></font></font>
+
REPLACE() replaces a part of the text string with a different text string.
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">'''snum'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">   is the position of the character in otxt and</font></font></font>
+
== Description ==
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">'''noc'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">   is the number of characters in otxt and</font></font></font>
+
REPLACE(otext, snum, noc, ntext)
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">ntxt  is the text that will replace characters in otxt.</font></font></font>
+
For Example,
  
</div>
+
REPLACE("WELCOME",4,4,"-COME") returns ''WEL-COME''
----
 
<div id="1SpaceContent" class="zcontent" align="left">
 
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">'''REPLACE'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">(</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">'''otxt'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">,</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">'''snum'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">,</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">'''noc'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">,</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">'''ntext'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">)</font></font></font>
+
In above example, original text is replaced with new text from 4th character to next 4 characters.
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">where otx</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">'''t'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">   is text that want to replace some characters and</font></font></font>
+
*<math>otext</math> and <math>ntext</math> should be enclosed in quotes.
 +
*<math>snum</math> and <math>noc</math> should be positive numbers.
 +
*If <math>snum</math> and <math>noc</math> are non-integers, they are truncated.
 +
*If <math>snum</math> is &gt; the length of string, Calci assumes it to be '0'(zero) and new text is appended before old text.
 +
*If any arguments are invalid, Calci displays an #ERROR message.
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">'''snum'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">   is the position of the character in otxt and</font></font></font>
+
== Examples ==
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">'''noc'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">   is the number of characters in otxt and</font></font></font>
+
<div id="6SpaceContent" class="zcontent" align="left">
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">ntxt  is the text that will replace characters in otxt.</font></font></font>
+
{| id="TABLE3" class="SpreadSheet blue"
 +
|- class="even"
 +
| class="ssh1_f" |ColumnA
 +
| class="  " |ColumnB
 +
| class=" " |ColumnC
  
</div>
+
|- class="odd"
----
+
| class="ssh1_f" |123456
<div id="12SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="left">
+
| class=" " |
 +
| class=" " |
  
REPLACE
 
  
</div></div>
+
|- class="even"
----
+
| class="ssh1_f" |replace
<div id="8SpaceContent" class="zcontent" align="left">
+
| class=" " |
 +
| class=" " |
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">Let’s see an example in (Column1 Row 1)</font></font></font>
 
  
<font color="#666666"><font face="Arial, sans-serif"><font size="2">I.e.C1R1 =Inspiration</font></font></font>
+
|- class="odd"
 +
| class="ssh1_f" |ABCDEF
 +
| class=" " |
 +
| class="  " |
  
<font color="#666666"><font face="Arial, sans-serif"><font size="2"><nowiki>=REPLACE(C1R1,5,3,”@”) is Insp@tion</nowiki></font></font></font>
 
  
</div>
+
|- class="even"
----
+
| class="ssh1_f" |Mango
<div id="10SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">Syntax </div><div class="ZEditBox"><center></center></div></div>
+
| class=" " |
----
+
| class=" " |
<div id="3SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">Examples </div></div>
+
 
----
 
<div id="11SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">Description </div></div>
 
----
 
<div id="2SpaceContent" class="zcontent" align="left">
 
  
{| id="TABLE3" class="SpreadSheet blue"
 
|- class="even"
 
| class=" " |
 
| Column1
 
| class="  " | Column2
 
| Column3
 
| Column4
 
 
|- class="odd"
 
|- class="odd"
| class=" " | Row1
+
| class="ssh1_f" |
| class=" " | Inspiration
+
| class="  " |
| class="sshl_f" | Insp@tion
 
|
 
| class="                                                            sshl_f  " |
 
|- class="even"
 
| class="  " | Row2
 
| class="sshl_f" |
 
| class="sshl_f SelectTD SelectTD" |
 
<div id="2Space_Handle" title="Click and Drag to resize CALCI Column/Row/Cell. It is EZ!"></div><div id="2Space_Copy" title="Click and Drag over to AutoFill other cells."></div>
 
|
 
|
 
|- class="odd"
 
| Row3
 
| class="                                      sshl_f            " |
 
|
 
|
 
|
 
|- class="even"
 
| Row4
 
|
 
|
 
|
 
 
| class="  " |
 
| class="  " |
|- class="odd"
 
| class=" " | Row5
 
|
 
|
 
|
 
|
 
|- class="even"
 
| Row6
 
|
 
|
 
|
 
|
 
 
|}
 
|}
  
<div align="left">[[Image:calci1.gif]]</div></div>
+
=REPLACE(A1,2,1,"two") : Replaces second character from old text with "two". Returns '''1two3456''' as output.
----
+
=REPLACE(A2,3,5,"PLACE") :Replaces 5 characters from old text starting from 3rd position with upper case "PLACE". Returns '''rePLACE''' as output.
 +
=REPLACE(A3,6,1,"fghijk") : Replaces 6th character from old text with lower case "fghijk". Returns '''ABCDEfghijk''' as output.
 +
=REPLACE(A4,8,1,"Apple ") : Appends "Apple " before old text as snum is greater than length of old text. Returns '''Apple Mango''' as output.
 +
 
 +
== See Also ==
 +
 
 +
*[[Manuals/calci/REPLACEB | REPLACEB]]
 +
*[[Manuals/calci/SUBSTITUTE | SUBSTITUTE]]
 +
*[[Manuals/calci/REPT | REPT]]
 +
 
 +
==References==
 +
 
 +
*[http://en.wikipedia.org/wiki/Autocorrection Find and Replace]

Revision as of 07:19, 28 December 2013

REPLACE(otext, snum, noc, ntext)

  • where is the original or old text
  • is the position of character in old text
  • is the number of characters
  • is the new text that replaces the characters in old text.

REPLACE() replaces a part of the text string with a different text string.

Description

REPLACE(otext, snum, noc, ntext)

For Example,

REPLACE("WELCOME",4,4,"-COME") returns WEL-COME

In above example, original text is replaced with new text from 4th character to next 4 characters.

  • and should be enclosed in quotes.
  • and should be positive numbers.
  • If and are non-integers, they are truncated.
  • If is > the length of string, Calci assumes it to be '0'(zero) and new text is appended before old text.
  • If any arguments are invalid, Calci displays an #ERROR message.

Examples

ColumnA ColumnB ColumnC
123456


replace


ABCDEF


Mango


=REPLACE(A1,2,1,"two") : Replaces second character from old text with "two". Returns 1two3456 as output.
=REPLACE(A2,3,5,"PLACE") :Replaces 5 characters from old text starting from 3rd position with upper case "PLACE". Returns rePLACE as output.
=REPLACE(A3,6,1,"fghijk") : Replaces 6th character from old text with lower case "fghijk". Returns ABCDEfghijk as output.
=REPLACE(A4,8,1,"Apple ") : Appends "Apple " before old text as snum is greater than length of old text. Returns Apple Mango as output.

See Also

References