Forum Discussion
dbuenolivecom
Sep 12, 2022Copper Contributor
Formula with variable path part
I would like to create a formula where I could define the variable location: example: =C:\test\variable \[gov.xlsb]Results'!D4 where variable can define the path in another cell for example
NikolinoDE
Sep 12, 2022Gold Contributor
maybe with the formula...
=INDIRECT("[" & A1 & ".xls]Table1!B2")
A1 contains the file name and B2 contains the data required by the file....
Unfortunately, this only works if the target workbook is also open.
You cannot pass an entire file path to the INDIRECT function.
However, you can prevent errors with the help of the IFERROR function.
Otherwise, I see no way to do this without an open workbook.
If it could be possible then I think with VBA…but I’m not sure.