+ Reply to Thread
Results 1 to 7 of 7

Returning selected column headers

  1. #1
    Registered User
    Join Date
    03-25-2008
    Posts
    5

    Returning selected column headers

    Hi, I'm trying to do something where for each row in a table, I am trying to return the heading, if the column is selected. To better illustrate this, I included the table below:

    Math English Science History
    Jason X X X X
    Michael X
    Stephen X X


    I'm trying to figure out a way so that can automatically return the column heading if I choose the row. So if I chose Jason's row, it would return "math, english, science, history". What is the best way that this can be done?

    I also included a test excel document to further illustrate, in case the post doesnt come out right. Thanks guys!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    I understand your spreadsheet layout but what do you mean by "choose a row"? Do you want to return somewhere else on the spreadsheet or in the workbook that Jason is taking Math, English, Science and History? Or do you want to replace the X's with the headings in that table?

    ChemistB

  3. #3
    Registered User
    Join Date
    03-25-2008
    Posts
    5

    Question

    Hi Chemist, I should clarify.

    Somewhere else on the spreadsheet I'm going to label as Jason (hardcoded). And then I want a formula that returns all of the subjects that Jason is involved in.

    Let me know if you guys need anymore points of clarification. Thanks!!

  4. #4
    Registered User
    Join Date
    01-12-2004
    Location
    NY
    Posts
    92
    I'm sure that there are better ways to do this, but here is my take on this problem.

    It is a good idea to create a unique list (in this case, students IDs) when you are trying to return values in other ranges.

    In summary, the student IDs is the only named range used by a data validation list. Index & Match looks for the ID and returns the student name in cell B2. The student name triggers a group of sumproduct functions on row 4. Last, a group of if statements return the expected values in cell c2.
    Attached Files Attached Files
    _________________
    Regards,
    nrage21

  5. #5
    Registered User
    Join Date
    03-25-2008
    Posts
    5
    Nrage, yes that is exactly the kind of thing I am looking for! The only thing is, is there a way to make it so that if you were to add additional columns in between the existing ones, the formula will update and include these new headings as well? e.g. if I was to add Wood Shop between any existing subjects. Thanks.

  6. #6
    Registered User
    Join Date
    03-25-2008
    Posts
    5

    Question

    Can anyone help me with this? I still can't figure out the way to do this

  7. #7
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191
    I don't think so. I think you'll have to just manually update nrage21's formula in C2. The formula in row 4 can just be copied over and the others shouldn't need to be updated, so it should be relatively easy to do.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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