olliesouth
New Member
- Joined
- Aug 1, 2019
- Messages
- 2
Hello - I am hitting the common INDIRECT snag where a #REF error is generated if the file is not open - and I have to use an INDIRECT because there are a great number of dynamic variables in the file paths in question.
I am hoping the fix here is to have excel open all the files in question (it's a lot - currently 364 CSV files) so that the INDIRECT formulas all populate a result, and then have excel close them all again when done (I've noticed if you open the file then close it, the INDIRECT result will remain in place until the next time you update a cell and it attempts to re-calculate).
At the moment the files to open are all in a sheet called FilePaths (range D3:P30 but that range should be easily expanded / reduced), and each cell looks something like this :
Formula : ="'C:\Sales"&D$2&"_excel"&$B3&"\["&$C3&"_"&TEXT($A3+1,"yyyymmdd")&".csv]"&$C3&"_"&TEXT($A3+1,"yyyymmdd")&"'!$A$1"
Result : 'C:\Sales\Client1_excel\wraps\[wrap_20190716.csv]wrap_20190716'!$A$1
Then on a second sheet called Results is just an INDIRECT formula linking to the same cell on the FilePaths sheet. For example, Results!D3 contains =INDIRECT(FilePaths!D3)
Hope that's clear! Would really appreciate your help on this!
I am hoping the fix here is to have excel open all the files in question (it's a lot - currently 364 CSV files) so that the INDIRECT formulas all populate a result, and then have excel close them all again when done (I've noticed if you open the file then close it, the INDIRECT result will remain in place until the next time you update a cell and it attempts to re-calculate).
At the moment the files to open are all in a sheet called FilePaths (range D3:P30 but that range should be easily expanded / reduced), and each cell looks something like this :
Formula : ="'C:\Sales"&D$2&"_excel"&$B3&"\["&$C3&"_"&TEXT($A3+1,"yyyymmdd")&".csv]"&$C3&"_"&TEXT($A3+1,"yyyymmdd")&"'!$A$1"
Result : 'C:\Sales\Client1_excel\wraps\[wrap_20190716.csv]wrap_20190716'!$A$1
Then on a second sheet called Results is just an INDIRECT formula linking to the same cell on the FilePaths sheet. For example, Results!D3 contains =INDIRECT(FilePaths!D3)
Hope that's clear! Would really appreciate your help on this!