count dates of a certain month in column

smking204

New Member
Joined
Jan 28, 2021
Messages
41
Office Version
  1. 365
Platform
  1. Windows
I have a column of dates, and I want a formula to return a count of how many dates of, say, April are in the column. I want it to look something like this:

=COUNTIF(A:A, MONTH()=4)

But that isn't working, in any of the variations I've tried. Hoping for a simple solution. Thanks!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Personally, I do not like full column references, but since you are using it, give this formula a try...

=SUM((MONTH(A:A)=4)*(A:A<>""))
 
Upvote 0
Solution
It has to do with your using full column referencing... the MONTH of a blank cell evaluates to 1, so we need to exclude all those extra blank spaces from the SUM function. If a cell in A:A is blank, that expression will return 0, otherwise it evaluates to 1... those numbers are then multiplied by the test for MONTH equal to 4.
 
Upvote 0
It has to do with your using full column referencing... the MONTH of a blank cell evaluates to 1, so we need to exclude all those extra blank spaces from the SUM function. If a cell in A:A is blank, that expression will return 0, otherwise it evaluates to 1... those numbers are then multiplied by the test for MONTH equal to 4.

Cool - thanks for the explanation.

By the way, I thought that the OP was on the right track with his original formula. Is there no feasible solution using the COUNTIF and MONTH function together?
 
Upvote 0
I don't think COUNTIF will work because its second argument is not supposed to be a logical expression.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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