+ Reply to Thread
Results 1 to 4 of 4

Return header when there is a value in column. 4 columns possible

  1. #1
    Forum Contributor
    Join Date
    11-20-2014
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    177

    Return header when there is a value in column. 4 columns possible

    Naamloos.png

    See above image.
    I am looking for a formula that returns the header for the second and third value possible in the row.

    currently i have a working formula for the first value which returns the first header:
    =INDEX($B$2:$I$2;MATCH(TRUE;INDEX(B1:I1<>0;0))

    and also for the last value which returns the last header:
    =IFERROR(LOOKUP(2;1/(B2:I2<>"");$B$1:$I$1);"None found")

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Return header when there is a value in column. 4 columns possible

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,968

    Re: Return header when there is a value in column. 4 columns possible

    In J2:

    =IFERROR(INDEX($A$1:$I$1,SMALL(IF($A2:$I2<>"",COLUMN($A2:$I2)-COLUMN($A$1)+1),COLUMNS($A$1:B1))),"")

    ... confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Once confirmed, drag across and down.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Return header when there is a value in column. 4 columns possible

    I mocked it up, anyway...

    or, since you have Excel 2010, a non-array formula (just enter)

    =IFERROR(INDEX($2:$2,AGGREGATE(15,6,COLUMN($C3:$H3)/($C3:$H3=1),COLUMNS($J:J))),"")

    copied across and down. See sheet. It will return the first, second third & fourth. One formula for all 4.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Search nearest value above in table. return header row + header column
    By 323428 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-22-2018, 05:06 AM
  2. Replies: 12
    Last Post: 12-19-2017, 12:08 PM
  3. [SOLVED] Return Column Header for First and Last Columns to Contain a Value
    By winkee223 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-29-2017, 10:09 AM
  4. [SOLVED] Compare multiple columns and return header value
    By sarajun_88 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-09-2017, 10:27 PM
  5. [SOLVED] Find specific value in table and return header row and header column value
    By nelwan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-30-2013, 01:35 AM
  6. [SOLVED] Compare dates across columns and return column header
    By huy_le in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-29-2013, 07:07 PM
  7. Replies: 4
    Last Post: 03-13-2013, 12:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1