Difference between revisions of "Manuals/calci/LOOKUP"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with "<div id="16SpaceContent" align="left"><div class="ZEditBox" align="justify"> Syntax </div></div> ---- <div id="2SpaceContent" align="left"><div class="ZEditBox" align=...")
 
Line 1: Line 1:
<div id="16SpaceContent" align="left"><div class="ZEditBox" align="justify">
+
=LOOKUP(lkup_val, lkup_vector, rslt_vector)=
  
Syntax
+
*where, '''lkup_val''' is the value to be matched from an array or range of values,
 +
*'''lkup_vector''' is the array of values or reference to one row or one column containing values, and
 +
*'''rslt_vector''' is a range that contains only one-row or one-column and is same size as lkup_vector.
  
</div></div>
+
LOOKUP() looks up for a specified value in one-row range or one-column range or an array, and displays a value from same position in second one-row range or one-column range or an array.
----
 
<div id="2SpaceContent" align="left"><div class="ZEditBox" align="justify">
 
  
Examples
+
== Description ==
  
</div></div>
+
LOOKUP(lkup_val, lkup_vector, rslt_vector)
----
 
<div id="8SpaceContent" align="left"><div class="ZEditBox" align="justify">'''<font face="Times New Roman">''''''''''''<font size="6"> </font>''' '''''''''</font>'''</div></div>
 
----
 
<div id="11SpaceContent" align="left"><div class="ZEditBox mceEditable" align="justify">
 
  
<font size="5">Description</font>
+
e.g.
 +
LOOKUP() returns
  
</div></div>
+
LOOKUP() returns
----
 
<div id="10SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">'''<font face="Times New Roman"> <font size="6">LOOKUP</font> </font>'''</div></div>
 
----
 
<div id="3SpaceContent" class="zcontent" align="left"><br /><div id="7Space" class="gamizbox" title="7Space"><div id="7SpaceHeader" class="zheaderstyle" title="Double-click to start and stop editing the header."><center></center></div><div id="7SpaceRollup" title="Double-click to rolldown" align="left"><span><span id="7SpaceRollupContent" align="center"></span></span></div><div id="7SpaceCover"><div id="7SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify"> 
 
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">'''LOOKUP'''</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">'''lkup_val'''</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">'''lkup_vec'''</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">'''res_vec'''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">)</font></font></font>
+
*LOOKUP() function can be used for two forms - '''Vector Form''' and '''Array Form'''.
 +
*In '''Vector Form''', Calci looks for the specified value in one-row or one-column range and returns the value from same position in second one-row or one-column range.
 +
*In '''Array Form''', Calci looks for the specified value in first row or column of an array, and returns the value from same position in last row or column of the array.
 +
*'''lkup_val''' can be a number, text or logical value, or reference to cell containing number, text or logical value.
 +
*'''lkup_vector''' can be one row or one column containing set of values or a reference to cells containing values.
 +
*Values in '''lkup_vector''' should be arranged in ascending order to obtain correct results.
 +
*Arguments containing text values entered as a part of command, should be enclosed in quotes (e.g. "JOHN").
 +
*Size of '''lkup_vector''' should be same as '''rslt_vector''', else Calci displays #NULL error message.
 +
*If no match is found for '''lkup_val''' in the specified range, Calci displays the largest value which is &lt;= '''lkup_val'''.
 +
*LOOKUP function is not case-sensitive.
 +
