Fix INDEX Formula Returning #N/A Error with Named Ranges in Excel
Question details
The user is experiencing an #N/A error when using an INDEX formula combined with a named range that retrieves file names from a directory.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Attempting to list file names dynamically from a local directory by feeding a named range (often utilizing legacy macro functions) into an INDEX formula.
- Observed behavior
- The formula successfully lists files in some workbooks but unexpectedly returns an #N/A error in a specific workbook.
Verify that the workbook containing the error has macro functionality enabled, as legacy file-fetching functions require macro permissions to read your directory structure.
Enable Macros for Excel 4.0 Legacy Functions
Use this solution if your named range relies on the legacy Excel 4.0 'FILES' macro function, which is often blocked by default security settings.
The legacy FILES function is an older Excel 4.0 macro command used within named ranges to list directory contents. Modern versions of Excel block these macros by default for security reasons. If the macro is blocked, the named range cannot fetch the data, resulting in an #N/A error when wrapped in an INDEX formula.
Navigate to the 'File' tab, click on 'Options' at the bottom left, and select 'Trust Center'. Click the 'Trust Center Settings' button.
In the Trust Center, go to 'Macro Settings'. Check the box for 'Enable Excel 4.0 macros when VBA macros are enabled' and ensure VBA macros are also allowed for this specific trusted workbook.
Ensure that the folder path specified in your named range is accurate and that your user account has read permissions for that directory.

Remove Implicit Intersection Operators
Use this solution if newer Excel versions have automatically added an '@' symbol to your formula, breaking the array behavior.
Replace Legacy Functions with VBA
Use this method to establish a more stable, modern way of extracting file names without relying on deprecated Excel 4.0 features.
Experience Seamless Formula Calculation with WPS Office
If you frequently encounter compatibility issues or errors with complex array formulas and legacy functions in Microsoft Excel, consider trying WPS Office. It provides a lightweight, highly compatible spreadsheet environment that handles data lookups and formulas effortlessly.
- 1. Download and Install: Get the free WPS Office suite from the official website and install it on your device in minutes.
- 2. Open Your Workbook: Launch WPS Spreadsheet and open your existing Excel workbook containing the named ranges and INDEX formulas.
- 3. Calculate Without Hassle: Enjoy smooth calculation and easy-to-navigate formula auditing tools right out of the box.

Frequently Asked Questions
Why does the INDEX function return an #N/A error?
The #N/A error occurs when the INDEX function cannot find the requested value. This typically happens if the row or column number specified exceeds the dimensions of the referenced range, or if the named range itself fails to resolve and fetch data.
What is the Excel 4.0 FILES function?
The FILES function is an obsolete macro command previously used within named ranges to list the contents of a directory. Modern versions of Excel require explicit macro permissions in the Trust Center to allow this function to execute.
How do I fix implicit intersection errors in Excel formulas?
If you notice an '@' symbol automatically inserted into your INDEX formula, it means Excel is enforcing implicit intersection, which can break older array setups. Removing the '@' symbol to revert to standard syntax (e.g., =INDEX(Range, ROW(A2))) often resolves the issue.




