bumedoc
bumedoc

Reputation: 79

How to use a variable name for a range in excel

Is there a way of using a variable for a range name?

For example I have data for a number of days. I am using VLOOKUP(5,_day12,3) to pull some info from the table for day 12. I need to set _day12 to another already defined range like _day19, by replacing _day12 by a variable, let's call it Range which is in cell A1. So the formula should be something like VLOOKUP(5,Range,3). I set the content of cell A1 to _day12 and got #NA. How can this be done?

Upvotes: 2

Views: 3713

Answers (1)

Siddharth Rout
Siddharth Rout

Reputation: 149295

Yes. Use INDIRECT

=VLOOKUP("aaa",INDIRECT(C5),1,0)

Where C5 stores the table name.

enter image description here

Upvotes: 3

Related Questions