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.
2. Evaluate ORIGIN to ensure that it is set to 0.
ORIGIN=0
1. Define the row argument r and the z argument.
2. Evaluate the horizontal lookup function hlookup.
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.
4. Evaluate the vertical lookup function vlookup.
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.
2. Reevaluate the horizontal lookup function hlookup.
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.
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.