+ Reply to Thread
Results 1 to 7 of 7

Comparing 2 Columns using SUMPRODUCT ONLY

  1. #1
    Forum Contributor meyero90's Avatar
    Join Date
    03-24-2010
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    202

    Arrow Comparing 2 Columns using SUMPRODUCT ONLY

    Hello Gurus,

    This should be an easy one. I used to know how to use this SUMPRODUCT function to compare two columns but it seems not to work...I might have forgotten how to do it
    In A1:A5, I have letters A,B,C,D,E
    In B1:B5, I have letters D,E,F,N,A
    --> I tried
    Please Login or Register  to view this content.
    But unsuccessful result.

    I know it works using
    Please Login or Register  to view this content.
    , and returns TRUE,FALSE with respect to the missing lookup_value.

    The Above SUMPRODUCT() should return as I remember 1 or 0.

    Cheers guys
    Last edited by meyero90; 08-19-2010 at 09:18 AM.
    If I helped, Don't forget to add to my reputation (click on the little scale)
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)

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

    Re: Comparing 2 Columns using SUMPRODUCT ONLY

    You need the double unary in front of each conditional argument:

    =SUMPRODUCT(--($A$1:$A$5=$A1),--($B$1:$B$5=$B1))

    if you are going to sum another array based on those conditions, then the summing array does not take the double unary

    =SUMPRODUCT(--($A$1:$A$5=$A1),--($B$1:$B$5=$B1),$C$1:$C$5)
    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
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Comparing 2 Columns using SUMPRODUCT ONLY

    Rewriting ISNA / MATCH with SUMPRODUCT..
    =SUMPRODUCT((A1=$B$1:$B$5)*1)
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  4. #4
    Forum Contributor meyero90's Avatar
    Join Date
    03-24-2010
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    202

    Re: Comparing 2 Columns using SUMPRODUCT ONLY

    Contaminated solution works....thanks but I want to make the sumproduct work.
    NBVC, when I use your solution it returns 1 to every match which is incorrect since A2 and A3 are not in B1:B5. Is there a way you can fix that?

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Comparing 2 Columns using SUMPRODUCT ONLY

    If you want to know if all of the entries in A1:A5 are in B1:B5,

    =AND(ISNUMBER(MATCH(A1:A5, B1:B5, 0)))

    ... array-entered.
    Entia non sunt multiplicanda sine necessitate

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

    Re: Comparing 2 Columns using SUMPRODUCT ONLY

    Or how many of A1:A5 are in B1:B5:

    =SUMPRODUCT(--ISNUMBER(MATCH(A1:A5,B1:B5,0)))

  7. #7
    Forum Contributor meyero90's Avatar
    Join Date
    03-24-2010
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    202

    Re: Comparing 2 Columns using SUMPRODUCT ONLY

    thanks guys for your help. much appreciated!

+ 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