Lookup based on Column AND Row

ablazes

Board Regular
Joined
Feb 14, 2005
Messages
65
Hi,

Is there a way to create a Lookup function that references the headings of both, columns and rows?

For example, if my columns have names of spcific machines and in my rows, I have the teams that sold them, (data is the number of machines sold by a specific team) is there a way to for me to look what team sold what machine?

..............MACH1.............MACH2.............MACH5
team_a.........5........................20......................12
team_b.........14.......................2.......................0
team_l..........8........................70......................8

Thanks.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Use Index and Match.

=Index($A$1:$C$4,MATCH(X1,$A$1:$A$4,0),MATCH(Y1,$A$1:$C$1,0)),

WHERE $A$1:$C$4 is the range of the whole table,
X1 houses the team name, you can replace this with actual name in quotes.
Y1 houses the machine name, you can replace this with actual name in quotes.

Change ranges and cell references to suit.

Note. If your table expands, you will have to adjust the upper limits of each of the Match functions to suit also.
 
Upvote 0
ablazes said:
Hi,

Is there a way to create a Lookup function that references the headings of both, columns and rows?

For example, if my columns have names of spcific machines and in my rows, I have the teams that sold them, (data is the number of machines sold by a specific team) is there a way to for me to look what team sold what machine?

..............MACH1.............MACH2.............MACH5
team_a.........5........................20......................12
team_b.........14.......................2.......................0
team_l..........8........................70......................8

Thanks.

=INDEX($B$2:$D$4,MATCH(Team,$A$2:$A$4,0),MATCH(Machine,$B$1:$D$1,0))
 
Upvote 0
Aladin Akyurek said:
ablazes said:
Hi,

Is there a way to create a Lookup function that references the headings of both, columns and rows?

For example, if my columns have names of spcific machines and in my rows, I have the teams that sold them, (data is the number of machines sold by a specific team) is there a way to for me to look what team sold what machine?

..............MACH1.............MACH2.............MACH5
team_a.........5........................20......................12
team_b.........14.......................2.......................0
team_l..........8........................70......................8

Thanks.

=INDEX($B$2:$D$4,MATCH(Team,$A$2:$A$4,0),MATCH(Machine,$B$1:$D$1,0))

I don't see how mine is wrong.
 
Upvote 0
NBVC said:
I don't see how mine is wrong.

The values to be returned are in B2:D4, not A1:C4

The teams to match are in A2:A4 not A1:A4

Machines to match are in B1:D1 not A1:C1
Book2
ABCD
1Mach 1Mach 2Mach 3
2Team_A52012
3Team_B1420
4Team_C87080
Sheet1
 
Upvote 0
NBVC said:
I don't see how mine is wrong.

The values to be returned are in B2:D4, not A1:C4

The teams to match are in A2:A4 not A1:A4

Machines to match are in B1:D1 not A1:C1
Book2
ABCD
1Mach 1Mach 2Mach 3
2Team_A52012
3Team_B1420
4Team_C87080
Sheet1
 
Upvote 0
The OP was made aware to change ranges to suit his/her specific needs. No specific ranges were given, therefore the range I chose was a sample only to demonstrate the formula.

WHERE $A$1:$C$4 is the range of the whole table,
X1 houses the team name, you can replace this with actual name in quotes.
Y1 houses the machine name, you can replace this with actual name in quotes.

Change ranges and cell references to suit.

Note. If your table expands, you will have to adjust the upper limits of each of the Match functions to suit also.
 
Upvote 0
Aladin,

is the INDEX/MATCH/MATCH construction more efficient than using VLOOKUP(or even HLOOKUP) and MATCH like this?

=VLOOKUP(Team,$A$2:$D$4,MATCH(Machine,$B$1:$D$1,0)+1,0)
 
Upvote 0
barry houdini said:
Aladin,

is the INDEX/MATCH/MATCH construction more efficient than using VLOOKUP(or even HLOOKUP) and MATCH like this?

=VLOOKUP(Team,$A$2:$D$4,MATCH(Machine,$B$1:$D$1,0)+1,0)

Yes, somewhat. There are other considerations though... Like: VLOOKUP formulas often refer to the return range by hard-coded column numbers. INDEX/MATCH and LOOKUP, which are more general, avoid that trap, hence robust.
 
Upvote 0

Forum statistics

Threads
1,206,830
Messages
6,075,113
Members
446,123
Latest member
junkyardforme

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