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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

texasalynn

Well-known Member
Joined
May 19, 2002
Messages
8,458
try this to get the results for September 2006
=SUMPRODUCT((MONTH(A2:A41)=9)*(YEAR(A2:A41)=2006))
 

Artorius

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

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
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)
 

Forum statistics

Threads
1,137,329
Messages
5,680,853
Members
419,935
Latest member
analyst0503

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
Top