ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Vlookup in vlookup - taking the result as array name (https://www.excelbanter.com/excel-worksheet-functions/144854-vlookup-vlookup-taking-result-array-name.html)

SupperDuck

Vlookup in vlookup - taking the result as array name
 
Hello all,

I have an array called "months" and for ex. it has the values;

1 Jan
2 Feb
3 Mar

And i have 12 arrays named: Jan, Feb... And the arrays has values, for ex;

Array Jan:
prt1 2
prt2 3
prt3 5

Array Feb:
prt1 6
prt2 4
prt3 2


I want to do this;

=vlookup("prt1", vlookup(1, months, 2, 0), 2, 0)

So, it will look for prt1 in array Jan and have a result as 2.

As you see, i want to use the result in the second vlookup as the name of
the array for the first vlookup.

I can do this in a macro but i wonder how i can do this in a formula?

Thanks & regards,

Duke Carey

Vlookup in vlookup - taking the result as array name
 
It looks like you simply need to wrap the inner VLOOKUP with an INDIRECT

=vlookup("prt1",INDIRECT( vlookup(1, months, 2, 0)), 2, 0)

"SupperDuck" wrote:

Hello all,

I have an array called "months" and for ex. it has the values;

1 Jan
2 Feb
3 Mar

And i have 12 arrays named: Jan, Feb... And the arrays has values, for ex;

Array Jan:
prt1 2
prt2 3
prt3 5

Array Feb:
prt1 6
prt2 4
prt3 2


I want to do this;

=vlookup("prt1", vlookup(1, months, 2, 0), 2, 0)

So, it will look for prt1 in array Jan and have a result as 2.

As you see, i want to use the result in the second vlookup as the name of
the array for the first vlookup.

I can do this in a macro but i wonder how i can do this in a formula?

Thanks & regards,


SupperDuck

Vlookup in vlookup - taking the result as array name
 
Wonderful! That was what i need..

Thanks,

Regards,

"SupperDuck" wrote:

Hello all,

I have an array called "months" and for ex. it has the values;

1 Jan
2 Feb
3 Mar

And i have 12 arrays named: Jan, Feb... And the arrays has values, for ex;

Array Jan:
prt1 2
prt2 3
prt3 5

Array Feb:
prt1 6
prt2 4
prt3 2


I want to do this;

=vlookup("prt1", vlookup(1, months, 2, 0), 2, 0)

So, it will look for prt1 in array Jan and have a result as 2.

As you see, i want to use the result in the second vlookup as the name of
the array for the first vlookup.

I can do this in a macro but i wonder how i can do this in a formula?

Thanks & regards,



All times are GMT +1. The time now is 06:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com