ShareYourGroupShareYourGroupExcel Formulas

Lookup functions

XLOOKUP function in Excel

XLOOKUP finds a value in one range and returns the matching value from another range, in any direction.

XLOOKUP is the modern replacement for VLOOKUP and HLOOKUP. It does the same job with fewer traps. It is available in Excel 2021 and Microsoft 365. Older versions, such as Excel 2016 and 2019, do not have it and show #NAME?.

Syntax

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
ArgumentWhat it is
lookup_valueThe value to look for.
lookup_arrayThe single column or row to search.
return_arrayThe column or row to return from. It must be the same size as the lookup array.
if_not_foundWhat to show when nothing matches. Without it you get #N/A.
match_mode0 exact match (the default), -1 exact or next smaller, 1 exact or next larger, 2 wildcard match.
search_mode1 search from the first item (the default), -1 search from the last.

Examples

Each result below is what Excel itself showed for the formula on the sample sheet.

Sample sheet: A small price list with item codes. The table is sorted by code.
ABCDE
1CodeItemCategoryPriceStock
2A101Basmati Rice 5 kgGrocery65040
3A102Toor Dal 1 kgGrocery16075
4B201NotebookStationery60300
5B202Ball PenStationery100
6C301LED BulbElectronics110200
7C302Power BankElectronics129918
8D401Steel BottleHome45055

How it works

You give XLOOKUP two separate ranges: where to look, and where to take the answer from. It finds the position of the lookup value in the first range and returns the item at the same position in the second.

Because the two ranges are separate, there is no column number to count, and it does not matter which one is on the left.

Why it is better than VLOOKUP

Match modes

match_modeMeaningTypical use
0exact matchcodes, names, IDs
-1exact, or the next smaller itemgrade bands, tax slabs
1exact, or the next larger itemthe next size up, the next delivery slot
2wildcards * and ?part of a name

For the approximate modes the lookup range does not have to be sorted, another improvement over VLOOKUP.

Two-way lookup

Put one XLOOKUP inside another to find a value at the meeting point of a row label and a column label. On the months sheet, =XLOOKUP("Target",A1:A3,XLOOKUP("Mar",B1:G1,B1:G3)) would return the target for March. The inner formula returns the whole March column and the outer one picks the Target row from it.

Common mistakes

In Google Sheets

Google Sheets also has XLOOKUP, with the same arguments.

Related functions

Every result on this page was calculated in Microsoft Excel (version 16.0, build 20326) on 12 November 2026, not typed by hand.

This is an independent help site. It is not connected with or approved by Microsoft. Excel and Microsoft 365 are trademarks of Microsoft Corporation, named here only to say which program a formula is for. The people and figures in the sample sheets are made up.