# COUNTIF .... monthly

#### Artorius

##### Board Regular
I have a regular report that I need to produce and would like to set up a template so I drop raw data in and the report automates the results.

Here is the data:-

Contract End Date: dd/mm/yy

Report output:-

September 06: Number of Contracts with End date of 01/09/06 to 30/09/06

October 06: Number of contracts with end date of 01/10/06 to 30/10/06

etc etc

What is the best way to do this? The minds gone blank ........

Assuming Column A has the End Date ....

### Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
try this to get the results for September 2006
=SUMPRODUCT((MONTH(A2:A41)=9)*(YEAR(A2:A41)=2006))

Works an absolute dream. I simply just changed the month and year ...

Although, I had Sept 06, Oct 06, Nov 06 in another column and tried amending the formula slightly to save me changing the Month and year to:-

=SUMPRODUCT((MONTH(A2:A41)=(MONTH(E2))*(YEAR(A2:A41)=(YEAR(E2)))

I was surprised that this did not work where E2 = "Sep 06". I'll just double check the cell is formatted as a date

But anyway ... your Formula worked superbly and a real time saver. Thanks.

If E2 contains any date within the month in question then this should work

=SUMPRODUCT((MONTH(A2:A41)=MONTH(E2))*(YEAR(A2:A41)=YEAR(E2)))

but if E2 contains the 1st of the month in question (however formatted) then this would also work

=SUMPRODUCT((A2:A41-DAY(A2:A41)+1=E2)+0)

Works a treat. Thanks.

Replies
16
Views
2K
Replies
1
Views
202
Replies
4
Views
542
Replies
4
Views
345
Replies
3
Views
531

1,219,806
Messages
6,150,346
Members
450,952
Latest member
Zung

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

### Which adblocker are you using?

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

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