using hlookup to reference a column in a vlookup formula?


J

joemeshuggah

i am looking to have a specific spreadsheet reference a second sheet that is
variable daily in both rows and columns...a vlookup takes care of the rows,
but since the number of columns and/or column order may change, i cannot
hardcode the column index number in the vlookup formula.


i thought i could use a vlookup formula where the column referenced is based
on a column and hlookup function...i tried the following, but received an
error message:

=vlookup(a2,myrange,column(hlookup(b1,myrange,1,false)),false)

is there a way to accomplish this?
 
Ad

Advertisements

P

Peo Sjoblom

=INDEX(MyRange,MATCH(A2,INDEX(MyRange,,1),0),MATCH(B1,INDEX(MyRange,1,),0))


a a1 a2 a3 a4
b 20 30 40 50
c 15 10 5 4
d 80 70 90 150

assume the above table called MyRange

you have c in A2 and a3 in B1 and you want to return
number 5 basically where the intersection of those 2 is

Of course if the table was D2:H5 you could use


=INDEX(D2:H5,MATCH(A2,D2:D5,0),MATCH(B1,D2:H2,0))


if you have a named range like MyRange and use that in the formula you would
need the extra INDEX



--


Regards,


Peo Sjoblom
 
Ad

Advertisements

J

joemeshuggah

Thanks!!!!!

Peo Sjoblom said:
=INDEX(MyRange,MATCH(A2,INDEX(MyRange,,1),0),MATCH(B1,INDEX(MyRange,1,),0))


a a1 a2 a3 a4
b 20 30 40 50
c 15 10 5 4
d 80 70 90 150

assume the above table called MyRange

you have c in A2 and a3 in B1 and you want to return
number 5 basically where the intersection of those 2 is

Of course if the table was D2:H5 you could use


=INDEX(D2:H5,MATCH(A2,D2:D5,0),MATCH(B1,D2:H2,0))


if you have a named range like MyRange and use that in the formula you would
need the extra INDEX



--


Regards,


Peo Sjoblom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top