You are learning Functions and Formulas in MS Excel
How do I perform approximate lookups with LOOKUP?
Unfortunately, Excel's LOOKUP function itself doesn't support approximate matches. It's designed for exact matches only.
However, there are two alternative functions you can use for approximate lookups:
1. VLOOKUP with TRUE as the fourth argument:
VLOOKUP is a more common lookup function than LOOKUP. It allows you to specify an approximate match by setting the fourth argument (range_lookup) to TRUE or 1. This instructs VLOOKUP to find the closest value less than or equal to the lookup value in the first column of the table array.
Here's the syntax for VLOOKUP with approximate match:
`=VLOOKUP(lookup_value, table_array, col_index_num, TRUE)`
Note: VLOOKUP requires the lookup column (the first column in the table array) to be sorted in ascending order for approximate matches to work correctly.
2. XLOOKUP Function (available in Excel 365):
The XLOOKUP function, introduced in Excel 365, offers more flexibility for lookups, including approximate matches. You can specify the search mode using the match_mode argument:
- `0` (or FALSE) for exact match
- `-1` for closest match less than (similar to VLOOKUP with TRUE)
- `1` for closest match greater than
Here's the syntax for XLOOKUP with approximate match (closest match less than):
`=XLOOKUP(lookup_value, search_array, return_array, -1)`
Choose the function that best suits your Excel version and preference. Remember, VLOOKUP with TRUE works for approximate matches as long as the lookup column is sorted ascendingly. XLOOKUP offers more control over the search mode.