Functions > Vector and Matrix > Other Array Functions > Example: Lookup Functions
  
Example: Lookup Functions
Use the lookup, hlookup, vlookup and match functions to find values in vectors or matrices and return the corresponding entries from the same or from another array.
Searching Through One Matrix
1. Define the following car survey matrix.
Click to copy this expression
The rows represent the model number, the percentage of the market, the crash test rating, and the average cost per car in $.
2. Call the lookup function to find the model numbers of cars that have an average price of $30000
Click to copy this expression
Click to copy this expression
Click to copy this expression
3. Call the hlookup function to find the cost of model #4.
Click to copy this expression
Click to copy this expression
4. Call the vlookup function to find the market percentage of model #9. Transpose the matrix of data since vlookup searches through columns and not through rows as for hlookup.
Click to copy this expression
Click to copy this expression
5. Use the match function to find the indices of cars that have an average price of $25000.
Click to copy this expression
The cars matrix has an average price of $25000 at these indices.
Click to copy this expression
Click to copy this expression
Searching Through Two Matrices
1. Create matrices containing the cost of the cars and their corresponding crash test rating.
Click to copy this expression
Click to copy this expression
For these two tables, the rows represent the different types of cars. The columns represent the different brands.
2. 2. Use the lookup function to search for cars with an average cost of $25000 in one grid and to return the corresponding crash test rating from the other grid.
Click to copy this expression