IronPhoenix
New Member
- Joined
- Aug 11, 2023
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
What is a working version of this?
=INDIRECT("'"&Common!$N$5&$B4&"_file.xlsx'!XYZ")
Common!N5 has the relative path of the file to read. B4 has part of the filename, and XYZ is a named cell inside the file indicated. This gets a "#REF!" error.
It still gets a #REF! error when all variables are removed and the entire relative pathname is specified directly: =INDIRECT("'Path\ToFile\ABC_file.xlsx'!XYZ")
However, if I use an absolute pathname (starting at the drive letter - like 'D:\Direct\Path\ToFile\ABC_file.xlsx'!XYZ ) instead of the relative path method shown above, it works, both with specifying the full name directly or in the initial format where parts of the pathname are in other cells. But it only works if the target file is also open.
To be clear, the file identified in the formula is not the file that contains the formula.
How do I get this to work without absolute pathnames (the data exists on different networks where the path is not the same) and without opening the hundred or so files I want to reference like this every time I open the parent workbook?
I'd prefer to avoid PowerQuery, but if that's the only answer, please be very explicit on how to apply it. Kindly assume I know nothing of it (which is the case).
Thank you!
=INDIRECT("'"&Common!$N$5&$B4&"_file.xlsx'!XYZ")
Common!N5 has the relative path of the file to read. B4 has part of the filename, and XYZ is a named cell inside the file indicated. This gets a "#REF!" error.
It still gets a #REF! error when all variables are removed and the entire relative pathname is specified directly: =INDIRECT("'Path\ToFile\ABC_file.xlsx'!XYZ")
However, if I use an absolute pathname (starting at the drive letter - like 'D:\Direct\Path\ToFile\ABC_file.xlsx'!XYZ ) instead of the relative path method shown above, it works, both with specifying the full name directly or in the initial format where parts of the pathname are in other cells. But it only works if the target file is also open.
To be clear, the file identified in the formula is not the file that contains the formula.
How do I get this to work without absolute pathnames (the data exists on different networks where the path is not the same) and without opening the hundred or so files I want to reference like this every time I open the parent workbook?
I'd prefer to avoid PowerQuery, but if that's the only answer, please be very explicit on how to apply it. Kindly assume I know nothing of it (which is the case).
Thank you!