External sheetname variable in VLOOKUP

artaries

New Member
Joined
Jun 9, 2017
Messages
9
Hi

I've googled for hours for a solution on this, but couldn't find anything that seems sustainable.

In a given cell in Workbook 1 I have the following string:

=VLOOKUP($D$2,'[SBE.XLSM]KPI 2017'!$A$9:$AC$20,COLUMN(B$9:B$19),FALSE)

Both filename and sheetname should be a variable based on values of two different cells in Workbook 1 [A6 for Sheetname and A8 for Filename). The whole thing should work, even if the external file is closed.

Anyone?!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try

=VLOOKUP($D$2,INDIRECT("'["&A8&".XLSM]"&A6&"'!$A$9:$AC$20"),COLUMN(B$9:B$19),FALSE)

I dont know if this will work on closed workbooks though.
 
Last edited:
Upvote 0
Try

=VLOOKUP($D$2,INDIRECT("'["&A8&".XLSM]"&A6&"'!$A$9:$AC$20"),COLUMN(B$9:B$19),FALSE)

I dont know if this will work on closed workbooks though.


It doesn't. I already tried that and it works fine with an open workbook, but not otherwise.

An alternative I was thinking about, but don't know if it's possible, would be to use some kind of placeholder for filename and sheetname and upon entering a date in D2 it would trigger a find/replace across the range of cells that include the VLOOKUP. This find/replace could be a button as well.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top