Skip to main content

LOOKUP

LOOKUP finds a match for a given value in the first range, and then returns the value in the cell with the same relative position in the second range. Ranges cannot overlap or be of different sizes.

This command is typically combined with the large, small or rank commands to identify a particular value, such as the top number of points or actions among a range of players. Once the value is known it is used to reference the name of the player in the corresponding cell. In this way, results such as the top point scorer can be returned.


FORMAT: LOOKUP ( value IN reference .. reference USING reference..reference )


DEFINITIONS:

  • reference: column number or column title, row
  • row number value: the number, string or instances you want to search the first range with
  • A range is specified by reference..reference

EXAMPLE 1:

show lookup ($highest in 1,1..1,4 using 2,1..2,4)

Using the value stored in the variable “highest”, match it to the value in the cell range from column 2, row 1 to column 2, row 4 and show the corresponding value in the cell range column 1, row 1 to column 1, row 4.

EXAMPLE 2:

show lookup ( “w” in $column-1,1..$column-1,8 using $column-2,1..$column-2,8 )

Shows the value in the cell 2 columns to the left of the current cell, if it finds “w” in the cell 1 column to the left of the current cell.

EXAMPLE 3:

lookup(cell “data” in “sorted”,1..“sorted”,8 using “rank”,1..“rank”,8 )

Using the cell on the same row in column “data”, searches the column “sorted”. If it finds it, the value from the column “rank” will be returned at the same row.