Two-Way Lookup function within named range

Kaiser86

New Member
Joined
Oct 13, 2010
Messages
4
I hope someone can help me out with this, I've been looking all over the net for ages.

I have a table I want to perform a 2-way lookup on. I have given it a name, "Testing", which includes the header, row title, and all the data.

So for example, I have:

A B C D
1 Denmark Finland Norway
2 Mon 5 4 8
3 Tues 6 1 3
4 Wed 5 0 4

VLOOKUP and HLOOKUP functions don't seem to be useful in this case, as they both assume the knowledge of the row or column number you're searching in.

Is there any way to use a formula (without VBA) to search for the intersection of Mon and Finland (result: 4)? I have managed to do so to a certain extent by using INDEX to look for the position of Finland in the range A1:D1, but I would like to stick to the "Testing" name range only if possible.

Any ideas, anyone?
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
I hope someone can help me out with this, I've been looking all over the net for ages.

I have a table I want to perform a 2-way lookup on. I have given it a name, "Testing", which includes the header, row title, and all the data.

So for example, I have:

A B C D
1 Denmark Finland Norway
2 Mon 5 4 8
3 Tues 6 1 3
4 Wed 5 0 4

VLOOKUP and HLOOKUP functions don't seem to be useful in this case, as they both assume the knowledge of the row or column number you're searching in.

Is there any way to use a formula (without VBA) to search for the intersection of Mon and Finland (result: 4)? I have managed to do so to a certain extent by using INDEX to look for the position of Finland in the range A1:D1, but I would like to stick to the "Testing" name range only if possible.

Any ideas, anyone?

Let A1:D4 house the data, named Testing, with the day names in A2:A4 and country names in A1:D1...

F1: Mon

G1: Finland

H1:

=INDEX(Testing,MATCH(F1,INDEX(Testing,0,1),0),MATCH(G1,INDEX(Testing,1,0),0))
 
Last edited:
Upvote 0
Thanks for the reply VoG. However, that's the way I have done it until now.
To implement that version, the row containing the column headers need to be referenced separately from the rest of the table, with the same required for the column containing the row titles.

What I'm looking for is kind of similar to how VLOOKUP works, i.e. it looks up a value in column 1 of a range, and then gets the data from column x of the row. So, my idea is to have a kind of formula which looks up the value in column 1 of "Testing", looks up the value in row 1, again in "Testing", then returns the value of the intersecting cell.

What I have tried to do somewhere on the way is to get the relative row number of the vertical search, get the relative column number of the horizontal search, and use INDEX. But I have failed miserably :(



 
Upvote 0
You, sir, are a genius!
I never knew you can assign a 0 to the row and column number argument in the INDEX function. What does that return, if you don't mind me asking? It just refers to the row or column?

Let A1:D4 house the data, named Testing, with the day names in A2:A4 and country names in A1:D1...

F1: Mon

G1: Finland

H1:

=INDEX(Testing,MATCH(F1,INDEX(Testing,0,1),0),MATCH(G1,INDEX(Testing,1,0),0))
 
Upvote 0
You, sir, are a genius!
I never knew you can assign a 0 to the row and column number argument in the INDEX function. What does that return, if you don't mind me asking? It just refers to the row or column?

INDEX(Testing,0,1)

==>

All cells/rows from column 1 of Testing.


INDEX(Testing,1,0)

==>

First cell from every column of Testing.<!-- / message -->
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,210
Members
448,554
Latest member
Gleisner2

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