Lookup Reference

Methods

(inner) choose(index_num, index_num, …args) → {*}

Chooses a value from a list of values.

Category: Lookup and reference

Parameters:
NameTypeAttributesDescription
index_numnumber

Specifies which value argument is selected. Index_num must be a number between 1 and 254, or a formula or reference to a value containing a number between 1 and 254. If index_num is 1, CHOOSE returns value1; if it is 2, CHOOSE returns value2; and so on. If index_num is less than 1 or greater than the number of the last value in the list, CHOOSE returns the #VALUE! error value. If index_num is a fraction, it is truncated to the lowest integer before being used.

  • If index_num is 1, CHOOSE returns value1; if it is 2, CHOOSE returns value2; and so on.
  • If index_num is less than 1 or greater than the number of the last value in the list, CHOOSE returns the #VALUE! error value.
  • If index_num is a fraction, it is truncated to the lowest integer before being used.
index_numnumber

the index of the value to return.

args*<repeatable>

value1, value2, ... Value 1 is required, subsequent values are optional. 1 to 254 value arguments from which CHOOSE selects a value or an action to perform based on index_num. The arguments can be numbers, value references, defined names, formulas, functions, or text.

See
Returns:

the value at a given index, or an error where it specifies an index that does not exist.

Type: 
*
Examples
lookup.CHOOSE(3, 'jima', 'jimb', 'jimc') //returns ('jimc')
lookup.CHOOSE(2, 'jima') //returns (error.value)

(inner) column(reference, index) → {number}

Returns the column number of a reference.

Category: Lookup and reference

Parameters:
NameTypeDescription
referenceArray.Array

the value or range of values for which you want to return the column number.

indexnumber
See
Returns:

the column number of a reference or an error if the arguments are incorrect.

Type: 
number

(inner) columns(array) → {number}

Returns the number of columns in a reference.

Category: Lookup and reference

Parameters:
NameTypeDescription
arrayArray.Array

An array or array formula, or a reference to a range of values for which you want the number of columns.

See
Returns:

the number of columns in a reference or an error if the arguments are incorrect.

Type: 
number

(inner) hLookup(lookup_value, table_array, row_index_num, range_lookupopt) → {*|Error}

Looks in the top row of an array and returns the value of the indicated value.

Category: Lookup and reference

Parameters:
NameTypeAttributesDescription
lookup_value*

The value to be found in the first row of the table. Lookup_value can be a value, a reference, or a text string.

table_arrayArray.Array

A table of information in which data is looked up. Use a reference to a range or a range name.

row_index_numnumber

The row number in table_array from which the matching value will be returned. A row_index_num of 1 returns the first row value in table_array, a row_index_num of 2 returns the second row value in table_array, and so on. If row_index_num is less than 1, HLOOKUP returns the #VALUE! error value; if row_index_num is greater than the number of rows on table_array, HLOOKUP returns the #REF! error value.

range_lookupboolean<optional>

Optional. A logical value that specifies whether you want HLOOKUP to find an exact match or an approximate match. If TRUE or omitted, an approximate match is returned. In other words, if an exact match is not found, the next largest value that is less than lookup_value is returned. If FALSE, HLOOKUP will find an exact match. If one is not found, the error value #N/A is returned.

See
Returns:

the value in the table_array second column based on the index of the value looked up in the first column.

Type: 
* | Error
Examples
rosetta.hLookup(0, [[1, 0], ['jim', 'jam']], 2, false) //returns'jam'
rosetta.hLookup(1.4, [[0, 1, 2, 1], ['A', 'B', 'C', 'D']], 2) //returns 'B'

(inner) index(array, row_num, column_numopt) → {*|Error}

Uses an index to choose a value from a reference or array.

Category: Lookup and reference

Parameters:
NameTypeAttributesDescription
arrayArray

A range of values or an array constant.

  • If array contains only one row or column, the corresponding row_num or column_num argument is optional.
  • If array has more than one row and more than one column, and only row_num or column_num is used, INDEX returns an array of the entire row or column in array.
row_numnumber

Required, unless column_num is present. Selects the row in array from which to return a value. If row_num is omitted, column_num is required.

column_numnumber<optional>

Optional. Selects the column in array from which to return a value. If column_num is omitted, row_num is required.

Returns:

returns the value at a given index from a datasource.

Type: 
* | Error
Examples
rosetta.index([['Banana', 'Apple'],['Strawberry', 'Pineapple']], 2, 1) //returns 'Strawberry'
rosetta.index([['Banana', 'Apple'],['Strawberry', 'Pineapple']], 1, 2) //returns 'Apple'

(inner) lookup(lookup_value, array, result_arrayopt) → {*|Error}

Looks up values in a vector or array.

Category: Lookup and reference

Parameters:
NameTypeAttributesDescription
lookup_value*

