How to Fix XLOOKUP #NAME? Error with Dynamic Formula References
Question details
The user needs to fix an XLOOKUP formula that fails to recognize dynamically built cell references and returns a #NAME? error.

- 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.
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.
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.
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".
Wrap the constructed text for the lookup array in the INDIRECT function. Type INDIRECT("'"&C19&"'!$I3:$I33").
Similarly, wrap the return array reference in the INDIRECT function. Type INDIRECT("'"&C19&"'!$E3:$E33").
Combine these elements into your XLOOKUP formula. Enter =XLOOKUP(1,INDIRECT("'"&C19&"'!$I3:$I33"),INDIRECT("'"&C19&"'!$E3:$E33"),"-",0,1) and press Enter.

Correct Dynamic Date String Generation
Ensure that the dynamic text generating worksheet names based on dates perfectly matches the actual sheet tab names without syntax errors.
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. Open your spreadsheet: Launch WPS Spreadsheet and open the workbook containing the #NAME? error.
- 2. Locate the error: Select the cell with the broken XLOOKUP formula and click into the formula bar at the top.
- 3. Wrap with INDIRECT: Modify your concatenated text references by typing INDIRECT() around them.
- 4. Evaluate the formula: Press Enter to execute the corrected formula and retrieve the correct dynamic data.

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.




