How to Generate Dynamic Excel References to Other Workbooks
Question details
The user needs to build dynamic formulas that construct external references to other workbooks based on variable inputs like part numbers, file names, worksheet names, and cell locations.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Creating complex spreadsheet models where data needs to be fetched from multiple external files without manually typing and updating each external reference.
- Observed behavior
- Looking for a method to evaluate stitched text strings (constructed from variables) as valid live workbook references.
Ensure that the source workbooks you intend to reference dynamically are saved in a known location and are currently open on your device, as the primary dynamic referencing function requires active files to return values without errors.
Use the INDIRECT Function for Open Workbooks
The INDIRECT function converts text strings into valid cell references, making it the perfect tool for dynamically referencing other open workbooks by combining cell values.
You can use functions like CONCAT, TEXTJOIN, or the ampersand (&) operator to stitch together file names, worksheet names, and cell references into a standard external reference string. The resulting text is then evaluated by INDIRECT.
Enter your target workbook name (e.g., DataFile), worksheet name (e.g., Sheet1), and cell address (e.g., C2) into separate reference cells in your current worksheet (like A2, B2, and C2).
Select the cell where you want the external data to appear. Type the formula combining the text syntax and cell references using the ampersand: =INDIRECT("'["&A2&".xlsx]"&B2&"'!"&C2).
Press Enter to calculate. Ensure the source workbook ('DataFile.xlsx') remains open in the background to allow Excel to fetch the live data successfully.

Use Power Query for Closed Workbooks
Since INDIRECT cannot fetch data from closed workbooks, Power Query is the recommended alternative to safely and dynamically pull external data without opening files.
Effortlessly Manage Dynamic References with WPS Spreadsheet
WPS Spreadsheet offers full support for advanced functions like INDIRECT, CONCAT, and TEXTJOIN, making it simple to build robust dynamic links between multiple workbooks with zero hassle.
- 1. Open your workbooks: Launch WPS Spreadsheet and open both your main working file and the source workbooks you want to link dynamically.
- 2. Input the INDIRECT formula: Click the cell where you need the data, and use the formula bar to construct your dynamic string using =INDIRECT("'["&A2&".xlsx]"&B2&"'!"&C2).
- 3. Press Enter to fetch data: Hit Enter. WPS Spreadsheet will instantly parse the text string and fetch the real-time data from your external workbook.

Frequently Asked Questions
Why is my INDIRECT formula returning a #REF! error?
The most common reason for a #REF! error when using INDIRECT with external references is that the source workbook is closed. The INDIRECT function requires the referenced workbook to be open in the same application instance to successfully evaluate the path and fetch the data.
Can I use the INDIRECT function to reference a closed workbook?
No, the built-in INDIRECT function cannot fetch data from a closed workbook. If you need to pull data from closed files, you should use Power Query, VBA macros, or standard static external links.
What is the exact syntax for dynamically referencing a specific sheet and cell?
The standard static syntax is '[WorkbookName.xlsx]SheetName'!CellAddress. When building this dynamically with INDIRECT, you must concatenate the single quotes, brackets, and exclamation mark exactly as strings, resulting in a formula like: =INDIRECT("'[" & A1 & ".xlsx]" & B1 & "'!" & C1).
How do CONCAT or TEXTJOIN help in building dynamic references?
CONCAT and TEXTJOIN allow you to seamlessly combine multiple text strings and cell references. While simple concatenation with the ampersand (&) works perfectly for basic references, TEXTJOIN is especially useful when you need to merge an array of conditions or include specific delimiters (like slashes or commas) across multiple cells to build a complex path.




