Lookups · About 5 minutes
Look up in any direction with XLOOKUP
XLOOKUP is the newer way to look things up. It works in Excel 2021, Microsoft 365 and Google Sheets, but not in Excel 2019 or older.
Instead of a table and a column number, you give it two columns: where to look, and what to bring back. The answer can sit to the left of the search column, which VLOOKUP can't do. It matches exactly by default, so there's no FALSE to forget.
=XLOOKUP( reads as "find B9 in C2:C7, and bring back the value from the same row of A2:A7".
Part of Plus
Free during our founding launch: sign in to unlock this lesson's exercises, the timed practice sets and the rest of Plus. The free lessons stay free, with no account needed.
What XLOOKUP does
XLOOKUP finds a value in one column and brings back the value from the same row of another column. You point at two ranges: where to search, and what to bring back.
It fixes the things that trip people up with VLOOKUP. It can bring back a column to the left, it matches exactly unless you ask otherwise, and it can show your own message when nothing is found.
How to write XLOOKUP
=XLOOKUP(
- lookup_value
- What you are looking for, like a badge number in a cell.
- lookup_array
- The single column (or row) to search in.
- return_array
- The column to bring the answer back from. It must be the same height as the search column.
- if_not_found
- Optional. What to show when there's no match, like
"No match". Leave it out and you get #N/A. - match_mode and search_mode
- Optional and rarely needed. match_mode 0 (the default) means exact, -1 means exact or next smaller, 1 means exact or next larger; search_mode -1 searches from the bottom up.
XLOOKUP worked example
A desk list shows each person's badge number to the right of their name. In B9, find the name for the badge in B8.
| A | B | |
|---|---|---|
| 1 | Name | Badge |
| 2 | Asha | 104 |
| 3 | Ben | 117 |
| 4 | Chen | 121 |
| 5 | Dara | 130 |
| 6 | Eli | 142 |
| 7 | Femi | 156 |
| 8 | Badge | 130 |
| 9 | Name | Dara |
=XLOOKUP( B8, B2:B7, A2:A7, "No match")Find 130 in B2:B7, bring back the name on the same row of A2:A7, and show "No match" if it isn't there. It shows Dara.Common XLOOKUP mistakes
#NAME? instead of an answer
The file is open in Excel 2019 or older, which doesn't have XLOOKUP. Use INDEX and MATCH there, or open it in Microsoft 365, Excel 2021 or later, or Google Sheets.
An error as soon as you press Enter
Make the search range and the return range the same height, like B2:B7 and A2:A7. If one stops a row early, the rows can't line up.
#N/A for a code that is there
Look for a stray space or a number stored as text in the search column. Clean it with TRIM or VALUE, or add an if_not_found message for codes that really are missing.
XLOOKUP or VLOOKUP?
Pick XLOOKUP when you can. VLOOKUP only looks right, so the answer must sit to the right of the search column; XLOOKUP can bring back any column, left or right. VLOOKUP needs FALSE for an exact match and guesses without it; XLOOKUP is exact by default. VLOOKUP needs a column number, which points at the wrong column if someone inserts a column; XLOOKUP points at the return range itself, which moves with the sheet. And XLOOKUP has a built-in not-found message, where VLOOKUP needs IFNA around it.
Pick VLOOKUP when the file must open in Excel 2019 or older, where XLOOKUP shows #NAME?. XLOOKUP works in Microsoft 365, Excel 2021 and later, and Google Sheets. For an older file that also needs to look left, use INDEX and MATCH.
Questions people ask
Is XLOOKUP better than VLOOKUP?
For new work, usually: it looks left as well as right, matches exactly by default and has a built-in not-found message. VLOOKUP still matters for older files.
Why does XLOOKUP show #NAME?
Your Excel doesn't have it. XLOOKUP is in Microsoft 365, Excel 2021 and later, and Google Sheets, but not Excel 2019 or older.
Does XLOOKUP work in Google Sheets?
Yes, with the same parts in the same order.
How do I return a message if XLOOKUP finds nothing?
Add a fourth part: =XLOOKUP(.
Can XLOOKUP use more than one criterion?
Yes. One way joins the columns with &: =XLOOKUP(. This lesson sticks to one value.