Return Column header after matching cell value

aton911

New Member
Joined
Jul 24, 2015
Messages
14
Good Afternoon,

I hope you can help as I am trying to return column header after matching cell value. For example when search for "Cat" it should return Col 3

col1col2col3col4col5col6col7
AnimalApple
AnimalApple
AnimalApple
AnimalAppleCat
AnimalAppleCat
AnimalAppleCatDog
AnimalAppleCatDog
AnimalAppleCatDog
AnimalAppleCatDog
AnimalAppleCatDog
AnimalAppleCatDogTest
AnimalAppleCatDogTest
AnimalAppleCatDogTest
AnimalAppleCatDogTestHorse
AnimalAppleCatDogTestHorse
AnimalAppleCatDogTestHorse


<colgroup><col width="64" style="width: 48pt;" span="7">
<tbody>

























































































































































</tbody>
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
try this ... use ctrl shift enter ...

=INDEX(A1:G1,MAX(IF(A2:G17=D21,COLUMN(A2:G17)-COLUMN(A1)+1)))
 
Upvote 0
Aton, or if you had headings in the first row / row 1 rather than col1, col 2 ...etc, and assuming your table started in cell A1, and that you wanted to enter your search in the relevant cell in column 8 (or column H), then enter the following formula in cell I2 (i.e. to search the first row of your table assuming it was laid out as I have specified and return the column heading corresponding to the search term entered in H2):

=INDEX($A$1:$G$1,1,MATCH(H2,$A2:$G2,0))

Please let me know if this is unclear. It is important to specify exactly how the table is laid out in order for me to give you the exact formula.

You can then copy this formula down from I2 to the last row in column I in your table. This will give you the column heading corresponding to where your search word appears in each row of the table.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,331
Messages
6,124,311
Members
449,152
Latest member
PressEscape

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