Return column header by searching multiple rows with same header

aniruddhm

New Member
Joined
Sep 10, 2015
Messages
3
Hello! Need the help of an expert on Index-Match.

The task at hand is to return the column header, based on the row header and its value in the row.


Z1Z2Z3
S1QRA
S1WTB
S1EYC
S2RQJ
S2TWK
S2YEL
S3AJQ
S3BKW
S3CLE

<tbody>
</tbody>


Please note a value can only appear once in the S1/S2/S3 section, and only once under Z1/Z2/Z3, in case that is helpful.

From the above table, I want to return the column header based on the row. For example: For the following table (with column 1 and row 1 given - shown in bold), I want it to populate as below (the Z values):

S1S2S3
QZ1Z2Z3
RZ2Z1-

<tbody>
</tbody>


Essentially, if the bolded values are given, I want to return the Z values (i.e. column headers) based on the previous table.

I would really appreciate if you could help me out with this.

Thanks in advance!!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Row\Col
A​
B​
C​
D​
E​
F​
G​
H​
I​
1​
Z1Z2Z3S1S2S3
2​
S1QRAQZ1Z2Z3
3​
S1WTBRZ2Z1-
4​
S1EYC
5​
S2RQJ
6​
S2TWK
7​
S2YEL
8​
S3AJQ
9​
S3BKW
10​
S3CLE

G2, copied across and down:
Rich (BB code):

=IFERROR(INDEX($B$1:$D$1,MIN(IF(IF(IF($B$2:$D$10=$F2,
    $A$2:$A$10)=IF(G$1="","",G$1),$B$1:$D$1,"")=$B$1:$D$1,
    COLUMN($B$1:$D$1)-COLUMN($B$1)+1,9.99999999999999E+307))),"-")
 
Upvote 0
Thanks a lot for your taking time to help Aladin. Unfortunately, when I am using this formula (in the exact syntax prescribed) it is returning "-" in all cells.

Is it simpler if the formula doesn't need to return a "-" when no result is found, a simple blank cell would work as well.

Let me know if you can help further.

Thanks again! I really appreciate it.
 
Upvote 0
Thanks a lot for your taking time to help Aladin. Unfortunately, when I am using this formula (in the exact syntax prescribed) it is returning "-" in all cells.

Is it simpler if the formula doesn't need to return a "-" when no result is found, a simple blank cell would work as well.

Let me know if you can help further.

Thanks again! I really appreciate it.

You need to confirm the formula with control+shift+enter, not just enter. then copy across and down.

Control+shift+enter means: Press down the control and the shift keys at the same time while you hit the enter key.
 
Upvote 0

Forum statistics

Threads
1,216,219
Messages
6,129,579
Members
449,519
Latest member
Rory Calhoun

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