Vlookup and named ranges

Master_G

New Member
Joined
May 3, 2011
Messages
6
I have a number of named ranges and am trying to use a drop down box combined with a vlookup to pull data from them.

So if the ranges are "Test1", "Test2" and "Test3", the drop down box is cell C1, my vlookup is:

=VLOOKUP(A2,INDIRECT(C1),3)

This gives me a #REF! error.

In testing this I have put "Test1" in place for INDIRECT(C1) and this works, I have tried a named range on the same sheet and that works, but the named ranges referring to other sheets just REF out.

Any ideas?

G
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Welcome to the board...

How are the named ranges defined?

If the named ranges are "dynamic", using offset or something of the like..
Then it won't work with Indirect.

To use named ranges in Indirect, those named ranges must be Static.
 
Upvote 0
Ah, yes they are dynamic named ranges which would explain why it won't work.

In that case, is there any way I could achieve this?

G
 
Upvote 0
Let's talk about REAL situation, not example Test1 Test2 etc...

How many named ranges are there, and what are the actual names?

You might do something like

VLOOKUP(A2,IF(C1="Test1",Test1,IF(C1="Test2",Test2)),3)
 
Upvote 0
If at all possible I would like to avoid solving it through nesting - there will only be 6 named ranges at the moment but this number will increase as the sheet is used and I would like to make this sheet as dynamic as possible.

At the moment the actual ranges are Test1, Test2, Test3!

This will change at the final revision when I drop the real data in but at the moment am just using non-real datasets to test the sheet as the real datasets are pretty big and clumsy to test with.

G
 
Upvote 0
I think your only options are...

1. Nesting the ranges per previous example (other methods avaliable too)
2. Use Static Ranges, but oversize them by 10% or so to accomidate fluxuating data.
3. Use VBA Scripts to ReCreate the named ranges on the fly as the data is updated.
 
Upvote 0
Thanks for your replies, I think for the moment I will go down the static range route, my understanding is the ranges shouldn't change too much so I will see if that is acceptable to the users, if not I will go down the macro route.

Many many thanks for your help :)

G
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

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