Home » excel » excel – using filename in vlookup

excel – using filename in vlookup

Posted by: admin May 14, 2020 Leave a comment

Questions:

I am trying to find a non-vba solution for getting a value via vlookup. The vlookup should use the sheet name as the search criteria. The sheet name format is “00000”

=VLOOKUP(N1;[otherfilename.xlsx]othersheetname!$A$3:$C$10000;3;false)

when writing “12345” into Cell N1 it work perfectly fine
when writing in Cell N1:

=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]", CELL
("filename",A1))-FIND("[",CELL("filename",A1))-6)

the Cell returns also “12345” but VLOOKUP does not work anymore.

Why is this different to straight putting a value into the Cell?
How do I solve this?

Solution:
Wrapping VALUE() around MID()

How to&Answers:

If you want to reference the location that is generated from string you should use INDIRECT() like this:

=INDIRECT("[otherfilename.xlsx]othersheetname!$A$3:$C$10000")

This will return values from the range in desired sheets.