+ Reply to Thread
Results 1 to 6 of 6

Search Table, Display Column Header

  1. #1
    Registered User
    Join Date
    08-10-2009
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2003
    Posts
    2

    Search Table, Display Column Header

    Guys,

    I'm pretty new to excel, and am trying to accomplish something that should be pretty easy. Basically, I have a table that has row headers to the left, column headers on top, and all the row data increases left to right.

    I'm trying to write a function that will automatically find the correct row header (that matches a previously calculated cell), search across the row to find a fixed value "x", then go to the top of the column and display the column header.

    The end result of this is that the proper column header is displayed for a given row input and table value.

    I couldn't figure it out with VLOOKUP, INDEX, OFFSET, MATCH, etc. but I know there are smarter folks out there. Any help would be appreciated, thanks!

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Search Table, Display Column Header

    Assuming that you will get an exact match in your row headers and in your table (otherwise you can build a lot of IF functions into this);
    Setting A1 to your row header you are looking for
    B1 to your table entry you are looking for
    B2:I2 is column headers (final answer)
    A3:A32 is your row headers
    Please Login or Register  to view this content.
    See attachment below.

    Edit: The OFFSET function is volatile so this may slow down your calculations if your spreadsheet is complex. DONKEY OTE is the master of replacing volatile Functions but I don't see how this one would easily be replaced. He might know.
    Attached Files Attached Files
    Last edited by ChemistB; 08-10-2009 at 12:30 PM. Reason: clarification
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    08-10-2009
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Search Table, Display Column Header

    Chemist,

    I don't exactly understand it yet, but it seems to work! Thanks again for the quick reply, that was awesome!

    MA

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Search Table, Display Column Header

    Hey, I only just ran a quick search to see if I'd been slated anywhere (I wasn't already aware of!) and came across this and yes you could avoid OFFSET here by using INDEX in such a way as to return all columns for a given row... ie this:

    Please Login or Register  to view this content.
    could become

    Please Login or Register  to view this content.
    So you run the MATCH of value against a range generated by the INDEX which itself is determined by the MATCH of value 1 against the left hand side column - by setting the column to 0 in the INDEX the range returns all values in that row (ie all columns)... because the final range is a Vector (1 row) you don't actually need to specify both column & row flag you need only specify that which is variable
    (ie for a vertical vector column will always be 1 and for a horizontal vector the opposite is true in so far as the Row will always be 1)

    EDIT: P.S. Flattery gets you everywhere... I don't think I've been referred to as the Master of anything other than of perhaps "disaster"...
    Last edited by DonkeyOte; 08-12-2009 at 02:45 PM.

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Search Table, Display Column Header

    Thanks DO!
    Filing that formula away for future reference.

  6. #6
    Registered User
    Join Date
    01-26-2011
    Location
    au
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Search Table, Display Column Header

    is there a way to do this to find the second column header if there are 2 occurences in one row

+ 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