Sum Functions by using date criterias

Gokhan_ciftcioglu

New Member
Joined
Mar 24, 2017
Messages
30
Hi guys,

In Column A there are lots of dates from different years, and in column B there are numbers that I have to sum. the problem is; I need to sum the numbers according to months and years. Are there any way to do that by using array formulas. I don't want to use the SUMIF function by seperating the months and years as a number into other columns. The formula I am trying to use is below but it doesn't work.

F2 cell : 01.01.2017 for the below formula

SUM(IF(AND(YEAR($A$2:$A$800)=YEAR(F$2);MONTH($A$2:$A$800)=MONTH(F$2));$B$2:$B$800))

Thanks in advance
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try
=SUMPRODUCT((YEAR(A2:A800)=YEAR(F2))*(MONTH(A2:A800)=MONTH(F2)),(B2:B800))
 
Upvote 0
AND does not work that way. Try: Control+shift+enter, not just enter...

=SUM(IF(YEAR($A$2:$A$800)=YEAR(F$2);IF(MONTH($A$2:$A$800)=MONTH(F$2));$B$2:$B$800)))

or

=SUM(IF($A$2:$A$800-DAY($A$2:$A$800)+1=F$2;$B$2:$B$800))

where F$2 is a first day date like 01.01.2017. The SUMPRODUCT version would be:

=SUMPRODUCT(($A$2:$A$800-DAY($A$2:$A$800)+1=F$2)+0;$B$2:$B$800)

and SUMIFS version:

=SUMIFS($B$2:$B$800;$A$2:$A$800;">="&F$2;$A$2:$A$800,"<="&EOMONTH(F$2;0))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top