Search data within table and return the column header

winfs

New Member
Joined
Aug 21, 2018
Messages
2
Hi

I am trying to search a data within a table and return the header of the corresponding column. For example,

A B
1Test1Test2
21217
31318
41419
51520
6
718 B

<tbody>
</tbody>
If cell A7 = 18, then cell B7 = Test2
If cell A7 = 15, then cell B7 = Test1

can anyone help to create such formula in cell B7?

thanks,
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Book1
ABC
1Test1Test2
21217
31318
41419
51520
6
718Test2
8
Sheet1


In B7 control+shift+enter, not just enter, and copy across:

=IFERROR(INDEX($A$1:$B$1,SMALL(IF($A$2:$B$5=$A$7,COLUMN($A$1:$B$1)-COLUMN($A$1)+1),COLUMNS($B$1:B$1))),"")
 
Upvote 0

Forum statistics

Threads
1,216,100
Messages
6,128,834
Members
449,471
Latest member
lachbee

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