+ Reply to Thread
Results 1 to 10 of 10

SumProduct compare columns a and b with columns e and f

  1. #1
    Forum Contributor
    Join Date
    02-10-2007
    MS-Off Ver
    Excel 2010
    Posts
    293

    SumProduct compare columns a and b with columns e and f

    Hello,

    I am trying to compare columns a and b with columns e and f. If there is a difference (they don't match) display result in columns j and k, as in attached spreadsheet, else display ""

    not sure how to use sumproduct, any help would be appreciated.

    Thanks In Advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    What is the correct result if they don't match? It seems like you are choosing whatever is in columns A and B. If so, try the following:

    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.
    respectively.

    You dont really need to use sumproduct.

  3. #3
    Forum Contributor
    Join Date
    02-10-2007
    MS-Off Ver
    Excel 2010
    Posts
    293
    thanks. i think that works..actually column e and f, may not be in exact same order as column a and f, so what u have works if both columns are in same order, but thats not case with large data points.

    i was using with sumproduct

    =SUMPRODUCT(--(A$2:A$5=E2),--(B$2:B$5=F2),A$2:A$5)


    if they dont match show column a and column b respectively.

    do u know whats wrong with sumproduct fucntion above returning all 0's
    Last edited by VegasL; 09-18-2008 at 12:25 PM.

  4. #4
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    The problem is the last bit of your code

    Please Login or Register  to view this content.
    That would return a 1 in the correct case. The structure you had basically took the sum of all of the match. As you know, you can't sum a group of words, so the answer is 0.

  5. #5
    Forum Contributor
    Join Date
    02-10-2007
    MS-Off Ver
    Excel 2010
    Posts
    293
    please see updated attached sheet
    Attached Files Attached Files
    Last edited by VegasL; 09-18-2008 at 12:30 PM. Reason: forgot to attach updated sheet

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    Hi Vegas,
    SUMPRODUCT does just that; it sums by line/row the product of each of your arguments.

    Your first two arguments
    Please Login or Register  to view this content.
    will return either a 1 or 0 depending on whether it is true for that row. Your third argument
    Please Login or Register  to view this content.
    should be either a 3rd true/false statement (to count instances where rows meet the criteria of all 3 arguments) or numeric values(for summing values in that column that meet the criteria of arguments 1 and 2). In your case, it is neither so you get zeros.

    Does that help?
    Last edited by ChemistB; 09-18-2008 at 12:36 PM. Reason: Clarification
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  7. #7
    Forum Contributor
    Join Date
    02-10-2007
    MS-Off Ver
    Excel 2010
    Posts
    293
    thanks chemistb, in actual spreadsheet im using

    =SUMPRODUCT(--(A$2:A$5827=E2),--(B$2:B$5827)=F2,A$2:A$5827))

    and getting 0 like u said, but i m not getting desired result

    basically im trying to find "difference" where both sets of column dont match then display result from column a
    Last edited by VegasL; 09-18-2008 at 12:58 PM.

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    SUMPRODUCT isn't made to do that. It won't look line by line and return the value in A for that line if your criteria is met. BigBias formula does that.


  9. #9
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    I can't seem to grasp why you want to make this problem more complex than it has to be. I think my solution was suitable, and Chemist agrees. Is there a problem with my suggestion? Does it need to be modified?

  10. #10
    Forum Contributor
    Join Date
    02-10-2007
    MS-Off Ver
    Excel 2010
    Posts
    293
    thanks guys..both of you. appreciate ur help. looks like bigbass formula works. i didnt realize another workaround to same thing was, one could create a "unique id" by virtue of concatentating columns a&b and e&f, then doing a vlookup between those two results, similar to bigbass , but yes bigbass seems even more simpler.

    didnt also know that you cant use sumproduct without Numbers...

+ 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. Excel Compare Columns
    By kau in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-24-2008, 05:29 PM
  2. Replies: 8
    Last Post: 08-05-2008, 01:19 PM
  3. Compare two columns
    By egibberate in forum Excel General
    Replies: 3
    Last Post: 07-16-2008, 07:56 PM
  4. Compare Two Columns In Two Worksheets To Copy And Paste A Third Column
    By uopint in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2007, 05:03 PM
  5. Compare two columns
    By DooH in forum Excel General
    Replies: 2
    Last Post: 10-23-2006, 01:17 PM

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