+ Reply to Thread
Results 1 to 4 of 4

match multiple fields in records

  1. #1
    Registered User
    Join Date
    06-03-2009
    Location
    Mountain View, CA
    MS-Off Ver
    Excel 2003
    Posts
    46

    match multiple fields in records

    Hi All,

    I know how to see if one value exists in an arrray, but is there a way to see if a combination of fields in one array exist in the same combination in another array?

    In other words, if I have table A:

    Name City
    Alyssa Cleveland, OH
    Derek Pittsburgh, PA
    Larry San Francisco, CA
    Merl Provo, UT

    and table B:

    Name City
    Alyssa Pittsburgh, Pa
    Derek Cleveland, OH
    Larry San Francisco, CA
    Merl Philadelphia, Pa

    I would like to add a column to table B containing a function that would indicate, in this instance, that only Larry-San Francisco, CA is a record shared by both tables.

    Can anyone help me with what that function would like?
    Last edited by prawer; 08-06-2009 at 01:53 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: match multiple fields in records

    =Sumproduct(--($A$1:$A$100=X1),--($B$1:$B$100=Y1))>0

    copied down

    This returns TRUE if a Match is found.

    where A1:B100 contains Table A and Table B begins as X1 and Y1
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    06-03-2009
    Location
    Mountain View, CA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: match multiple fields in records

    Thanks so much for the quick reply!

    Quick follow-up:

    I've used sumproduct before to count in this way -- and I've always omitted the double dashes before parentheses. Are they still necessary in Excel 2003/2007?

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: match multiple fields in records

    There are other ways... but something is needed to coerce the True/False arrays to 1/0 arrays for Sumproduct to do the math...

    ... other ways:

    =Sumproduct(($A$1:$A$100=X1)*($B$1:$B$100=Y1))>0

    =Sumproduct(($A$1:$A$100=X1)+0,($B$1:$B$100=Y1)+0)>0

    =Sumproduct(($A$1:$A$100=X1)*1,($B$1:$B$100=Y1)*1)>0

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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