+ Reply to Thread
Results 1 to 6 of 6

How to Sum based on criteria

  1. #1
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    How to Sum based on criteria

    Hi,
    Look This example :
    -------A---------------B
    blastranger------100
    rangerblade-----200
    blastranger------200
    Monkey----------300
    Rabbit------------400
    rangerblade-----500
    Monkey----------100
    Rabbit-------------200

    I want to sum the Value of blastranger and Rabbit which will return result :
    900

    I use SUMIFS(B1:B8,A1:A8,"blastranger",A1:A8,"Rabbit")
    the result is 0

    I wonder why it is 0, how to sum using SUMIFS, or do I make some mistake here?
    Last edited by BlastRanger; 09-30-2010 at 04:34 AM.
    Please give a Reputation as a gift for a thanks.
    By clicking the second icon at the top right corner of a user post or reply

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to Sum based on criteria

    SUMIFS is an AND based test - a single SUMIF(S) can not perform an OR based calculation.

    In this instance:

    =SUM(SUMIF(A1:A8,{"blastranger","Rabbit"},B1:B8))

  3. #3
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: How to Sum based on criteria

    Hi, maybe

    =SUMPRODUCT((A1:A8={"blastranger,"Rabbit"})*B1:B8)

    Regards
    Last edited by canapone; 09-30-2010 at 03:56 AM.

  4. #4
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    Re: How to Sum based on criteria

    Quote Originally Posted by DonkeyOte View Post
    SUMIFS is an AND based test - a single SUMIF(S) can not perform an OR based calculation.
    Then why if I use following formula using sumifs it will perform an OR based calculation :
    Look This example :
    -------A---------------B
    blastranger------100
    rangerblade-----200
    blastranger------200
    Monkey----------300
    Rabbit------------400
    rangerblade-----500
    Monkey----------100
    Rabbit-------------200

    =SUMIFS(B1:B8,A1:A8,"<>rangerblade",A1:A8,"<>Monkey")
    This Will sum value of blastranger and Rabbit and return 900

    That mean Sum value other than rangerblade AND other than Monkey

    SUMIFS(B1:B8,A1:A8,"blastranger",A1:A8,"Rabbit")
    This mean Sum value of blastranger AND value of Rabbit

    I think it's not an OR based calculation here
    ????
    Last edited by BlastRanger; 09-30-2010 at 04:14 AM.

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to Sum based on criteria

    Quote Originally Posted by blastranger
    Then why if I use following formula using sumifs it will perform an OR based calculation ...

    =SUMIFS(B1:B8,A1:A8,"<>rangerblade",A1:A8,"<>Monkey")
    :
    the above (as you state yourself) is not an OR test - it is an AND test

    the formula states sum values in B where value in A is neither "rangerblade" nor "monkey"

    The below:

    Please Login or Register  to view this content.
    says sum B where value in A is both "blastrange" and "rabbit" - a cell can not contain two different values simultaneously - hence 0
    Last edited by DonkeyOte; 09-30-2010 at 04:31 AM. Reason: removed references to A1:A8,B1:B8 in narrative to just A & B for sake of explanation

  6. #6
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    Re: How to Sum based on criteria

    OK that does make the sense

+ 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