+ Reply to Thread
Results 1 to 8 of 8

ID first and last non blank values in a row and return that cells column header

  1. #1
    Registered User
    Join Date
    03-11-2014
    Location
    St. Louis, MO
    MS-Off Ver
    Excel 2010
    Posts
    17

    ID first and last non blank values in a row and return that cells column header

    I have a data set with the weeks of the year as my column headers and a value of 1 (from a pivot table) in a distinct row value (removed for privacy) showing whether it existed in a given week based on pre defined criteria. What i need to do is ID the first (from the left) non blank cell in each row and then return that cells column header. I then need to do the same for the last (from the left) non blank cell in each row and then return that cells column header. On the attached I've put values in column N and O to show an example of what I need to return using a formula. Your help is greatly appreciated!
    Mike
    First instance.xlsx
    Last edited by hotelmrrsn; 03-13-2014 at 12:16 PM. Reason: Solved

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: ID first and last non blank values in a row and return that cells column header

    Here, try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: ID first and last non blank values in a row and return that cells column header

    I didn't download your file.

    Try something like this:

    Data Range
    B
    C
    D
    E
    F
    1
    Header1
    Header2
    Header3
    Header4
    Header5
    2
    x
    x
    x
    3
    4
    1st
    Header2
    5
    Last
    Header4


    This array formula** entered in C4:

    =INDEX(B1:F1,MATCH(TRUE,B2:F2<>"",0))

    ** 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.

    This formula entered in C5:

    =LOOKUP(2,1/(B2:F2<>""),B1:F1)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Forum Contributor
    Join Date
    01-25-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    434

    Re: ID first and last non blank values in a row and return that cells column header

    formula for N3
    Please Login or Register  to view this content.
    copy and past down

  5. #5
    Forum Contributor
    Join Date
    01-25-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    434

    Re: ID first and last non blank values in a row and return that cells column header

    or
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-11-2014
    Location
    St. Louis, MO
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: ID first and last non blank values in a row and return that cells column header

    Thank you all for your responses, worked like a charm.

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: ID first and last non blank values in a row and return that cells column header

    You're welcome. We appreciate the feedback!

  8. #8
    Registered User
    Join Date
    03-11-2014
    Location
    St. Louis, MO
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: ID first and last non blank values in a row and return that cells column header

    I actually ended up using =IF(COUNTA(A3:K3),INDEX(A$2:K$2,MATCH(TRUE,INDEX(A3:K3<>"",0),0)),"") to identify the first and then =LOOKUP(9.999999999E+307,A3:K3,$A$2:$K$2) for the last week. Just in case anyone needed/wanted to know the final solution.

+ 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] To find first non blank cell in a row then return column header
    By divi123 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-11-2022, 04:49 AM
  2. To find first non blank cell in a row then return column header
    By divi123 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-17-2014, 07:14 AM
  3. [SOLVED] Find last non blank cell in a row then return column header
    By Chad B in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-13-2013, 10:33 AM
  4. Return column header, max value, 2 values same
    By bishopisgreat in forum Excel General
    Replies: 1
    Last Post: 09-09-2012, 07:40 AM
  5. Find Max values in row then return Column Header
    By mrio in forum Excel General
    Replies: 0
    Last Post: 08-23-2006, 12:47 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