Vectors, Matrices, and Tables > Working With Arrays > Example: Effect of ORIGIN on Lookup Functions
  
Example: Effect of ORIGIN on Lookup Functions
The system variable ORIGIN affects the result of lookup functions for which you must specify a row or column index. Only functions hlookup and vlookup meet this criteria.
The hlookup and vlookup functions can be evaluated both numerically and symbolically.
1. Define an input matrix.
Click to copy this expression
2. Evaluate ORIGIN to ensure that it is set to 0.
Click to copy this expression
ORIGIN=0
1. Define the row argument r and the z argument.
Click to copy this expression
Click to copy this expression
2. Evaluate the horizontal lookup function hlookup.
Click to copy this expression
The returned element is located at the intersection of row r and the column that intersects row 0 at z1.
3. Define the column argument c.
Click to copy this expression
4. Evaluate the vertical lookup function vlookup.
Click to copy this expression
The returned element is located at the intersection of column c and the row that intersects column 0 at z1.
ORIGIN≠0
1. Set ORIGIN to 1.
Click to copy this expression
2. Reevaluate the horizontal lookup function hlookup.
Click to copy this expression
The returned element is located at the intersection of row r-ORIGIN and the column that intersects row 0 at z1.
3. Reevaluate the vertical lookup function vlookup.
Click to copy this expression
The returned element is located at the intersection of column c-ORIGIN and the row that intersects column 0 at z1.
4. Show that in order to get the same results when ORIGIN is set to 0, you must add the new value of ORIGIN to the r and c arguments.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression