Function · Lookup
Excel LOOKUP function
The Excel LOOKUP function finds the largest value that is less than or equal to a lookup in a list sorted ascending. A quantity of 40 in bands of 1, 10, 25, and 100 gets the 10% discount.
Syntax =LOOKUP(lookup_value, lookup_vector, [result_vector])
=LOOKUP(40,A2:A5,B2:B5)Arguments
| Name | Required | What to pass |
|---|---|---|
| lookup_value | Required | The value to place among the bands. |
| lookup_vector | Required | A single row or column, sorted ascending. LOOKUP has no exact-match switch. |
| result_vector | Optional | The parallel row or column to return from. If omitted, the lookup vector itself is returned. |
Examples
Quantity discount for 40 units
=LOOKUP(40,A2:A5,B2:B5)Result 10%
| A | B | C | D | |
|---|---|---|---|---|
| 1 | At least | Discount | Qty | |
| 2 | 1 | 0% | 40 | |
| 3 | 10 | 5% | 10% | |
| 4 | 25 | 10% | ||
| 5 | 100 | 15% |
LOOKUP, in the vector form, finds the last entry that is less than or equal to your value. The discount bands are 1, 10, 25, and 100 units. A quantity of 40 is past 25 and not yet 100, so the discount is 10%. There is no fourth argument for an exact match. This function always does the approximate search, and it trusts you to keep the lookup vector sorted ascending.
An unsorted vector returns a wrong band and does not warn you. That is the reason most new sheets should use XLOOKUP or VLOOKUP with FALSE. LOOKUP still fits a short sorted bracket, such as these quantity breaks. A value below the first band is #N/A. A value above the last band returns the last result, here 15% for any quantity of 100 or more.