=XLOOKUP(value,rng1,rng2,,-1)// approximate match=XLOOKUP(value,rng1,rng2)// exact match
To perform a horizontal lookup with the XLOOKUP function, supply a lookup value, a lookup array, and a result array. Provide a match_mode argument for approximate match if needed. In the example shown, the formula in I5, copied down the table, is:
where quantity (C4:F4) and discount (C5:F5) are named ranges.
XLOOKUP is a beta function, available only through the Office Insiders program.
How this formula works
One nice benefit of the XLOOKUP function is that the syntax used for horizontal lookups is the same as for vertical lookups.
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 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:
To use XLOOKUP with multiple criteria, you can concatenate lookup values and lookup arrays directly in the formula. In the example shown, the formula in H8 is: = XLOOKUP ( H5 & H6 & H7 , B5:B14 & C5:C14 & D5:D14 , E5:E14 ) XLOOKUP...
To use XLOOKUP with multiple logical, build expressions with boolean logic and then look for the number 1. In the example XLOOKUP is used to lookup the first sale to Chicago over $250. The formula in G6 is: = XLOOKUP ( 1 ,( D5:D14 = "chicago...
XLOOKUP can be used to find values to the left of the lookup value. In the example shown, the formula in H6 is: = XLOOKUP ( H4 , E5:E14 , B5:B14 ) which returns 25, the height in column B for model H in row 12. XLOOKUP is a beta function , available...
To use XLOOKUP to find an exact match, you'll need to supply a lookup value, a lookup range, and a result range. In the example shown, the formula in H6 is: = XLOOKUP ( G4 , B5:B18 , D5:D18 ) which returns 3,517,424, the population for Berlin from...
To use XLOOKUP to find an approximate match, supply the match_mode explicitly in the forth argument. In the example shown, the formula in F5, copied down the table, is: = XLOOKUP ( E5 , qty , disc ,, - 1 ) where qty (B5:B13) and disc (C5:C13) are...
The Excel XLOOKUP function performs lookups in vertical or horizontal ranges. It is a more robust and flexible successor to older functions like VLOOKUP, HLOOKUP, and LOOKUP. XLOOKUP supports approximate and exact matching, and wildcards (* ?)...
Excel Formula Training
Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.