Lookup in other workbook goes #REF! when closed

Leandrial

Board Regular
Joined
Oct 9, 2012
Messages
78
Hi


im trying to do a lookup in a list found in other workbook.


The workbookname is a variable, in this example "Test3720.xlsm"

When i write the function with the workbookname "hardtyped", it work fine, with the searched woorkbook both opened and closed... the code goes like this

Code:
=VLOOKUP(C2;'C:\Test\Test3720.xlsm'!lNettoPriser;2;FALSE)


But when i try to replace the workbookname with a variable found in a cell (the "Test3720" part of the string), like this

Code:
=VLOOKUP(C2;INDIRECT("'C:\Test\" & C4 & ".xlsm'!lNettoPriser");2;FALSE)

(the value of cell C4 is ofc "Test3720"), then it all of a sudden works fine when the workbook "Test3720.xlsm" is open... but when closed the return of my function turns to #REF !



Why is that?? Any1 that knows? And anything i can do to make the function also work so it can search data in closed workbooks??


Best regards


Kasper
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Thank you Smitty


Im going work around this with a change in the dataflow, so to speak... im gonna put the needed data in a spreadsheet that will need to be open anyway :)



Best regards


Kasper
 
Upvote 0
You really ought to know them by now, but please read the forum rules on cross-posting and follow them in future. Thank you. :)
 
Upvote 0

Forum statistics

Threads
1,215,762
Messages
6,126,738
Members
449,334
Latest member
moses007

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