Apr 21 2022 03:16 AM
I have a lot of dates in my excel from January till December and i want to know how many dates where from April? I tried with Countif but “apr” or “-4-“ doesnt work.
Apr 21 2022 05:21 AM
Apr 21 2022 06:30 AM
@Hans Vogelaar solution is probably the better, but it is possible to use month numbers or even names.
"Based on Hans's solution"
= COUNTIFS(
dateList, ">="&EDATE(startDate,3),
dateList, "<="&EOMONTH(startDate,3)
)
"Array formula using SUM"
= SUM(
--(MONTH(dateList)=4)
)
COUNTIFS is a very fast function. The SUM formula will count April dates irrespective of their year.
Apr 21 2022 06:46 AM
Where possible I'd avoid CSE in pre-DA Excel using functions which natively work with arrays. In this case
=SUMPRODUCT( (MONTH(datelist)=4)*(year(datelist)=2022) )
Performance is the point, but is that our case?