+ Reply to Thread
Results 1 to 3 of 3

Find First Match in Range Return Header Value

  1. #1
    Forum Contributor
    Join Date
    08-15-2014
    Location
    Michigan, USA
    MS-Off Ver
    MS Office 2021
    Posts
    105

    Find First Match in Range Return Header Value

    Ok, I have a range of cells. I give 3 examples. I am looking for the first cell to match my text, in the example its "Y". And return that column header value.
    In Group A the search range is B3:D13. The First Y is in D4. I need the value of that column header, which is in D2, which is 9.
    In Group B the search range is G3:I13. The First Y is in I3. I need the value of that column header, which is in I2, which is 8.
    In Group C the search range is L3:N13. The First Y is in N6. I need the value of that column header, which is in N2, which is 7.
    The example shows the first "Y" is always in the 3rd column that won't always be the case.

    I have looked that these 2 solved post but they did work.
    https://www.excelforum.com/excel-gen...ell-value.html
    https://www.excelforum.com/excel-for...this-text.html
    Attached Files Attached Files

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: Find First Match in Range Return Header Value

    You can use this formula for Group A:

    =IFERROR(INDEX(B2:D2,MOD(MIN(IFERROR(MATCH("Y",B3:B13,0)+0.1,100),IFERROR(MATCH("Y",C3:C13,0)+0.2,100),IFERROR(MATCH("Y",D3:D13,0)+0.3,100)),1)*10),"not found")

    For Group B use this:

    =IFERROR(INDEX(G2:I2,MOD(MIN(IFERROR(MATCH("Y",G3:G13,0)+0.1,100),IFERROR(MATCH("Y",H3:H13,0)+0.2,100),IFERROR(MATCH("Y",I3:I13,0)+0.3,100)),1)*10),"not found")

    and for the final Group C you can use this:

    =IFERROR(INDEX(L2:N2,MOD(MIN(IFERROR(MATCH("Y",L3:L13,0)+0.1,100),IFERROR(MATCH("Y",M3:M13,0)+0.2,100),IFERROR(MATCH("Y",N3:N13,0)+0.3,100)),1)*10),"not found")

    They are virtually the same - only the ranges change to suit each Group.

    Hope this helps.

    Pete

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: Find First Match in Range Return Header Value

    Thanks for the rep - I presume from your comments that this worked fine for you.

    Pete

+ 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. Replies: 4
    Last Post: 04-07-2017, 01:59 PM
  2. Replies: 2
    Last Post: 07-18-2015, 05:19 PM
  3. Replies: 5
    Last Post: 02-13-2014, 05:37 PM
  4. [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
  5. Replies: 2
    Last Post: 09-09-2013, 06:44 PM
  6. [SOLVED] Find.range to return True if match occurs
    By nivoe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-16-2012, 07:26 AM
  7. Find last numerical value in row range and return the column header
    By Fidd$ in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-04-2011, 10:15 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