+ Reply to Thread
Results 1 to 7 of 7

MATCH with multiple columns

  1. #1
    Registered User
    Join Date
    02-11-2008
    Posts
    3

    MATCH with multiple columns

    I have two questions and I haven't found any answers in my searching. One, I think, is very simple but I am just not finding it. I will save the second question, which is more complicated, for later.

    Here's my question:

    I have attached a sample Excel file.

    In column A I have several three-digit numbers.

    I would like to search columns D, E and F for each of the entries in column A. If the entry from column A is found in one of those columns, I would like to put the column heading (apples, pears or gumbo) in column B (in the cell next to the three-digit number in column A).

    How would I do that? I assume some form of MATCH, but I can not get it to work for multiple columns. At any rate, I suspect this is bit of a softball and I thank you in advance for helping me out with this.

    Best regards,

    Don
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    10-29-2012
    Location
    Mojokerto,Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    554

    Re: MATCH with multiple columns

    (array formula)start at B2
    {=INDEX($A$1:$F$1;MIN(IF($D$2:$F$13=A2;COLUMN($D$2:$F$13))))}
    copy down
    Attached Files Attached Files

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: MATCH with multiple columns

    some1 will probably give you a neater, more elegant solution, but until then, try this,,,

    =IF(ISERROR(MATCH(A2,$D$2:$D$13,0)),IF(ISERROR(MATCH(A2,$E$2:$E$13,0)),IF(ISERROR(MATCH(A2,$F$2:$F$13,0)),"",$F$1),$E$1),D$1)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: MATCH with multiple columns

    Try..
    Please Login or Register  to view this content.
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  5. #5
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: MATCH with multiple columns

    hi Don, welcome to the forum. 2 questions.
    1. what if the numbers cannot be found in the table? for eg, "123". my formula shows as blank
    2. what if there are repeats in the 3 columns?

    here's what i have so far:
    =IF(COUNTIF($D$2:$F$13,A2)=0,"",INDEX($D$1:$F$1,MAX(IF($D$2:$F$13=A2,COLUMN($D$2:$F$13)-3))))

    you must paste this formula inside the formula bar of B2, & press CTRL + SHIFT + ENTER to confirm

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

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

    Re: MATCH with multiple columns

    PL See the attached file with formula in B column.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-11-2008
    Posts
    3

    Re: MATCH with multiple columns

    Thanks...I have marked as Solved.

+ 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