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=...")
 
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<div id="16SpaceContent" align="left"><div class="ZEditBox" align="justify">
+
<div style="font-size:30px">'''LOOKUP (Value,Array,OtherArray) '''</div><br/>
  
Syntax
+
where,
 +
*'''Value''' is the value to be matched from an array or range of values,
 +
*'''Array''' is the array of values or reference to one-row or one-column containing values, and
 +
*'''OtherArray''' is a range that contains only one-row or one-column and is same size as lkup_vector.
 +
**LOOKUP(),looks up values in a vector or array.
  
</div></div>
+
== Description ==
----
 
<div id="2SpaceContent" align="left"><div class="ZEditBox" align="justify">
 
  
Examples
+
LOOKUP (Value,Array,OtherArray)
  
</div></div>
+
*LOOKUP() function can be used in 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.
<div id="8SpaceContent" align="left"><div class="ZEditBox" align="justify">'''<font face="Times New Roman">''''''''''''<font size="6"> </font>''' '''''''''</font>'''</div></div>
+
*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.
----
+
*'''Value''' can be a number, text or logical value, or reference to cell containing number, text or logical value.
<div id="11SpaceContent" align="left"><div class="ZEditBox mceEditable" align="justify">
+
*'''Array''' can be one row or one column containing set of values or a reference to cells containing values.
 +
*Values in '''Array''' 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 '''Array''' should be same as '''OtherArray''', else Calci displays #NULL error message.
 +
*If no match is found for '''Value''' in the specified range, Calci displays the largest value which is &lt;= '''lkup_val'''.
 +
*LOOKUP function is not case-sensitive.
 +
*If '''Value''' is less than 'smallest value in '''Array'''', Calci displays #NULL error message.
 +
*For invalid arguments, Calci displays #NULL error message.
  
<font size="5">Description</font>
+
== Examples ==
 +
Following table shows the use of LOOKUP function in '''Vector Form''' -
 +
<div id="2SpaceContent" class="zcontent" align="left">
  
</div></div>
+
{| id="TABLE3" class="SpreadSheet blue"
----
+
|- class="even"
<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>
+
| class="sshl_f" |'''Quantity'''
----
+
| class=" " |'''Item'''
<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"
+
| class=" " |
  
<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>
+
|- class="odd"
 +
| class="sshl_f" |10
 +
| class=" " |Pen
 +
| class=" " |
  
<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>
+
|- class="even"
 +
| class="sshl_f" |12
 +
| class=" " |Pencil
 +
| class=" " |
  
<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>
+
|- class="odd"
 +
| class="sshl_f" |15
 +
| class=" " |Eraser
 +
| 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="even"
 +
| class="sshl_f" |25
 +
| class=" " |Notebooks
 +
| class=" " |
  
</div></div>
+
|- class="odd"
----
+
| class="sshl_f" |35
<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=" " |Markers
 +
| 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>
+
|}
  
</div></div>
+
=LOOKUP(12,A2:A6,B2:B6) : Looks up for '12' in range A2 to A6 and returns value <br />from range B2 to B6 in same row. Returns '''Pencil''' as a result.
----
+
=LOOKUP(A2,A2:A6,B2:B6) : Looks up for '10' in range A2 to A6 and returns value <br />from range B2 to B6 in same row. Returns '''Pen''' as a result.
<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"> 
+
=LOOKUP(17,A2:A6,B2:B6) : As there is no exact match for '17', <br />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">Let's see an example in C1R1 : C2R5</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 <br />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, <br />Calci finds the largest value &lt;= 'cat' ('C') in array and <br />returns value in last row of array in same column. Returns '''300''' as a result.
  
[javascript:ToggleDiv('divExpCollAsst_1') <font color="#666666"><font face="Arial, sans-serif"><font size="2">C1 C2</font></font></font>]
+
==Related Videos==
  
[javascript:ToggleDiv('divExpCollAsst_1') <font color="#666666"><font face="Arial, sans-serif"><font size="2">R1 10 Apple</font></font></font>]
+
{{#ev:youtube|aleaMFPk4-I|280|center|LOOKUP}}
  
[javascript:ToggleDiv('divExpCollAsst_1') <font color="#666666"><font face="Arial, sans-serif"><font size="2">R2 20 Orange</font></font></font>]
+
== See Also ==
  
[javascript:ToggleDiv('divExpCollAsst_1') <font color="#666666"><font face="Arial, sans-serif"><font size="2">R3 30 Lemon</font></font></font>]
+
*[[Manuals/calci/VLOOKUP | VLOOKUP]]
 +
*[[Manuals/calci/HLOOKUP | HLOOKUP]]
 +
*[[Manuals/calci/MATCH | MATCH]]
  
[javascript:ToggleDiv('divExpCollAsst_1') <font color="#666666"><font face="Arial, sans-serif"><font size="2">R4 40 Pear</font></font></font>]
+
== References ==
  
[javascript:ToggleDiv('divExpCollAsst_1') <font color="#666666"><font face="Arial, sans-serif"><font size="2">R5 50 Guava</font></font></font>]
+
*[http://en.wikipedia.org/wiki/Lookup_table Lookup Table]
 +
*[http://en.wikipedia.org/wiki/String_(computer_science) String]
 +
*[http://en.wikipedia.org/wiki/Comparison_of_programming_languages_(string_functions)#Find Find String]
  
<font color="#666666"><font face="Arial, sans-serif"><font size="2">I.e. =LOOKUP(30,C1R1:C1R5,C2R1:C2R5) is lemon</font></font></font>
 
  
</div></div>
 
----
 
<div id="6SpaceContent" class="zcontent" align="left">
 
  
{| id="TABLE3" class="SpreadSheet blue"
+
*[[Z_API_Functions | List of Main Z Functions]]
|- 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>
+
*[[ Z3 |  Z3 home ]]
----
 
</div></div></div></div></div></div></div></div></div>
 

Latest revision as of 15:28, 9 August 2018

LOOKUP (Value,Array,OtherArray)


where,

  • Value is the value to be matched from an array or range of values,
  • Array is the array of values or reference to one-row or one-column containing values, and
  • OtherArray is a range that contains only one-row or one-column and is same size as lkup_vector.
    • LOOKUP(),looks up values in a vector or array.

Description

LOOKUP (Value,Array,OtherArray)

  • LOOKUP() function can be used in 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.
  • Value can be a number, text or logical value, or reference to cell containing number, text or logical value.
  • Array can be one row or one column containing set of values or a reference to cells containing values.
  • Values in Array 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 Array should be same as OtherArray, else Calci displays #NULL error message.
  • If no match is found for Value in the specified range, Calci displays the largest value which is <= lkup_val.
  • LOOKUP function is not case-sensitive.
  • If Value is less than 'smallest value in Array', 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(12,A2:A6,B2:B6) : Looks up for '12' in range A2 to A6 and returns value 
from range B2 to B6 in same row. Returns Pencil as a result. =LOOKUP(A2,A2:A6,B2:B6) : Looks up for '10' in range A2 to A6 and returns value
from range B2 to B6 in 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.

Related Videos

LOOKUP

See Also

References