Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
den4673
 
Posts: n/a
Default Formula to Return Column Heading

I have a worksheet that has 5 columns and approximately 20,000 rows.
Only one cell in each row has a value other that zero. I want to
insert a column on the left that will have a formula that will look at
each value in each row and return the column heading for the column
that has the row containing a value other than zero. I have tried a
formula that says =if(c2<0,c1,(if(d2<0,d1),(if(e2<0,e1)
,(if(f2<0,f1),(if(g2<0,g1) but it did not work.

I hope this makes sense, and any help will surely be appreciated.


Dennis

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave O
 
Posts: n/a
Default Formula to Return Column Heading

Where C1:G1 are your headers and data starting in row 2, the formula in
B2 is
=IF(C2<0,C$1,IF(D2<0,D$1,IF(E2<0,E$1,IF(F2<0,F $1,G$1))))

  #3   Report Post  
Posted to microsoft.public.excel.misc
den4673
 
Posts: n/a
Default Formula to Return Column Heading

Thank you very much. I see from your example what I was doing wrong.

Dennis

  #4   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Formula to Return Column Heading

=INDEX($B$1:$F$1,MATCH(TRUE,($B2:$F2<0),0))

which is an array formula, it should be committed with Ctrl-Shift-Enter, not
just Enter, and copy down each row

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"den4673" wrote in message
oups.com...
I have a worksheet that has 5 columns and approximately 20,000 rows.
Only one cell in each row has a value other that zero. I want to
insert a column on the left that will have a formula that will look at
each value in each row and return the column heading for the column
that has the row containing a value other than zero. I have tried a
formula that says =if(c2<0,c1,(if(d2<0,d1),(if(e2<0,e1)
,(if(f2<0,f1),(if(g2<0,g1) but it did not work.

I hope this makes sense, and any help will surely be appreciated.


Dennis



  #5   Report Post  
Posted to microsoft.public.excel.misc
den4673
 
Posts: n/a
Default Formula to Return Column Heading

Thanks for the help. I have never used the Index function before and
am having a bit of trouble getting it to work here. I am not sure what
I am doing wrong but will continue until if get it down right.

Dennis



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return SEARCHED Column Number of Numeric Label and Value Sam via OfficeKB.com Excel Worksheet Functions 23 January 30th 06 06:16 PM
Positioning Numeric Values Resulting from 6 Column Array Formula Sam via OfficeKB.com Excel Worksheet Functions 2 January 5th 06 02:03 AM
need formula to search column for a word and return another word Skyline Excel Discussion (Misc queries) 5 November 18th 05 10:00 PM
Return Count for LAST NonBlank Cell in each Row Sam via OfficeKB.com Excel Worksheet Functions 12 April 17th 05 10:36 PM
Formula for a column comicfly Excel Discussion (Misc queries) 2 March 11th 05 12:16 PM


All times are GMT +1. The time now is 11:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"