Vlookup

superfb

Active Member
Joined
Oct 5, 2011
Messages
251
Office Version
  1. 2007
Platform
  1. Windows
Hi guys,

i was wondering, if its possible to alter the elements in the vlookup formula based on a cell

vlookup formula
='[Total Table 45.5 Car Rental Place - Gross 2021.xls]All'!$C$6

Is it possible to change the year via if i have a cell, so if in cell A3 i change it to 2015 will this part of the formula will automatically change to ............Gross 2021.xls]

Be interesting to get some idea is possible?

thanks
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Upvote 0
Hi Superfb,

Yes, by using INDIRECT but those sheets will also need to be open in Excel or you will get a #REF! error.

Cell Formulas
RangeFormula
B2:B4B2=INDIRECT("'[Total Table 45.5 Car Rental Place - Gross "&A2&".xls]Sheet1'!$C$6")
Hi thank you for the reply, unfortunately i want to avoid opening the spreadsheets if possible otherwise will be confusing for the end user!
 
Upvote 0
Upvote 0
To link to an external workbook using a "variable" you will need to use Indirect, so you have a choice.
a) hardcode the entire workbook/sheet name, which works on closed workbooks.
b) use a cell as a variable along with indirect & have those workbooks open.
 
Upvote 0
Hi Superfb,

Yes, by using INDIRECT but those sheets will also need to be open in Excel or you will get a #REF! error.

Cell Formulas
RangeFormula
B2:B4B2=INDIRECT("'[Total Table 45.5 Car Rental Place - Gross "&A2&".xls]Sheet1'!$C$6")
I guess if i have a macro to open the list of filebooks in col h, and then closed - this would hugely compliment this
 
Upvote 0
To link to an external workbook using a "variable" you will need to use Indirect, so you have a choice.
a) hardcode the entire workbook/sheet name, which works on closed workbooks.
b) use a cell as a variable along with indirect & have those workbooks open.
Is it possible to have the file name in the formula to be cell referenced?
 
Upvote 0
Only with indirect, which means the other workbook must be open.
 
Upvote 0
Only with indirect, which means the other workbook must be open.
Im beginning to understand the importance of keeping the workbook open, as otherwise it goes to Ref error......

=INDIRECT("'["&q2& "&F3&".xls]All'!$D$6")

When i try and make the file name a variable it highlights this bit ".xls]All'

Am i missing something obvious?
 
Upvote 0

Forum statistics

Threads
1,214,981
Messages
6,122,565
Members
449,089
Latest member
Motoracer88

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