Difference between revisions of "Manuals/calci/LOOKUP"
Jump to navigation
Jump to search
(8 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | =LOOKUP( | + | <div style="font-size:30px">'''LOOKUP (Value,Array,OtherArray) '''</div><br/> |
− | + | 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 | + | **LOOKUP(),looks up values in a vector or array. |
== Description == | == Description == | ||
− | LOOKUP( | + | LOOKUP (Value,Array,OtherArray) |
− | |||
− | |||
− | |||
− | |||
− | |||
*LOOKUP() function can be used in two forms - '''Vector Form''' and '''Array Form'''. | *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 '''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. | *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 ''' | + | *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"). | *Arguments containing text values entered as a part of command, should be enclosed in quotes (e.g. "JOHN"). | ||
− | *Size of ''' | + | *Size of '''Array''' should be same as '''OtherArray''', else Calci displays #NULL error message. |
− | *If no match is found for ''' | + | *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. | *LOOKUP function is not case-sensitive. | ||
− | *If ''' | + | *If '''Value''' is less than 'smallest value in '''Array'''', Calci displays #NULL error message. |
*For invalid arguments, Calci displays #NULL error message. | *For invalid arguments, Calci displays #NULL error message. | ||
Line 66: | Line 61: | ||
|} | |} | ||
− | =LOOKUP(12,A2:A6,B2:B6) : Looks up for '12' in range A2 to A6 and returns value from range B2 to B6 in | + | =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 from range B2 to B6 in | + | =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. |
− | =LOOKUP(17,A2:A6,B2:B6) : As there is no exact match for '17', matches the nearest value '15' and | + | =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. |
Following examples show the use of LOOKUP function in '''Array Form''' - | 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. | + | =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, Calci finds the largest value <= 'cat' ('C') in array and <br />returns value in last row of array in same column. Returns '''300''' as a result. | + | =LOOKUP("cat",["A","B","C"],[100,200,300]) : As there is no exact match, <br />Calci finds the largest value <= 'cat' ('C') in array and <br />returns value in last row of array in same column. Returns '''300''' as a result. |
+ | |||
+ | ==Related Videos== | ||
+ | |||
+ | {{#ev:youtube|aleaMFPk4-I|280|center|LOOKUP}} | ||
== See Also == | == See Also == | ||
Line 83: | Line 82: | ||
== References == | == References == | ||
+ | *[http://en.wikipedia.org/wiki/Lookup_table Lookup Table] | ||
*[http://en.wikipedia.org/wiki/String_(computer_science) String] | *[http://en.wikipedia.org/wiki/String_(computer_science) String] | ||
*[http://en.wikipedia.org/wiki/Comparison_of_programming_languages_(string_functions)#Find Find String] | *[http://en.wikipedia.org/wiki/Comparison_of_programming_languages_(string_functions)#Find Find String] | ||
+ | |||
+ | |||
+ | |||
+ | *[[Z_API_Functions | List of Main Z Functions]] | ||
+ | |||
+ | *[[ Z3 | Z3 home ]] |
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
See Also
References