Why doesn't this vlookup formula using the indirect function work?
-
25-05-2021 - |
Question
I am using VLOOKUP
but rather than hardcode a reference to the file's location I want to use the INDIRECT
function to reference the file's location. However, my attempt at it doesn't work. What's wrong with this?
=VLOOKUP(A2, INDIRECT(A1)$A$2:$B$1000,2,FALSE)
Where cell A1 contains:
C:\Documents and Settings\User\Desktop\[ABC.xlsm]Sheet1
I get the error: The formula you typed contains an error.
Am I missing something?
Solution
You need a syntax like this
=VLOOKUP(A2,INDIRECT("'"&A1&"'!$A$2:$B$1000"),2,FALSE)
....but note that INDIRECT won't work if the source workbook is closed
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow