+ Reply to Thread
Results 1 to 5 of 5

How to return a value based on mutually exclusive conditions/criterias?

  1. #1
    Registered User
    Join Date
    06-26-2008
    Location
    Asia
    Posts
    53

    How to return a value based on mutually exclusive conditions/criterias?

    HI.

    If the data looks like this:

    A B
    1 Mary 10
    2 John 20
    3 Ryan 30
    4 Pam 40

    How can I write a formula that sums the value in column B if the value is either John or Pam?

    Thanks!

  2. #2
    Forum Contributor wmorrison49's Avatar
    Join Date
    09-25-2007
    Posts
    267
    The easiest way is probably to combine a couple SUMIF statements:

    =SUMIF(A1:A4,"John",B1:B4)+SUMIF(A1:A4,"Pam",B1:B4)

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

    =SUMPRODUCT((A1:A4="Mary")+(A1:A4="John"),B1:B4)

    adjust ranges to suit
    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.

  4. #4
    Registered User
    Join Date
    06-26-2008
    Location
    Asia
    Posts
    53
    Thank you both so much! Have decided to use the sumproduct formula instead as it is summing from another workbook.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    If you're going to have multiple comparisons, then this version might be easier to add conditions to....

    =SUMPRODUCT((A1:A4={"Mary","John"})*(B1:B4))

+ 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