ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formula to return column header (https://www.excelbanter.com/excel-programming/422831-formula-return-column-header.html)

XP

Formula to return column header
 
Using Office 2007 with Windows XP;

I need a formula that can look across several columns and return the value
of the header row for the column that does not contain a zero value.

For example (hopefully this will line up):

A F G H
R1 MISC1 MISC2 MISC3

R3 {formula} 0 25.25 0

If the example above, the formula in A3 should return: MISC2
Since that is the column heading for the column that doesn't have
a zero balance.

I hope this makes sense. Thanks much for your assistance.


Mike H

Formula to return column header
 
Hi,

If you saying only one of these columns will have a value then this will do it

=LOOKUP(2,1/(F2:I2<0),F1:I1)

If there is more than one column with a value it will return the last.

Mike

"XP" wrote:

Using Office 2007 with Windows XP;

I need a formula that can look across several columns and return the value
of the header row for the column that does not contain a zero value.

For example (hopefully this will line up):

A F G H
R1 MISC1 MISC2 MISC3

R3 {formula} 0 25.25 0

If the example above, the formula in A3 should return: MISC2
Since that is the column heading for the column that doesn't have
a zero balance.

I hope this makes sense. Thanks much for your assistance.


XP

Formula to return column header
 

Works exactly as I needed! Thanks!

"Mike H" wrote:

Hi,

If you saying only one of these columns will have a value then this will do it

=LOOKUP(2,1/(F2:I2<0),F1:I1)

If there is more than one column with a value it will return the last.

Mike

"XP" wrote:

Using Office 2007 with Windows XP;

I need a formula that can look across several columns and return the value
of the header row for the column that does not contain a zero value.

For example (hopefully this will line up):

A F G H
R1 MISC1 MISC2 MISC3

R3 {formula} 0 25.25 0

If the example above, the formula in A3 should return: MISC2
Since that is the column heading for the column that doesn't have
a zero balance.

I hope this makes sense. Thanks much for your assistance.



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

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