Forum Discussion
Stuck on a countifs formula
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).
I didn't even notice the two Novembers... 🙂
- gillsyAug 11, 2021Copper Contributor
Thanks to both of you, mtarler I couldn't get yours to work but I understand the concept,
HansVogelaar yours initially wasn't quite right as it was adding the employee the month after they started so I modified it slightly to fit it. I had a feeling SUMPRODUCT was going to be in the formula somewhere.
The final formula being =IF(SUMPRODUCT((Table13[[Gender]:[Gender]]=$A10)*(Table13[[Start Date]:[Start Date]]<(EDATE(B$9,1))*IF(Table13[[End Date]:[End Date]]="",TRUE,(IF(Table13[[End Date]:[End Date]]="",TRUE,Table13[[End Date]:[End Date]]>=B$9)))))=0,"",SUMPRODUCT((Table13[[Gender]:[Gender]]=$A10)*(Table13[[Start Date]:[Start Date]]<(EDATE(B$9,1))*IF(Table13[[End Date]:[End Date]]="",TRUE,(IF(Table13[[End Date]:[End Date]]="",TRUE,Table13[[End Date]:[End Date]]>=B$9))))))
Cheers for both your help, I was stuck on that for almost 8 hours. It's a new formula to add to my knowledge.
- gillsyAug 12, 2021Copper Contributor
HansVogelaar I'm stuck on averaging the age now.
I want an average age based on the month in question.
- HansVogelaarAug 12, 2021MVP
In B24 as an array formula confirmed with Ctrl+Shift+Enter:
=AVERAGE(IF((Table134[DOB]<>"")*(Table134[Start Date]<=EOMONTH(B23,0))*IF(Table134[End Date]="",TRUE,Table134[End Date]>=B23),(B23-Table134[DOB])/365.25,""))
Fill or copy to the other cells.