teaone
asked on
count values based on date value
I have date values from Dec1 to Dec31 in one column and number values in the other column next to each date. How do I calculate sum of the number values from Dec 1 up to the date which value equals the date in cell D1?
example
12/1/11 30
12/2/11 20
12/3/11 5
12/4/11 40
etc.
If the date in cell D2 is 12/2, then my sum will be 50.
example
12/1/11 30
12/2/11 20
12/3/11 5
12/4/11 40
etc.
If the date in cell D2 is 12/2, then my sum will be 50.
Assuming your dates are A1:A31 and numbers are B1:B31
=SUMPRODUCT(--((A1:A31<=D2 )*(B1:B31) ))
=SUMPRODUCT(--((A1:A31<=D2
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Adding from from barry's suggestion, if you use two cells to specify range of dates ie D1 = Start Date & D2 = End Date:
=SUMIF(A2:A10,"<="&D2,B2:B 10)-SUMIF( A2:A10,"<" &D1,B2:B10 )
Thanks
Rob H
=SUMIF(A2:A10,"<="&D2,B2:B
Thanks
Rob H
ASKER
perfect! Thank you!
=SUMPRODUCT((A2:A10>=DATE(
assuming dates in A2:A10 and amounts in B2:B10
In Excel 2007 and later SUMIFS can be used
SUMIFS(B2:B10,A2:A10,">="&
regards, barry