where quantity (C4:F4) and discount (C5:F5) are named ranges. In the example shown, the data in C4:F5 contains quantity-based discounts. As the quantity increases, the discount also increases. The table to the right shows the discount returned by XLOOKUP for several random quantities. The formula in F5, copied down, is: The same formula without named ranges is: XLOOKUP’s arguments are configiured like this:

The lookup_value comes from cell E5 The lookup_array is the named range quantity (C4:F4) The return_array is the named range discount (C5:F5) The not_found argument is not provided The match_mode is set to -1 (exact match or next smaller) The search_mode is not provided and defaults to 1 (first to last)

At each row, XLOOKUP looks up the quantity in the range C4:F4. When an exact match is found, the corresponding discount in row 5 is returned. When an exact match is not found, the discount associated with the next smallest quantity is returned.

XLOOKUP vs HLOOKUP

The equivalent HLOOKUP formula for this example, is either of the two formulas below: There are several differences worth noting:

HLOOKUP requires the full table array as the second argument. XLOOKUP requires only the range with lookup values. HLOOKUP requires a row index to specify a result column. XLOOKUP requires a range that contains result values. HLOOKUP performs an approximate match by default. XLOOKUP performs an exact match by default. HLOOKUP requires lookup data to be sorted by lookup value. XLOOKUP works with unsorted data. HLOOKUP performs horizontal lookups only, XLOOKUP can perform both horizontal and vertical lookups.

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.