COUNTIF .... monthly

Artorius

Board Regular
Joined
Apr 18, 2006
Messages
176
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

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
try this to get the results for September 2006
=SUMPRODUCT((MONTH(A2:A41)=9)*(YEAR(A2:A41)=2006))
 
Upvote 0
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.
 
Upvote 0
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)
 
Upvote 0

Forum statistics

Threads
1,214,657
Messages
6,120,764
Members
448,991
Latest member
Hanakoro

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