XLOOKUP stops working between sheets for a handful of predictable reasons: the lookup value and the return column are different data types, the sheet name in the reference is wrong or missing quotes, the range sizes do not match, or the workbook is not calculating. Check those four things first, and most cross-sheet failures resolve in under a minute.
This guide walks through the exact steps to diagnose and fix a cross-sheet XLOOKUP in Excel for Microsoft 365 and Excel 2021 and later. Menu labels and function behavior can differ slightly by version, platform, and region, so if a button name does not match exactly, look for the closest equivalent.
What You'll Need
- Excel for Microsoft 365, Excel 2021, or Excel 2024 (XLOOKUP is not available in Excel 2019 or earlier).
- A workbook with at least two sheets: one holding the lookup value and one holding the lookup array and return array.
- Both sheets saved in the same workbook. XLOOKUP cannot pull from a closed external workbook without a link.
- Edit access to the workbook. If it is shared or protected, some cells may be locked.
Step-by-Step
- Confirm XLOOKUP exists in your version. Type
=XLOOKUP(in an empty cell. If Excel does not suggest the function name, your version does not support it. Use INDEX and MATCH instead, or open the file in Excel for Microsoft 365. - Write the formula with the sheet name in quotes. The correct cross-sheet syntax is
=XLOOKUP(A2,Sheet2!A:A,Sheet2!B:B). If the sheet name contains a space or special character, wrap it in single quotes:=XLOOKUP(A2,'Sales Data'!A:A,'Sales Data'!B:B). Missing quotes around a spaced sheet name is the most common cause of a #NAME? or #REF! error. - Check that the lookup value and the lookup array are the same data type. If A2 contains a number stored as text (often imported from CSV) and Sheet2 column A contains real numbers, XLOOKUP returns #N/A. Select the lookup column and look at the status bar or use
=ISTEXT(A2)and=ISNUMBER(Sheet2!A2)to compare. Convert both sides to the same type. - Verify the ranges are the same height. The lookup array and return array must have the same number of rows.
=XLOOKUP(A2,Sheet2!A2:A100,Sheet2!B2:B50)returns #VALUE! because the arrays do not match. Use full-column references likeSheet2!A:AandSheet2!B:B, or matching fixed ranges. - Look for hidden spaces and non-printing characters. A trailing space in either sheet causes #N/A. Use
=TRIM(A2)on the lookup value and=TRIM(Sheet2!A2)on the first lookup cell to test. If TRIM fixes it, clean the source data or wrap the lookup value in TRIM inside the formula. - Check the sheet name for typos and renamed sheets. If you renamed Sheet2 after writing the formula, Excel usually updates it automatically, but not always when the sheet was renamed outside the formula bar. Click the sheet tab, copy its exact name, and paste it into the formula between single quotes.
- Set the match mode and search mode explicitly. The fourth argument controls match mode: 0 for exact match, -1 for exact match or next smaller, 1 for exact match or next larger, 2 for wildcard. For most lookups use 0. If you omit it, XLOOKUP defaults to exact match, which is usually correct, but being explicit avoids surprises. The fifth argument sets search mode: 1 for first-to-last, -1 for last-to-first, 2 for binary search ascending, -2 for binary search descending. Binary modes require sorted data and return wrong results if the data is not sorted.
- Force a recalculation. Press F9 (or Ctrl+Alt+F9 for a full rebuild) on Windows, or Cmd+= on Mac. If the formula shows the old result, go to Formulas > Calculation Options and confirm Automatic is selected. Manual calculation mode is a frequent cause of "stale" cross-sheet results.
- Test the reference directly. In an empty cell, type
=Sheet2!A2and press Enter. If that returns #REF!, the sheet name or cell reference is broken. If it returns a value, the reference is valid and the problem is in the lookup logic. - Check for merged cells and protected ranges. Merged cells in the lookup or return array can cause XLOOKUP to return unexpected blanks. Unmerge them or restructure the data. If the sheet is protected, unprotect it via Review > Unprotect Sheet before editing formulas that reference it.
Common Mistakes
- Forgetting quotes around sheet names with spaces.
Sales Data!A:Afails;'Sales Data'!A:Aworks. - Mismatched array sizes. The lookup array and return array must have the same row count. Full-column references are the safest fix.
- Number stored as text. Imported data often looks numeric but is text. Use VALUE or Text to Columns to convert.
- Using XLOOKUP in an unsupported Excel version. Excel 2019 and earlier do not have it. The formula appears as #NAME?.
- Leaving the match mode blank when wildcards are needed. Wildcard matching requires the fourth argument set to 2.
- Referencing a closed workbook. XLOOKUP cannot read from a closed file without an external link; open the source workbook or import the data.
Tips
- Use named ranges or Excel Tables (Insert > Table) for the lookup and return arrays. Structured references like Table2[ID] and stay correct when rows are added.
- Wrap the lookup value in TRIM and CLEAN to neutralize stray spaces and non-printing characters:
=XLOOKUP(TRIM(CLEAN(A2)),Sheet2!A:A,Sheet2!B:B). - Add the optional if_not_found argument (sixth) to return a friendly message instead of #N/A:
"Not found". - Use the Evaluate Formula tool (Formulas > Evaluate Formula) to step through the cross-sheet reference and see exactly where it breaks.
- Keep both sheets in the same workbook when possible. Cross-workbook lookups are slower and break when the source file moves.
Troubleshooting
If XLOOKUP still returns #N/A after checking data types and spaces, sort the lookup column and compare a known value manually. Use =COUNTIF(Sheet2!A:A,A2) to confirm the value exists at all. A result of 0 means the value is genuinely absent or stored differently.
If you see #REF!, the sheet name is wrong or the referenced sheet was deleted. Re-enter the reference by clicking the sheet tab and selecting the range with the mouse; Excel writes the correct syntax for you.
If you see #VALUE!, the array sizes differ or a binary search mode was used on unsorted data. Switch the fifth argument to 1 (linear search) or sort the data.
If the formula works on one row but not others, copy it down and check whether relative references shifted incorrectly. Use absolute references ($A$2:$A$100) where the range should not move.
If the workbook is slow or shows "Calculating" indefinitely, press Ctrl+Shift+Alt+F9 (Windows) to force a full rebuild. On Mac, use Cmd+Shift+Alt+F9 if available, or close and reopen the workbook.
If nothing works, rebuild the formula from scratch in a new cell, clicking each range rather than typing it. This eliminates typos and invisible characters in the formula itself.
Frequently Asked Questions
Why does XLOOKUP return #N/A between sheets when the value clearly exists?
Almost always a data type mismatch or a hidden space. One side is text, the other is a number, or one value has a trailing space. Use ISTEXT, ISNUMBER, and TRIM to compare.
Can XLOOKUP reference a sheet in another workbook?
Yes, but the source workbook must be open, or you must use an external link with the full file path. Closed-workbook references often return #REF! or stale values.
Why does XLOOKUP work on one sheet but not another?
Check the sheet name spelling and whether it contains spaces. Also confirm the second sheet is not protected and that its lookup column is not formatted as text when the lookup value is numeric.
Do the lookup array and return array need to be the same size?
Yes. They must have the same number of rows. Full-column references like A:A and B:B guarantee this.
What does the fourth argument in XLOOKUP do?
It sets the match mode: 0 for exact match, -1 for exact or next smaller, 1 for exact or next larger, 2 for wildcard. Use 0 for most lookups.
Why does XLOOKUP show #NAME? in my workbook?
Your Excel version does not support XLOOKUP. It is available in Microsoft 365, Excel 2021, and Excel 2024, but not in Excel 2019 or earlier.