# XLOOKUP two-way exact match

To perform a two-lookup with the XLOOKUP function (a double XLOOKUP), you can nest one XLOOKUP inside another. In the example shown, the formula in H6 is:

where **months** (C4:E4) and **names** (B5:B13), and **data** (C5:E13) are named ranges.

One of XLOOKUP's features is the ability to lookup and return an entire row or column. This feature can be used to nest one XLOOKUP inside another to perform a two-way lookup. The inner XLOOKUP returns a result to the outer XLOOKUP, which returns a final result.

*Note: XLOOKUP performs an exact match by default, so match mode is not set.*

Working from the inside out, the *inner* XLOOKUP is used to retrieve all data for "Frantz":

XLOOKUP(H4,names,data)

XLOOKUP finds "Frantz" in the named range **names** (B5:B13). Frantz appears in the fifth row, so XLOOKUP returns the fifth row of **data** (C5:E13). The result is an array representing a single row of data for Frantz, containing 3 months of sales:

{10699,5194,10525} // data for Frantz

This array is returned directly to the *outer* XLOOKUP as the return_array:

=XLOOKUP(H5,months,{10699,5194,10525})

The outer XLOOKUP finds the value in H5 ("Mar") inside the named range **months** (C4:E4). The value "Mar" appears as the third item, so XLOOKUP returns the third item from the sales data, the value 10525.

### Without named ranges

The named ranges used in this example are for readability only. Without named ranges, the formula is:

### INDEX and MATCH

This example can be solved with INDEX and MATCH like this:

INDEX and MATCH is a good solution to this problem, and probably easier to understand for most people. However, the XLOOKUP version shows off the power and flexibility of XLOOKUP.

## 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.