*If '''lkup_val''' is &lt; 'smallest value in '''lkup_vector'''', Calci displays #NULL error message.
 +
*For invalid arguments, Calci displays #NULL error message.
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">'''where lkup_val is a '''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">value that LOOKUP searches for in the first vector, </font></font></font>
+
== Examples ==
 +
Following table shows the use of LOOKUP function in '''Vector Form''' -
 +
<div id="2SpaceContent" class="zcontent" align="left">
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">'''lkup_vec is a '''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">range that contains only one row or one column and </font></font></font>
+
{| id="TABLE3" class="SpreadSheet blue"
 +
|- class="even"
 +
| class="sshl_f" |'''Quantity'''
 +
| class=" " |'''Item'''
 +
| class=" " |
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">'''res_vec is a '''</font></font></font><font color="#484848"><font face="Arial, sans-serif"><font size="2">range that contains only one row or column. </font></font></font>
+
|- class="odd"
 +
| class="sshl_f" |10
 +
| class=" " |Pen
 +
| class=" " |
  
</div></div>
+
|- class="even"
----
+
| class="sshl_f" |12
<div id="14SpaceContent" class="zcontent" align="left"><br /><br /><br /><div id="5Space" class="gamizbox" title="5Space"><div id="5SpaceHeader" class="zheaderstyle" title="Double-click to start and stop editing the header."><center></center></div><div id="5SpaceRollup" title="Double-click to rolldown" align="left"><span><span id="5SpaceRollupContent" align="center"></span></span></div><div id="5SpaceCover"><div id="5SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify"
+
| class=" " |Pencil
 +
| class=" " |
  
<font color="#484848"><font face="Arial, sans-serif"><font size="2">LOOKUP gives a value either from a one-row or one-column range or from an </font></font></font>[javascript:AppendPopup(this,'xldefArray_1') <font color="#000000"><font face="Arial, sans-serif"><font size="2">array</font></font></font>]<font color="#484848"><font face="Arial, sans-serif"><font size="2">.</font></font></font>
+
|- class="odd"
 +
| class="sshl_f" |15
 +
| class=" " |Eraser
 +
| class=" " |
  
</div></div>
+
|- class="even"
----
+
| class="sshl_f" |25
<div id="12SpaceContent" class="zcontent" align="left"><br /><br /><br /><div id="9Space" class="gamizbox" title="9Space"><div id="9SpaceHeader" class="zheaderstyle" title="Double-click to start and stop editing the header."><center></center></div><div id="9SpaceRollup" title="Double-click to rolldown" align="left"><span><span id="9SpaceRollupContent" align="center"></span></span></div><div id="9SpaceCover"><div id="9SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify"
+
| class=" " |Notebooks
 +
| class=" " |
  
[javascript:ToggleDiv('divExpCollAsst_1') <font color="#666666"><font face="Arial, sans-serif"><font size="2">Let's see an example in C1R1 : C2R5</font></font></font>]
+
|- class="odd"
 +
| class="sshl_f" |35
 +
| class=" " |Markers
 +
| class=" " |
  
[javascript:ToggleDiv('divExpCollAsst_1') <font color="#666666"><font face="Arial, sans-serif"><font size="2">C1 C2</font></font></font>]
+
|}
 
 
[javascript:ToggleDiv('divExpCollAsst_1') <font color="#666666"><font face="Arial, sans-serif"><font size="2">R1 10 Apple</font></font></font>]
 
 
 
[javascript:ToggleDiv('divExpCollAsst_1') <font color="#666666"><font face="Arial, sans-serif"><font size="2">R2 20 Orange</font></font></font>]
 
 
 
[javascript:ToggleDiv('divExpCollAsst_1') <font color="#666666"><font face="Arial, sans-serif"><font size="2">R3 30 Lemon</font></font></font>]
 
  
[javascript:ToggleDiv('divExpCollAsst_1') <font color="#666666"><font face="Arial, sans-serif"><font size="2">R4 40 Pear</font></font></font>]
+
=LOOKUP(15,A2:A6,B2:B6) : Looks up for '15' in range A2 to A6 and returns value from range B2 to B6 in the same row. <br />Returns '''Pencil''' as a result.
 +
=LOOKUP(A2,A2:A6,B2:B6) : Looks up for '15' in range A2 to A6 and returns value from range B2 to B6 in the same row. <br />Returns '''Pen''' as a result.
 +
=LOOKUP(17,A2:A6,B2:B6) : As there is no exact match for '17', matches the nearest value '15' and returns value from range B2 to B6 in same row. <br />Returns '''Eraser''' as a result.
 +
  
[javascript:ToggleDiv('divExpCollAsst_1') <font color="#666666"><font face="Arial, sans-serif"><font size="2">R5 50 Guava</font></font></font>]
+
Following examples show the use of LOOKUP function in '''Array Form''' -
 +
=LOOKUP("B",["A","B","C"],[100,200,300]) : Looks up for 'B' in an array and returns value in last row of array in same column. <br />Returns '''200''' as a result.
 +
=LOOKUP("cat",["A","B","C"],[100,200,300]) : As there is no exact match, Calci finds the largest value &lt;= 'cat' ('C') in array and returns value in last row of array in same column. <br />Returns '''300''' as a result.
  
<font color="#666666"><font face="Arial, sans-serif"><font size="2">I.e. =LOOKUP(30,C1R1:C1R5,C2R1:C2R5) is lemon</font></font></font>
+
== See Also ==
  
</div></div>
+
*[[Manuals/calci/VLOOKUP | VLOOKUP]]
----
+
*[[Manuals/calci/HLOOKUP | HLOOKUP]]
<div id="6SpaceContent" class="zcontent" align="left">
+
*[[Manuals/calci/MATCH | MATCH]]
  
{| id="TABLE3" class="SpreadSheet blue"
+
== References ==
|- class="even"
 
| class="  " |
 
<div id="6Space_Copy" title="Click and Drag over to AutoFill other cells."></div>
 
| class="  " | Column1
 
| class="  " | Column2
 
| class="  " | Column3
 
| class="  " | Column4
 
|- class="odd"
 
| class=" " | Row1
 
| class="sshl_f " | 10
 
| class="sshl_f " | Apple
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|- class="even"
 
| class="  " | Row2
 
| class="sshl_f" | 20
 
| class="sshl_f" | Orange
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|- class="odd"
 
| Row3
 
| class="sshl_f" | 30
 
| class="sshl_f" | Lemon
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|- class="even"
 
| Row4
 
| class="sshl_f" | 40
 
| class="sshl_f" | Pear
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|- class="odd"
 
| class=" " | Row5
 
| class=" " | 50
 
| class="sshl_f " | Guava
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|- class="even"
 
| class="sshl_f" | Row6
 
| class="sshl_f" | Lemon
 
| class="sshl_f  " |
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|- class="odd"
 
| class="sshl_f" | Row7
 
| class="sshl_f SelectTD SelectTD" |
 
<div id="6Space_Handle" title="Click and Drag to resize CALCI Column/Row/Cell. It is EZ!"></div><div id="6Space_Copy" title="Click and Drag over to AutoFill other cells."></div>
 
| class="sshl_f" |
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|- class="even"
 
| class="sshl_f" | Row8
 
| class="SelectTd" |
 
<div id="6Space_Copy" title="Click and Drag over to AutoFill other cells."></div>
 
| class="sshl_f" |
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|}
 
  
<div align="left">[[Image:calci1.gif]]</div></div>
+
*[*[http://en.wikipedia.org/wiki/String_(computer_science) String]
----
+
*[http://en.wikipedia.org/wiki/Comparison_of_programming_languages_(string_functions)#Find Find String]
</div></div></div></div></div></div></div></div></div>
 

Revision as of 16:52, 13 February 2014

LOOKUP(lkup_val, lkup_vector, rslt_vector)

  • where, lkup_val is the value to be matched from an array or range of values,
  • lkup_vector is the array of values or reference to one row or one column containing values, and
  • rslt_vector is a range that contains only one-row or one-column and is same size as lkup_vector.

LOOKUP() looks up for a specified value in one-row range or one-column range or an array, and displays a value from same position in second one-row range or one-column range or an array.

Description

LOOKUP(lkup_val, lkup_vector, rslt_vector)

e.g. LOOKUP() returns

LOOKUP() returns

  • LOOKUP() function can be used for two forms - Vector Form and Array Form.
  • In Vector Form, Calci looks for the specified value in one-row or one-column range and returns the value from same position in second one-row or one-column range.
  • In Array Form, Calci looks for the specified value in first row or column of an array, and returns the value from same position in last row or column of the array.
  • lkup_val can be a number, text or logical value, or reference to cell containing number, text or logical value.
  • lkup_vector can be one row or one column containing set of values or a reference to cells containing values.
  • Values in lkup_vector should be arranged in ascending order to obtain correct results.
  • Arguments containing text values entered as a part of command, should be enclosed in quotes (e.g. "JOHN").
  • Size of lkup_vector should be same as rslt_vector, else Calci displays #NULL error message.
  • If no match is found for lkup_val in the specified range, Calci displays the largest value which is <= lkup_val.
  • LOOKUP function is not case-sensitive.
  • If lkup_val is < 'smallest value in lkup_vector', Calci displays #NULL error message.
  • For invalid arguments, Calci displays #NULL error message.

Examples

Following table shows the use of LOOKUP function in Vector Form -

Quantity Item
10 Pen
12 Pencil
15 Eraser
25 Notebooks
35 Markers
=LOOKUP(15,A2:A6,B2:B6) : Looks up for '15' in range A2 to A6 and returns value from range B2 to B6 in the same row. 
Returns Pencil as a result. =LOOKUP(A2,A2:A6,B2:B6) : Looks up for '15' in range A2 to A6 and returns value from range B2 to B6 in the same row.
Returns Pen as a result. =LOOKUP(17,A2:A6,B2:B6) : As there is no exact match for '17', matches the nearest value '15' and returns value from range B2 to B6 in same row.
Returns Eraser as a result.

Following examples show the use of LOOKUP function in Array Form -

=LOOKUP("B",["A","B","C"],[100,200,300]) : Looks up for 'B' in an array and returns value in last row of array in same column. 
Returns 200 as a result. =LOOKUP("cat",["A","B","C"],[100,200,300]) : As there is no exact match, Calci finds the largest value <= 'cat' ('C') in array and returns value in last row of array in same column.
Returns 300 as a result.

See Also

References