Fix Excel XLOOKUP #REF! Errors with a Closed External Workbook
Question details
Fix an XLOOKUP formula that returns #REF! when its external source workbook is closed.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A formula looks up values in a table stored in another workbook.
- Observed behavior
- XLOOKUP returns #REF! when the source workbook is closed and the formula uses external structured table references.
Open both workbooks and identify the source sheet and the columns used for the lookup and return values. Confirm that the source workbook is saved at the path used by the formula.
Replace external table references with fixed cell ranges
Use ordinary cell ranges instead of external structured references when the source workbook needs to remain closed.
In the source workbook, open the sheet containing the table and note the cell ranges for the lookup and return columns, excluding headers.
In the destination workbook, select the formula cell and use the formula bar to replace the external table references with fixed cell ranges. For example: =XLOOKUP([@Metric],'D:\Estimating\[Steel Weight Table.xlsx]Sheet1'!$A$2:$A$500,'D:\Estimating\[Steel Weight Table.xlsx]Sheet1'!$K$2:$K$500,"Not found"). Replace the path, file name, sheet name, and ranges with your own.
In the formula bar, confirm that the lookup and return ranges cover the same rows. Expand both ranges if the source data extends beyond the selected rows.
Save and close the source workbook, then recalculate the destination workbook using Formulas > Calculate Now. If the error remains, check the external file path and sheet name in the formula.

Import the source data with Power Query
Use Power Query to load the source data into the destination workbook and look it up locally.
Work with lookup spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Microsoft Office format compatibility for an easier transition. Use WPS Spreadsheets to work with lookup formulas, but test external workbook links because compatibility may vary.

Frequently Asked Questions
Why does XLOOKUP return #REF! only when the source workbook is closed?
External structured table references may not work reliably with a closed workbook in every Excel version. Try replacing them in the formula bar with ordinary cell ranges.
Do the lookup and return ranges need to be the same size?
Yes. For vertical ranges, use the same number of rows in both arrays, such as $A$2:$A$500 and $K$2:$K$500.
Will the XLOOKUP “Not found” argument prevent a #REF! error?
No. The if_not_found argument handles a missing lookup match; it does not repair an invalid external reference.
How do I update data imported with Power Query?
Choose Data > Refresh All in the destination workbook. The source file must be accessible at the location used by the query.




