+ Reply to Thread
Results 1 to 4 of 4

Returning the headers of all columns with a matching value

  1. #1
    Registered User
    Join Date
    03-03-2011
    Location
    Marin County, CA
    MS-Off Ver
    Excel 2007
    Posts
    25

    Question Returning the headers of all columns with a matching value

    MA IN RI
    val1 val1 val1
    val2 val3 val2
    val4

    Goal: To go through a list of table values, and list all the headers whose column contains the value, preferably as a comma-separated list

    Desired result example:
    val1 MA, IN, RI
    val2 MA, RI
    val3 IN
    val4


    Note that the table potentially has blanks, and a given value can appear on different rows within two different columns. I have a list of the values in the table, was hoping for a formula I can plug into the column next to that list.

    Been banging around with INDEX/MATCH functions for a couple hours with no luck, best I can do so far is get the column header of the first match

    This formula gets close, but the data is organized differently there, and my brain isn't wrinkly enough to handle the difference: https://exceljet.net/formula/multipl...separated-list

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,466

    Re: Returning the headers of all columns with a matching value

    Which version of Excel are you using?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Returning the headers of all columns with a matching value

    Here is the code for UDF GetHeaders
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  4. #4
    Registered User
    Join Date
    03-03-2011
    Location
    Marin County, CA
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Returning the headers of all columns with a matching value

    kvsrinivasamurthy, thank you so much for the macro and example file. I was able to use your function successfully and save quite a bit of time. Appreciate you

+ 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. UserForm Idea Needed For Matching Columns and Changing Headers
    By spacle in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-02-2020, 09:14 AM
  2. Allocation of columns to other sheet based on matching headers
    By etaver87 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-24-2016, 09:44 AM
  3. Allocation of columns to other sheet based on matching headers
    By etaver87 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-24-2016, 09:41 AM
  4. Replies: 4
    Last Post: 02-08-2014, 02:31 PM
  5. Auto filter multiple columns matching with searched headers
    By gotovamsee in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2011, 03:20 PM
  6. Matching two columns and returning third value
    By snashte in forum Excel General
    Replies: 4
    Last Post: 08-01-2010, 01:30 AM
  7. Matching 2 columns and returning a value to a cell
    By AS1978 in forum Excel General
    Replies: 1
    Last Post: 02-21-2008, 08:47 AM

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