+ Reply to Thread
Results 1 to 7 of 7

Return column header as value

  1. #1
    Registered User
    Join Date
    12-27-2014
    Location
    Reno, NV
    MS-Off Ver
    2013
    Posts
    14

    Return column header as value

    Any help is greatly appreciated.
    I have attached a sample of the sheet I am working on. I have a list of sales locations that i am trying to organize into region name. The Store's are in column A and the three regions with the stores listed under them in columns H, I, J. I am trying to take the value in column A, compare it to the table in H, I, J and return the region (header) in column B. I have been researching array formulas but i can't find one that returns the header. Please help.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Return column header as value

    Please Login or Register  to view this content.
    If someone has helped you then please add to their Reputation

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Return column header as value

    try in b2 filled down
    =INDEX($H$2:$J$2,SUMPRODUCT(($H$3:$J$8=A2)*COLUMN($A:$C))) assuming names are not duplicated
    in $H$3:$J$8
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Return column header as value

    Try this array formula

    =INDEX($H$2:$J$2,SMALL(IF($H$3:$J$8=A2,COLUMN($H$2:$J$2)-MIN(COLUMN($H$2:$J$2))+1),1))

    ...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. Press F2 on that cell and try again.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Registered User
    Join Date
    12-27-2014
    Location
    Reno, NV
    MS-Off Ver
    2013
    Posts
    14

    Re: Return column header as value

    thank you both for your replies. martindwilson, works perfectly. the other one probably works, but didn't try it.

  6. #6
    Registered User
    Join Date
    12-27-2014
    Location
    Reno, NV
    MS-Off Ver
    2013
    Posts
    14

    Re: Return column header as value

    martindwilson and AlKey, both formulas work great on the sample sheet. however, when i try to put them in my original sheet they don't work. i found a difference between the cities that on the left with the cities in the table to the right. when i copied one of the cities from the right and pasted it over the same city on the left, the formula worked. i copied the formatting from the cities on the right to the left for the rest of the cities but it didn't work. unfortunately, i'm not able to post the spreadsheet i am working on. any suggestions?

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Return column header as value

    just copy cities list and cities table to another workbook attach that
    that's all we need to see (hopefully)

+ 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. Return column header based on column criteria and number value
    By bwill22 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-07-2014, 07:33 PM
  2. [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
  3. Replies: 4
    Last Post: 03-13-2013, 12:38 PM
  4. Return value under column header
    By milty456 in forum Excel General
    Replies: 2
    Last Post: 09-28-2012, 11:13 PM
  5. Way to return a column header value?
    By Abgirl in forum Excel General
    Replies: 2
    Last Post: 05-20-2011, 12:39 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