Forum Discussion
Stuck on a countifs formula
gillsy I think I see you problem. In order to calculate it you have to have an OR condition to take care of the blank end date so you could create a helper column being EndDate-Today and that would be something like: =IF(TABLE13[End Date],TABLE13[End Date],TODAY()) and then you could use the COUNTIFS and AVERAGEIFS function. That would make it a bit cleaner and easy to follow and instead of TODAY() you could enter a future date to assume they will still be with you through the end of the year or next, ... (that was a question I had about your dates in the future if present employees should be assumed to stay)
In the attached I used different formulas instead to give you options (again the above is more straight forward).
=SUMPRODUCT((Table13[Column1]=$A10)*(Table13[Start Date]<B$9)*IF(Table13[End Date],Table13[End Date]>B$9,1))
and for the Average Age (I assume the average # days the current employees have been employed)
=AVERAGE(FILTER(B$9-Table13[Start Date],(Table13[Start Date]<B$9)*IF(Table13[End Date],Table13[End Date]>B$9,1),0))
So other considerations will be how to handle employees that started or ended in that particular month, but I'll leave that up to you.
good luck.