A value that LOOKUP searches for in an array. The lookup_value argument can be a number, text, a logical value, or a name or reference that refers to a value.

  • If LOOKUP can't find the value of lookup_value, it uses the largest value in the array that is less than or equal to lookup_value.
  • If the value of lookup_value is smaller than the smallest value in the first row or column (depending on the array dimensions), LOOKUP returns the #N/A error value.
arrayArray

A range of values that contains text, numbers, or logical values that you want to compare with lookup_value. The array form of LOOKUP is very similar to the HLOOKUP and VLOOKUP functions. The difference is that HLOOKUP searches for the value of lookup_value in the first row, VLOOKUP searches in the first column, and LOOKUP searches according to the dimensions of array.

result_arrayArray<optional>

Optional. A range that contains only one row or column. The result_array argument must be the same size as lookup_value. It has to be the same size.

Returns:

the value in the result_array at the same index from the first array that is closest to the lookup_value

Type: 
* | Error
Examples
lookup('Jack', ['Jim', 'Jack', 'Franck'], ['blue', 'yellow', 'red']) //returns 'yellow'
lookup(0.21, [[0.1, 0.2, 0.3, 0.2]], [['A', 'B', 'C', 'D']]) //returns 'B'

(inner) match(lookup_value, lookup_array, match_type) → {number|Error}

Looks up values in a reference or array.

Category: Lookup and reference

Parameters:
NameTypeDefaultDescription
lookup_value*

The value that you want to match in lookup_array. For example, when you look up someone's number in a telephone book, you are using the person's name as the lookup value, but the telephone number is the value you want.The lookup_value argument can be a value (number, text, or logical value) or a value reference to a number, text, or logical value.

lookup_arrayArray

The range of values being searched.

match_typenumber1

Optional. The number -1, 0, or 1. The match_type argument specifies how Excel matches lookup_value with values in lookup_array. The default value for this argument is 1.

See
Returns:

the index of the value you are attempting to lookup via match_type, or it returns an error.

Type: 
number | Error
Examples
match(1, [[0], [1], [2], [3], [4]]) //returns 2
match('*mc', ['jima', 'jimb', 'jimc', 'bernie'], 0) //returns 3

(inner) row(reference, index) → {number}

Returns the row number of a reference.

Category: Lookup and reference

Parameters:
NameTypeDescription
referenceArray.<Array.<number>>

the value or range of values for which you want the row number.

indexnumber
Returns:

the row number of a reference or an error if the arguments are incorrect.

Type: 
number

(inner) rows(array)

Returns the number of rows in a reference.

Category: Lookup and reference

Parameters:
NameTypeDescription
arrayArray.<Array.<number>>

An array, an array formula, or a reference to a range of values for which you want the number of rows.

See
Returns:

the number of rows in a reference or an error if the arguments are incorect.

(inner) transpose(array) → {Array.<Array.<number>>}

Returns the transpose of an array.

Category: Lookup and reference

Parameters:
NameTypeDescription
arrayArray.<Array.<number>>

An array or range of values on a worksheet that you want to transpose. The transpose of an array is created by using the first row of the array as the first column of the new array, the second row of the array as the second column of the new array, and so on. If you're not sure of how to enter an array formula, see Create an array formula.

See
Returns:

the transpose of an array or an error if the arguments are incorrect.

Type: 
Array.<Array.<number>>

(inner) vLookup(lookup_value, table_array, col_index_num, range_lookupopt) → {*|Error}

Looks in the first column of an array and moves across the row to return the value of a value.

Category: Lookup and reference

Parameters:
NameTypeAttributesDescription
lookup_value*

The value to be found in the first row of the table. Lookup_value can be a value, a reference, or a text string.

table_arrayArray.Array

A table of information in which data is looked up. Use a reference to a range or a range name.

col_index_numnumber

The row number in table_array from which the matching value will be returned. A row_index_num of 1 returns the first row value in table_array, a row_index_num of 2 returns the second row value in table_array, and so on. If row_index_num is less than 1, VLOOKUP returns the #VALUE! error value; if row_index_num is greater than the number of rows on table_array, VLOOKUP returns the #REF! error value.

range_lookupboolean<optional>

Optional. A logical value that specifies whether you want VLOOKUP to find an exact match or an approximate match. If TRUE or omitted, an approximate match is returned. In other words, if an exact match is not found, the next largest value that is less than lookup_value is returned. If FALSE, VLOOKUP will find an exact match. If one is not found, the error value #N/A is returned.

See
Returns:

the value in the table_array second column based on the index of the value looked up in the first column.

Type: 
* | Error
Examples
rosetta.vLookup('jim', [['jam', 2], ['jim', 4]], 2, false) //returns 4
rosetta.vLookup(1.1, [[0, 'A'], [1, 'B'], [2, 'C'], [1, 'D']], 2, true) //returns 'B'