ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to return a Column Header (https://www.excelbanter.com/excel-discussion-misc-queries/234334-how-return-column-header.html)

scott

How to return a Column Header
 
I have several columns with rows of data in them. For example

_____Header1_____Header2_____Header3_____
_____Data1_______Data2_______Data3_______


What I want to do is search for "Data2" text, and return that Column's
header, for instance, in this example, searching for "Data2" would yield
"Header2".

What formula should best be used?

Thanks.

T. Valko

How to return a Column Header
 
I have several columns with rows of data in them.

Headers in the range A1:C1
Data in the range A2:C6
E1 = lookup value

Try this array formula** :

=INDEX(A1:C1,MAX(IF(A2:C6=E1,COLUMN(A1:C1)))-COLUMN(A1)+1)

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"Scott" wrote in message
...
I have several columns with rows of data in them. For example

_____Header1_____Header2_____Header3_____
_____Data1_______Data2_______Data3_______


What I want to do is search for "Data2" text, and return that Column's
header, for instance, in this example, searching for "Data2" would yield
"Header2".

What formula should best be used?

Thanks.





All times are GMT +1. The time now is 02:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com