Forum Discussion
Stuck on a countifs formula
For consistency, change A11, A15 and A19 to Female.
In B10 as an array formula confirmed with Ctrl+Shift+Enter:
=SUMPRODUCT((Table13[Column1]=$A10)*(Table13[Start Date]<=EOMONTH(B$9,0))*IF(Table13[End Date]="",TRUE,Table13[End Date]>=B$9))
Fill down to B11, then to the right to column M.
Similarly in B14:
=SUMPRODUCT((Table13[Column1]=$A14)*(Table13[Start Date]<=EOMONTH(B$13,0))*IF(Table13[End Date]="",TRUE,Table13[End Date]>=B$13))
and in B18:
=SUMPRODUCT((Table13[Column1]=$A18)*(Table13[Start Date]<=EOMONTH(B$17,0))*IF(Table13[End Date]="",TRUE,Table13[End Date]>=B$17))
Your sample workbook contains gender in the age column, but apart from that: do you want to use the current age, or the age during the months? You'd need the date of birth for the latter...
Also, I forgot to also mention the typo of "Females" instead of "Female" (as Hans noted) but also each year needed a December (month 12) instead of 2 Novembers (month 11).