+ Reply to Thread
Results 1 to 10 of 10

Sum under two conditions

  1. #1
    Forum Contributor gilbert's Avatar
    Join Date
    01-08-2004
    Location
    Asia
    MS-Off Ver
    2007
    Posts
    117

    Sum under two conditions

    Hi,

    Would like to find out what would be the most effective and easiest formula to use if I want to sum a range of numbers meeting 2 conditions (or more).. eg.. sum all the unpaid invoices (condition 1) due on March (condition 2).

    Appreciate your help.
    Thank you in advance,
    Gilbert

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

    e.g. =Sumproduct(--(A1:A100="unpaid"),--(Month(B1:B100)=3),C1:C100)

    sums range C1:C100 where A1:A100 is unpain and B1:B100 is column containing dates.
    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 Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Sum under two conditions

    With

    Col_A containing invoice status (paid, unpaid) and A1: Status
    Col_B containing due dates and B1: DueDate
    Col_C containing amounts and C1: InvAmt

    Try this:
    E1: Unpaid
    F1: 200803...representing YYYYMM

    This formula returns the sum of Unpaid invoices due in Mar-2008:
    Please Login or Register  to view this content.
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Assuming A1:A100 contains "Unpaid" or something else and B1:B100 contains due dates and C1:C100 amounts to sum then try

    =SUMPRODUCT((A1:A100="Unpaid")*(TEXT(B1:B100,"mmm/yy")="Mar/08"),C1:C100)

  5. #5
    Forum Contributor gilbert's Avatar
    Join Date
    01-08-2004
    Location
    Asia
    MS-Off Ver
    2007
    Posts
    117
    Why the same formula (ie.. Sumproduct) has two method of doing it? Why must the formula suggested by NBVC and Ron Coderre must use "--" in front of the sumproduct... does it indicates anything for the Sumproduct formula?

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by gilbert
    Why the same formula (ie.. Sumproduct) has two method of doing it? Why must the formula suggested by NBVC and Ron Coderre must use "--" in front of the sumproduct... does it indicates anything for the Sumproduct formula?
    See here for explanations and examples:

    http://www.xldynamic.com/source/xld.SUMPRODUCT.html

  7. #7
    Forum Contributor gilbert's Avatar
    Join Date
    01-08-2004
    Location
    Asia
    MS-Off Ver
    2007
    Posts
    117
    Quote Originally Posted by NBVC
    See here for explanations and examples:

    http://www.xldynamic.com/source/xld.SUMPRODUCT.html
    Gee.. thanks.. this is a very useful website.

  8. #8
    Forum Contributor gilbert's Avatar
    Join Date
    01-08-2004
    Location
    Asia
    MS-Off Ver
    2007
    Posts
    117
    I have adopted the formulae suggested by daddylonglegs and it works well... Supposing now I have three criterias, ie. Unpaid and Half Paid and Due. I want to sum those Dues that are Unpaid and Half Paid.... how should I go about it? Also considering that we can't take the full invoice values for Half Paid account ... is there any other way for me to take the net amount without creating additional columns for amount paid and balance?

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Can you explain how the data is laid out? Are "Paid" and "Half Paid" in the same column? When you say "Due" is that a text value or is that related to the dates? Perhaps post the formula you have so far as an indication.

    Would it be sufficient to take half the invoice amount if account is designated "half Paid"?

  10. #10
    Forum Contributor gilbert's Avatar
    Join Date
    01-08-2004
    Location
    Asia
    MS-Off Ver
    2007
    Posts
    117
    Enclose herewith the print screen for easy explanation

    \1

    Basically.. the invoice status, whether 'Paid','Unpaid','Half Paid' or 'FOC' is all in one coloumn. My intention is to show the unpaid and unpaid of the half paid summary on top in accordance to month. However, as mentioned in my earlier post, the tricky part is I want to add the unpaid balance of the half paid into the unpaid summary. If possible, I don't want to add additional columns like amount paid, balance unpaid. Maybe the amount paid shall be highlighted in the remark column only and let the formula to pick up the figure from the remark column.

    Any advise is highly appreciated.
    Attached Images Attached Images

+ 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