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?


12/1/11    30
12/2/11    20
12/3/11     5
12/4/11     40

If the date in cell D2 is 12/2, then my sum will be 50.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

barry houdiniCommented:
Here's one way for any excel version...


assuming dates in A2:A10 and amounts in B2:B10

In Excel 2007 and later SUMIFS can be used


regards, barry
Assuming your dates are A1:A31 and numbers are B1:B31

barry houdiniCommented:
.......In fact if you don't have any date values earlier than 1st Dec you can just sum for <=D2, e.g.



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rob HensonFinance AnalystCommented:
Adding from from barry's suggestion, if you use two cells to specify range of dates ie D1 = Start Date & D2 = End Date:


Rob H
teaoneAuthor Commented:
perfect! Thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.