XLOOKUP usually fails for one of six reasons: the workbook is in Compatibility Mode or saved in an old file format, you are on a build of Excel that does not include XLOOKUP at all, the lookup value and the lookup array use different data types, the return array is a different size than the lookup array, an absolute reference was not locked and the formula broke when filled down, or the formula contains a stray space or a wrong range. Fix the file format and the software version first, because nothing else matters if the function does not exist in your copy of Excel. Then check types and range sizes, which cause most of the remaining errors.
What You'll Need
- Excel for Microsoft 365, Excel 2024 or Excel 2021 on Windows or Mac, or Excel for Microsoft 365 on iPad and iPhone. These are the editions that include XLOOKUP.
- The workbook saved in the .xlsx or .xlsb format, not the older .xls format.
- The data you are looking up, ideally in a single contiguous range or an Excel Table.
- A basic idea of the difference between text and numbers in your key column, because that is where most silent failures hide.
Step-by-Step
- Confirm the function exists in your build. Type
=XLOOKUP(into an empty cell and press Enter. If you get #NAME?, Excel does not recognise the name. That is a version problem, not a syntax problem. XLOOKUP is not available in Excel 2019, 2016 or earlier, and older perpetual editions will never receive it. You need a Microsoft 365 subscription or a recent perpetual edition. Note that menu labels and ribbon wording differ slightly between versions, platforms and regions. - Check for Compatibility Mode in the title bar. If the title bar reads Compatibility Mode, the file is still in the legacy .xls format. Go to File > Info > Convert to upgrade it to the current format. Convert a copy if other people still open the file in old versions, because the converted file will not open in them. Reasons a file stays in Compatibility Mode: it was created with an old template, it is shared with users on old software, or the save format was chosen manually under File > Save As.
- Make sure the formula is entered as a normal formula. If you see curly braces { } around the formula in the formula bar, it was entered as an array formula. XLOOKUP does not need that. Select the cell, press F2, then Ctrl+Shift+Enter was the old way; today simply retype the formula and press Enter. In dynamic-array Excel, XLOOKUP spills results automatically, so never pre-select a block of cells and enter the formula into all of them.
- Verify the lookup value type matches the lookup array type. A number stored as text will not match a real number, and XLOOKUP returns #N/A without any hint. Test with
=ISNUMBER(A2)and=ISTEXT(A2)on both the lookup value and the matching cell in the lookup array. If one side is text and the other is a number, convert one side.=VALUE(A2)turns a text number into a real number;=TEXT(A2,"0")does the reverse. Numbers pasted from another system or exported from a database are the usual culprits. - Look for hidden spaces and non-printing characters. A trailing space after a name is invisible but breaks an exact match. Use
=TRIM(A2)on the lookup value, and consider=CLEAN()for characters copied from web pages. To find the real cause fast, wrap the formula with=LEN(A2)on both the search value and the matching cell. If the lengths differ, you have a hidden character. - Check that the lookup array and return array are the same height. This is the single most common cause of #VALUE!. XLOOKUP requires both arrays to have the same number of rows. If your lookup array is
A2:A100and your return array isC2:C90, the function errors. Rewrite both ranges so they line up, or better, convert the source data to an Excel Table and reference entire table columns, which resize together. - Lock the ranges with absolute references before filling down. A formula written with A2:A100 relative references will shift to A3:A101 on the next row and start returning #N/A or wrong answers. Use
$A$2:$A$100and$C$2:$C$100, or press F4 after selecting each range to add the dollar signs automatically. If you are on a Mac without a function key, use the keyboard shortcut shown in Excel's formula editing help for your version. - Set the match mode deliberately. The fourth argument controls matching: 0 for exact match, -1 for exact match or next smaller, 1 for exact match or next larger, 2 for wildcard. If you omit it, XLOOKUP defaults to exact match, which is what most people want. The trap is using 2 without realising it, or expecting approximate matching like VLOOKUP's TRUE without setting it. For lookups where the key may be missing, use the fourth argument plus the if_not_found argument to return a friendly message such as "Not found" instead of #N/A.
- Check the search mode when duplicates exist. The sixth argument sets search direction: 1 searches first to last, -1 searches last to first, and 2 and -2 do a binary search on sorted data. Binary search modes on unsorted data give wrong results with no error, which is dangerous. Leave it at the default unless your data is genuinely sorted and you need the speed.
- Confirm the return array is the dimension you expect. XLOOKUP can return a whole row or column if the return array is wider or taller than one column, which is fine, but if you expected a single value and got a spilled block, you probably selected too many columns. Reduce the return array to the one column you need, or wrap the result in a function that handles the spill.
Common Mistakes
Entering XLOOKUP as a legacy array formula with Ctrl+Shift+Enter is a frequent error; it is designed to be entered normally. Another is assuming #NAME? means a typo: it almost always means the function is not installed in that version. Forgetting that search mode 2 needs sorted data causes quiet wrong answers rather than errors. Mixing a table column reference with a plain range in the same formula can also cause mismatched sizes later. And because XLOOKUP spills, an existing value below the formula cell blocks the result and shows #SPILL!, so clear the cells beneath it.
Tips
Use the if_not_found argument instead of nesting IFERROR, which is cleaner and faster. Reference an Excel Table's columns rather than fixed ranges so the formula survives added rows. When copying formulas between workbooks, check the ranges immediately, because structured references do not always transfer between files. Press F2 and look at the coloured range outlines to confirm which cells the formula actually points at. If you share a workbook with people on older Excel versions, plan for #NAME? on their machines and consider a VLOOKUP or INDEX/MATCH fallback for those files.
Troubleshooting
If the formula still fails, work backwards: recreate it in a brand-new blank sheet with two small ranges, and build it argument by argument, pressing Enter after each addition. If the minimal version works, the fault is in the data, not the syntax. Recheck the type test and length test on the failing rows. If #NAME? persists after confirming your version, check whether the file was opened in a viewer that does not support newer functions. If you see #NAME? only on some machines, the others are running an older edition. If the results are wrong but not erroring, suspect duplicate keys and search mode before anything else. Finally, if a corporate template is involved, the workbook may use a custom function library that masks or redefines names.
Frequently Asked Questions
Why does XLOOKUP return #NAME?
Because the version of Excel you are using does not include the function, usually Excel 2019 or earlier, or an old perpetual edition. Open the file in Microsoft 365 or a recent version, or use VLOOKUP or INDEX/MATCH instead.
Can I use XLOOKUP in an .xls file?
No. The legacy .xls format does not support the function. Convert the file to .xlsx first with File > Info > Convert, and be aware that converted files no longer open in very old versions of Excel.
Why does XLOOKUP say #N/A when the value is clearly there?
Almost always a data type or hidden character mismatch. Check whether the value is text in one place and a number in the other, and compare the lengths of both strings with LEN.
Why do I get #VALUE! with correct-looking ranges?
The lookup array and return array have different heights. Make them equal, or use an Excel Table so both sides resize together.
Why did my formula work for one row and then fail when filled down?
The ranges were not locked. Use absolute references such as $A$2:$A$100, or press F4 to add the dollar signs.
Does XLOOKUP work in Excel on the iPhone and iPad?
Yes in the current Microsoft 365 mobile app, but the exact features and behaviour vary by version and device, so test a small formula before relying on it in a sheet you share.