# How to nest one lookup inside another in Excel

Use the result of the first lookup as the value of the second: `=XLOOKUP(XLOOKUP(H1,A2:A8,B2:B8),D2:D5,E2:E5)`.

**Excel:** `=XLOOKUP(XLOOKUP(H1,A2:A8,B2:B8),D2:D5,E2:E5)` (Excel 2021, 2024 and Microsoft 365)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C | D | E | F | G | H |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Employee | Department |  | Department | Manager |  | Employee | Ines Lopez |
| Lena Park | Finance |  | Finance | Carla Moretti |  | Manager |  |
| Omar Ruiz | Sales |  | Sales | Derek Hughes |  |  |  |
| Noor Haddad | IT |  | IT | Yuki Sato |  |  |  |
| Tom Becker | Sales |  | Marketing | Ana Souza |  |  |  |
| Priya Shah | Marketing |  |  |  |  |  |  |
| Ines Lopez | IT |  |  |  |  |  |  |
| Sam Okafor | Finance |  |  |  |  |  |  |

Formula in H2: `=XLOOKUP(XLOOKUP(H1,A2:A8,B2:B8),D2:D5,E2:E5)`

Result: Yuki Sato

## How it works

The inner XLOOKUP finds Ines Lopez's department, IT. The outer XLOOKUP uses "IT" as its lookup value in the second table and returns the manager, Yuki Sato. Each lookup is an ordinary lookup; one simply feeds the other.

## Other ways

- `=VLOOKUP(VLOOKUP(H1,A2:B8,2,FALSE),D2:E5,2,FALSE)`: The same chain with VLOOKUP, for every version.
- `=LET(dept,XLOOKUP(H1,A2:A8,B2:B8),XLOOKUP(dept,D2:D5,E2:E5))`: LET names the middle result, which makes longer chains easier to read and check.

## Common mistakes

- If either step fails, the whole formula returns #N/A. Test the inner lookup on its own to see which step is missing a match.
- The middle value must be spelled the same in both tables: "IT" in one and "I.T." in the other never match.

## Questions

**How do I show the department too?**

Put the inner lookup in its own cell and refer to it, or return both with `=HSTACK(dept,manager)` inside LET.

**Can I chain three tables?**

Yes, nest one more level, or use LET with a name for each step.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/nested-lookup
