• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Formula that returns column header of 1st, 2nd, 3rd... cell with data

OgliBeta

New Member
I have a big table of data that is sort of like a big scatter graph, i.e., whether a column has data in a particular row depends on which row it is. What I need is a formula that finds the correct row based on a name and then finds the first column in that row with data and returns the header value. Actually, I can achieve that with the index match formula like this:
=INDEX(B$1:H$1,MATCH(TRUE,INDEX(B2:H2<>0,),0))

But what I cannot seem to figure out is how to get it to find the next data column in that row. I tried to use the CELL formula to pull the location of the first data cell and then adjust the starting cells for the INDEX MATCH formula, but after about 100 attempts and still no success I decided I'd call on the Chandoo wizards for some help. :)

Obviously I can't share my workbook due to data privacy concerns, but I've created just a little sample workbook to try to illustrate what I'm trying to accomplish... The summary part at the bottom is the result I'm after, and like I mentioned, I can get the first column of data to return after the names, but it's the ones out to the right that are challenging me.
 

Attachments

  • Sample File.xlsx
    10.2 KB · Views: 4
Try.........

In K10, copied across right and down :

=IFERROR(INDEX($B$1:$H$1,AGGREGATE(15,6,COLUMN($B$1:$H$1)-COLUMN($A$1)/($B2:$H2<>""),COLUMNS($A:A))),"-")

Regards
Bosco
 

Attachments

  • LookupName.xlsx
    12 KB · Views: 4
Back
Top