Formula Errors

Fix Excel XLOOKUP #REF! Errors with a Closed External Workbook

Camila MilosovichCamila Milosovich Dec 2, 2026 868 views

Question details

Fix an XLOOKUP formula that returns #REF! when its external source workbook is closed.

Fix Excel XLOOKUP #REF! Errors with a Closed External Workbook
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.
Before you start

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.

Solution 1Recommended

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.

1
Find the source ranges

In the source workbook, open the sheet containing the table and note the cell ranges for the lookup and return columns, excluding headers.

2
Edit the XLOOKUP formula

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.

3
Check the range sizes

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.

4
Test the closed workbook

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.

Replace external table references with fixed cell ranges
Fixed ranges do not expand automatically: Update both ranges when new source rows fall outside the referenced cells. External link behavior can also vary by Excel version.
Free Microsoft Office alternative

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.

Work with lookup formulas in WPS SpreadsheetsOpen and edit Microsoft Excel XLSX filesNavigate spreadsheets with a familiar interfaceUse a free, lightweight Office alternative
microsoft office alternative - wps office

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.