Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Mr Mike
 
Posts: n/a
Default Making a file and worksheet reference into a variable....

I have this formula in cell B1.
=VLOOKUP(A1,[Book1]Sheet1!$A:$M,2,FALSE)

In cell A2, I have a file name/location
In cell A3, I have a worksheet name

I would like to alter this formula so that instead of [book1], it can point
to cell A2 and look for whatever file I type in there. The same with the
worksheet name Sheet1, I'd like it to point to A3 so I can type that in too.

I would do this the standard way, however due to the number of vlookups on
this spreadsheet, I need to be able to type the file name and worksheet name
into these cells, and have all the vlookups adjust accordingly. I know
find/replace does work for that, but only in a permament formula. I need
something variable.

Thanks for your help!


  #2   Report Post  
Bernard Liengme
 
Posts: n/a
Default

Something to get you started:
a) with Sheet2 as text in B3 use =VLOOKUP(A1,INDIRECT(B3&"!A10:B13"),2) to
do a look up of a table on Sheet2
or
b) with the value 2 in B5 use =VLOOKUP(A1,INDIRECT("Sheet"&B5&"!A10:B13"),2)
to do a look up on Sheet2.

Expand on this to incorporate filename.
I think the file must be open for lookup functions to work

best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Mr Mike" wrote in message
...
I have this formula in cell B1.
=VLOOKUP(A1,[Book1]Sheet1!$A:$M,2,FALSE)

In cell A2, I have a file name/location
In cell A3, I have a worksheet name

I would like to alter this formula so that instead of [book1], it can
point
to cell A2 and look for whatever file I type in there. The same with the
worksheet name Sheet1, I'd like it to point to A3 so I can type that in
too.

I would do this the standard way, however due to the number of vlookups on
this spreadsheet, I need to be able to type the file name and worksheet
name
into these cells, and have all the vlookups adjust accordingly. I know
find/replace does work for that, but only in a permament formula. I need
something variable.

Thanks for your help!




  #3   Report Post  
Bob Phillips
 
Posts: n/a
Default


"Bernard Liengme" wrote in message
...

Expand on this to incorporate filename.
I think the file must be open for lookup functions to work


For INDIRECT Bernard....


  #4   Report Post  
Mr Mike
 
Posts: n/a
Default

Worked great! Thank you for introducing me to that function.

"Bernard Liengme" wrote:

Something to get you started:
a) with Sheet2 as text in B3 use =VLOOKUP(A1,INDIRECT(B3&"!A10:B13"),2) to
do a look up of a table on Sheet2
or
b) with the value 2 in B5 use =VLOOKUP(A1,INDIRECT("Sheet"&B5&"!A10:B13"),2)
to do a look up on Sheet2.

Expand on this to incorporate filename.
I think the file must be open for lookup functions to work

best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Mr Mike" wrote in message
...
I have this formula in cell B1.
=VLOOKUP(A1,[Book1]Sheet1!$A:$M,2,FALSE)

In cell A2, I have a file name/location
In cell A3, I have a worksheet name

I would like to alter this formula so that instead of [book1], it can
point
to cell A2 and look for whatever file I type in there. The same with the
worksheet name Sheet1, I'd like it to point to A3 so I can type that in
too.

I would do this the standard way, however due to the number of vlookups on
this spreadsheet, I need to be able to type the file name and worksheet
name
into these cells, and have all the vlookups adjust accordingly. I know
find/replace does work for that, but only in a permament formula. I need
something variable.

Thanks for your help!





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I export a worksheet as a fixed format ascii file SVANATTA65 Excel Discussion (Misc queries) 2 June 16th 05 11:49 PM
Reference a cell on another worksheet in the same spreadsheet file Dave Excel Discussion (Misc queries) 3 May 17th 05 08:55 PM
how do i create and save a new file or worksheet autmatically ever DAN Excel Discussion (Misc queries) 0 March 30th 05 03:07 PM
Empty Workseek: File still too large (>300k) Anik Excel Discussion (Misc queries) 2 March 16th 05 06:21 PM
worksheet tab name as part of a cell reference cwee Excel Worksheet Functions 4 February 10th 05 04:37 PM


All times are GMT +1. The time now is 01:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"