Forum Discussion
andyredfern
Mar 18, 2020Copper Contributor
Using COUNTIF to select a date
I have a column of dates and I'm trying to count all the dates in Jan, Feb ...etc.
I'm trying to use COUNTIF with MONTH() but not sure how to get this to work.
Pretty new to Excel so any help would be
5 Replies
- SergeiBaklanDiamond Contributor
- Hello,
This formula will do the job
=COUNTIFS(A2:A1000, ">="&DATE(2019,1,1), A2:A1000, "<="&DATE(2019,12,31))
The formula counts all the records between Jan 1st 2019 to Dec 31st 2019- andyredfernCopper ContributorThanks - it works for me! Andy
- SaviaIron Contributor
andyredfern So what you need to do is use COUNTIFS and have two conditions - that the dates are after the start date, and before an end date. An example:
=COUNTIFS(A1:A100, ">="&DATE(2020,3,1), A1:A100, "<="&DATE(2020,3,31))
You could of course replace those DATE functions with cell references.
- andyredfernCopper Contributor
SaviaThanks -- certainly does the job. I'm now going to spend a little time working out exactly how!
Andy