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

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

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,217,415
Messages
6,136,503
Members
450,016
Latest member
murarj

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