Reputation: 61
Lets say I would like to sum up values from January to March. Below is an example
╔═══════════╦════════════╗
║ Column A ║ Column B ║
╠═══════════╬════════════╣
║ 1/30/2011 ║ 1 ║
║ 1/25/2011 ║ 1 ║
║ 3/30/2011 ║ 1 ║
║ 3/25/2011 ║ 1 ║
║ 5/13/2011 ║ 1 ║
╚═══════════╩════════════╝
I did some research and found I can use the SUMIFS function
=SUMIFS(B1:B5,A1:A5,">="&DATE(YEAR(2011),MONTH(1),DAY(1)),A1:A5,"<="&DATE(YEAR(2011),MONTH(4),DAY(1)))
But for some reason instead of returning 4 it returns 0. I would really appreciate if someone could figure out why.
Thank you
Upvotes: 1
Views: 7383
Reputation: 61
I don't think Year/Month/Day do what you're expecting, see:
http://www.techonthenet.com/excel/formulas/year.php
They return the year value, month value, and day value of their argument. Try entering
=YEAR(2011)
and compare it to
=YEAR("1/30/2011")
That said, you can get what you want by just putting the dates in the quotes
=SUMIFS(B1:B5,A1:A5,">=2011-01-01",A1:A5,"<=2011-04-01")
produces 4 in my Excel.
Upvotes: 2