190 likes | 376 Views
Table LookUp. Data Table (File, List). A collection of records and each record contains fields. Lookup example: Given EmpID, retrieve salary. Data Table Example. Decision Table Example. Decision Table Example. VLookUp Function. VLookUp( SearchValue, TableRange, TableColumn# )
E N D
Data Table (File, List) • A collection of records and each record contains fields. • Lookup example: • Given EmpID, retrieve salary
VLookUp Function • VLookUp(SearchValue, TableRange, TableColumn#) • Table Range: A6:C8 *** Heading is not included • Column number: Each column is assigned a number: • First column is 1, second column is 2, etc. • The first column is called Search Column and values in the first column must be in ascending order. • Search Value: Value used to search the first column to determine the row of the table. • To read the price: • =VLookUp(B1,A6:C8,3)
Absolute Reference to a Table Note: To name a range: Select the cell/range; then right click and choose: Define name
Range Look Up • Discount Table: • Total Sales • At least But less than Discount Rate • 0 300 0% • 300 500 3% • 500 1000 5% • 1000 7%
How to determine the row? • The function locates the first value in column that exceeds the search value, then it backs up one row. Search value greater than or equal to the last value, uses the last row. Is the “But less than” column needed?
Table Design • Professor’s rules for letter grades: • Avg >= 90 A • 90 > Avg >= 80 B • 80 > Avg >= 70 C • 70 > Avg >= 60 D • 60 > Avg F
Exact Match Look Up . What if P4 is entered in B1? . To do an Exact Match look up: VLookUp(SearchValue, TableRange, TableColumn#, False)
Other Look up Functions • Match: Returns the relative position of an item in an range that matches a specified value in a specified order. • Use MATCH instead of one of the LOOKUP functions when you need the position of an item in a range instead of the item itself. • Index: Returns the reference of the cell at the intersection of a particular row and column.
Example • Mileage Chart: