Using a cell to change the filename reference

rkeithg

New Member
Joined
Apr 9, 2002
Messages
6
I would like to be able to use cell (B1) to change the file name referenced in a lookup formula.

Example: A1 contains a company number "503"

A2 is a lookup from March's sales file =VLOOKUP($A1,'C:ACCTSALES[March.xls]Sheet1'!$A$4:$M$184,2,FALSE)

I would like to replace the [March.xls] with a cell reference within my file so that I can change my lookup by changing "March.xls" to "April.xls".

_________________
Thanks
rkeithg
This message was edited by rkeithg on 2002-04-10 12:13
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hiya

I think you want something like the INDIRECT function. Instead of:

=VLOOKUP($A1,'C:ACCTSALES[March.xls]Sheet1'!$A$4:$M$184,2,FALSE)

Try:


=VLOOKUP($A1INDIRECT(Z1),2,FALSE)

where Z1 contains the text string: 'C:ACCTSALES[March.xls]Sheet1'!$A$4:$M$184

I believe the file needs to be open for this to work however, kind of a big drawback.

Hope that helps somewhat
Adam
 
Upvote 0
On 2002-04-10 12:12, rkeithg wrote:
I would like to be able to use cell (B1) to change the file name referenced in a lookup formula.

Example: A1 contains a company number "503"

A2 is a lookup from March's sales file =VLOOKUP($A1,'C:ACCTSALES[March.xls]Sheet1'!$A$4:$M$184,2,FALSE)

I would like to replace the [March.xls] with a cell reference within my file so that I can change my lookup by changing "March.xls" to "April.xls".

_________________
Thanks
rkeithg
This message was edited by rkeithg on 2002-04-10 12:13

Your formula appears to show typos -- It's probably:

=VLOOKUP($A1,'C:ACCTSALES[March.xls]Sheet1'!$A$4:$M$184,2,FALSE)

Assuming that B1 houses [April.xls], try:

=VLOOKUP($A1,INDIRECT("'C:ACCTSALES"&B1&"Sheet1'!$A$4:$M$184"),2,FALSE)

Aladin
 
Upvote 0

Forum statistics

Threads
1,214,518
Messages
6,119,996
Members
448,935
Latest member
ijat

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