logo
search
Function Problems

How to Fix XLOOKUP #NAME? Error with Dynamic Formula References

Camila MilosovichCamila Milosovich Oct 1, 2026 869 views

Question details

The user needs to fix an XLOOKUP formula that fails to recognize dynamically built cell references and returns a #NAME? error.

How to Fix XLOOKUP Returning a #NAME? Error with Formula-Based References
Product
Spreadsheet
Device & OS
not provided
Scenario
Attempting to perform an XLOOKUP search across different worksheets where the target sheet name or lookup array is dynamically generated from another cell's formula.
Observed behavior
The formula fails to evaluate the constructed text as a valid range, returning a #NAME? error instead of looking up the intended data.
Before you start

Verify that your current spreadsheet software version supports the XLOOKUP function, as opening a workbook with XLOOKUP in older versions will automatically result in a #NAME? error regardless of formula syntax.

Solution 1Recommended

Wrap Dynamic References with the INDIRECT Function

Use the INDIRECT function to convert concatenated text strings into valid worksheet and cell references that XLOOKUP can process.

When you build a range reference dynamically using the ampersand (&) operator, the spreadsheet reads it as a standard text string, not a usable range. This causes lookup functions to fail. Wrapping the text string in the INDIRECT function forces the software to evaluate the text as an actual cell or range reference.

1
Identify the dynamic text strings

Locate the portion of your XLOOKUP formula that dynamically builds the sheet name. For example, if cell C19 contains the sheet name, your string might look like "'"&C19&"'!$I3:$I33".

2
Apply INDIRECT to the lookup array

Wrap the constructed text for the lookup array in the INDIRECT function. Type INDIRECT("'"&C19&"'!$I3:$I33").

3
Apply INDIRECT to the return array

Similarly, wrap the return array reference in the INDIRECT function. Type INDIRECT("'"&C19&"'!$E3:$E33").

4
Construct the final XLOOKUP formula

Combine these elements into your XLOOKUP formula. Enter =XLOOKUP(1,INDIRECT("'"&C19&"'!$I3:$I33"),INDIRECT("'"&C19&"'!$E3:$E33"),"-",0,1) and press Enter.

Wrap Dynamic References with the INDIRECT Function
Sheet Naming Syntax: Always include the single quotation marks ("'") around your dynamic sheet name reference in the formula to ensure the reference works correctly even if the target worksheet name contains spaces.
Resolve Formula Errors Seamlessly

Use WPS Spreadsheet for Advanced Lookup Functions

WPS Office fully supports advanced dynamic array functions like XLOOKUP and INDIRECT out of the box. Its powerful calculation engine ensures that your complex, formula-based dynamic references work smoothly across all your reports.

  1. 1. Open your spreadsheet: Launch WPS Spreadsheet and open the workbook containing the #NAME? error.
  2. 2. Locate the error: Select the cell with the broken XLOOKUP formula and click into the formula bar at the top.
  3. 3. Wrap with INDIRECT: Modify your concatenated text references by typing INDIRECT() around them.
  4. 4. Evaluate the formula: Press Enter to execute the corrected formula and retrieve the correct dynamic data.
Native support for XLOOKUP, INDIRECT, and modern dynamic arrays.100% compatibility with Microsoft Excel formulas and .xlsx file formats.Built-in formula evaluation tools to easily spot syntax issues or reference errors.Free to use with a lightweight installation and familiar user interface.
microsoft office alternative - wps office

Frequently Asked Questions

Why does XLOOKUP return a #NAME? error even when I'm not using dynamic references?

A #NAME? error typically occurs if there is a typo in the function name itself (for example, typing XLOOKP instead of XLOOKUP), or if you are using an older version of the spreadsheet software that does not recognize the XLOOKUP function.

Can I use INDIRECT with XLOOKUP across closed workbooks?

No, the INDIRECT function requires the referenced external workbook to be actively open in your spreadsheet application. If the target workbook is closed, INDIRECT will return a #REF! error, which subsequently causes the XLOOKUP function to fail.

What does the "0,1" at the end of the XLOOKUP formula mean?

In the formula =XLOOKUP(..., 0, 1), the '0' specifies the match mode, meaning it will look for an exact match. The '1' specifies the search mode, instructing the function to search from the first item to the last item in the array.