+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    10-24-2005
    MS-Off Ver
    2003
    Posts
    10

    SUMIF 3 variables

    Hi

    I need to sum (or ideally average) the numbers in column B when teh dates in Column A range between two referenced variables (say 1st Jan and 5th Jan) AND the values in column B are >0 (some are negative numbers).

    A B
    Order Date Unit price
    01-Jan £16.25
    01-Jan £4.95
    01-Jan -£10.00
    04-Jan £35.00
    05-Jan £35.00
    05-Jan -£10.00
    07-Jan £39.25

    Date #1 01-Jan
    Date #2 05-Jan
    Last edited by tuizner; 03-19-2010 at 05:40 PM.

  2. #2
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,147

    Re: SUMIF 3 variables

    To sum:

    =Sumproduct(--(A1:A100>=Startdate),--(A1:A100<=Enddate),--(B1:B100>0),B1:100)

    To Average:

    =Sumproduct(--(A1:A100>=Startdate),--(A1:A100<=Enddate),--(B1:B100>0),B1:100)/Sumproduct(--(A1:A100>=Startdate),--(A1:A100<=Enddate),--(B1:B100>0))

    Replace StartDate and Enddate with cell references indicating those dates...

    adjust ranges to suit.

    If you are using Excel2007

    To Sum:

    =Sumifs(B1:B100,A1:A100,">="&Startdate,A1:A100,"<="&Enddate,B1:B100,">0")

    To Average:

    =Averageifs(B1:B100,A1:A100,">="&Startdate,A1:A100,"<="&Enddate,B1:B100,">0")
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    10-24-2005
    MS-Off Ver
    2003
    Posts
    10

    Re: SUMIF 3 variables

    Works a treat - thanks very much!

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.2.0