How do I use XLOOKUP in Excel?
XLOOKUP finds a value in one column or row and returns the matching item from another. The basic form is =XLOOKUP(what to find, where to look, what to return), and it looks for an exact match unless you tell it otherwise.
A first example
Say cells B2 to B11 hold country names, D2 to D11 hold their phone codes, and you type a country name in F2. In an empty cell, enter:
=XLOOKUP(F2, B2:B11, D2:D11)
- Type
=XLOOKUP(. - Select the cell holding the value you want to find (F2), then type a comma.
- Select the range to search (B2:B11), then type a comma.
- Select the range to return from (D2:D11), type
)and press Enter.
The two ranges should line up, row for row. The return column can be to the left or the right of the search column. Depending on your region settings, Excel may expect semicolons instead of commas.
Show your own message when nothing matches
=XLOOKUP(F2, B2:B11, D2:D11, "Not found")
Without this fourth part, a missing value gives #N/A.
Copy the formula down
When you fill a formula down, ordinary cell references move with it. Add dollar signs to keep the two ranges fixed:
=XLOOKUP(F2, $B$2:$B$11, $D$2:$D$11, "Not found")
In the formula bar, select a reference and press F4 to switch between reference types.
Return more than one column
Make the return range wider, and one formula fills several cells. For example, =XLOOKUP(F2, B2:B11, C2:D11) returns the matching values from both column C and column D. Leave the cell to the right empty so the second result has room.
All six parts
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
- lookup_value: what to find.
- lookup_array: where to search.
- return_array: what to bring back.
- if_not_found (optional): what to show when there is no match.
- match_mode (optional):
0exact (the default);-1exact or the next smaller item;1exact or the next larger item;2wildcards, where*,?and~have special meanings. - search_mode (optional):
1from the first item (the default);-1from the last item;2binary search of data sorted ascending;-2binary search of data sorted descending. The binary options give invalid results if the data is not sorted that way.
Useful variations
- Price or tax bands: use match mode
-1or1to take the nearest band below or above. - Part of a name:
=XLOOKUP("*"&F2&"*", B2:B11, D2:D11, "Not found", 2)finds the first entry containing the text in F2. - Latest entry: use search mode
-1, as in=XLOOKUP(F2, B2:B11, D2:D11, "Not found", 0, -1), to get the last match in the list. This is the newest entry if new rows are added at the bottom.
Which versions of Excel have it
XLOOKUP is in Excel for Microsoft 365, Excel for the web, Excel 2024 and Excel 2021. It is not available in Excel 2016 or Excel 2019, even though you may open a workbook there that someone made with it in a newer version. If you share files with people on those versions, use VLOOKUP, for example =VLOOKUP(F2, B2:D11, 3, FALSE). VLOOKUP searches the first column of the range, and FALSE asks for an exact match.
If you get #N/A
Check that the value is really in the search range, that both sides are the same type (a number is not the same as a number stored as text), and that there are no extra spaces. See Why does my Excel formula show as text, or my VLOOKUP give #N/A, and what can I try?
Official Microsoft pages
If you want someone to talk you through the problem
Want someone to talk you through it? The Application tutor is a Zoom video call: $60 for one hour, $120 for two. You need to book at least 24 hours ahead. List the applications you need help with when you book. We talk you through them, as many as time allows. We never ask for a password or a sign-in code. We cannot promise a fix. We are not part of the companies named here, and they do not endorse us.
The page "How do I use XLOOKUP in Excel?" was last changed on December 5, 2026.