ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Return the value of a column heading (https://www.excelbanter.com/excel-discussion-misc-queries/188077-return-value-column-heading.html)

Eric

Return the value of a column heading
 
Here's my data...
A B C D E F G H
1 Name First Last Jan Feb Mar Apr May
2 John ____ ____ 5 10 5
3 Jim ____ ____ 3 6 5

How do I get B2 to return "Feb" and C2 to return "Apr"; B3 to return "Jan"
and C3 to return "Mar"?

Hopefully the spacing won't lose anything when posted. Thanks!

T. Valko

Return the value of a column heading
 
Try these:

B2:

=IF(COUNT(D2:H2),INDEX(D$1:H$1,MATCH(TRUE,INDEX(D2 :H2<"",0),0)),"")

C2:

=IF(COUNT(D2:H2),LOOKUP(1E100,D2:H2,D$1:H$1),"")

Select both B2 and C2 then copy down as needed.

--
Biff
Microsoft Excel MVP


"Eric" wrote in message
...
Here's my data...
A B C D E F G
H
1 Name First Last Jan Feb Mar Apr May
2 John ____ ____ 5 10 5
3 Jim ____ ____ 3 6 5

How do I get B2 to return "Feb" and C2 to return "Apr"; B3 to return "Jan"
and C3 to return "Mar"?

Hopefully the spacing won't lose anything when posted. Thanks!





All times are GMT +1. The time now is 01:23 PM.

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