+ Reply to Thread
Results 1 to 5 of 5

Struggling with sumproduct

Hybrid View

Angel160 Struggling with sumproduct 01-03-2008, 06:31 AM
StephenR For WINS, ... 01-03-2008, 06:39 AM
dominicb Good morning Angel160 This... 01-03-2008, 06:40 AM
Angel160 Thank you both so much - I... 01-03-2008, 06:50 AM
dominicb Hi Angel160 The double... 01-03-2008, 07:08 AM
  1. #1
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning Angel160

    This should work OK for you :
    =SUMPRODUCT(--(B1:B11="WINS"),--(A1:A11<>"Bulk"),--(A1:A11<>"Spouse"))

    If you struggle with the syntax for SumProduct, my add-in, available from the link below, has a SumProduct generator that will create the formula for you (just go to Ultimate > Formulae > Multiple SumIf Genreator) and fill in the criteria.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  2. #2
    Registered User
    Join Date
    10-20-2004
    Posts
    15
    Thank you both so much - I was nearly there but couldn't quite nail it.

    DomincB - what do the "--" in your formula do? I've not seen them before.

  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi Angel160

    The double minus sign is known as the unary minus. Forum poster corinereyes asked this question a few months back (http://www.excelforum.com/showthread.php?t=609883). This is what I wrote back :

    Quote Originally Posted by DominicB
    • SUMPRODUCT when used to do a comparison returns a boolean value (ie TRUE or FALSE).
    • To do what we require within the formula requires that TRUE / FALSE to be changed to a value.
    • The first negative does this and change TRUE to -1 and FALSE to 0.
    • Applying it again will keep the numeric value but change the - to a +. Thinking back to my schooldays, " a minus times a minus is a plus".
    • In cell A1 put an A, in B1 put 10, and then in another cell the formula
    • =SUMPRODUCT(-(A1="A"))
    • will return -1. Change the minus to a double minus and the result will be 1.
    • Change the formula to
    • =SUMPRODUCT(--(A1="A"),(B1))
    • will return 10 (ie, 1 x 10)
    • The formula will now return a 1 where a match is found and do what SUMPRODUCT was designed to do - multiply two numbers together and add it to a running total.
    HTH

    DominicB

+ 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