Forum Discussion
Using Countifs to Calculate Headcounts
Hi Team,
In my attached screenshot I am wondering how I can use COUNTIFS to calculate the current Headcount of employees based on the following conditions.
Countifs;
1. The employee class is NOT "Adecco" nor Blank.
2. The Contract Startdate is less than TODAY(todays date) and not blank.
3. Probation status is NOT "Terminated" (If status is Terminated but the contract enddate is later than todays date or BLANK, this should still count as 1 Headcount)
Currently this is my formula:
=COUNTIFS(B:B,"<>Adecco",B:B,"<>",C:C,"<=TODAY()",E:E,">=TODAY()",F:F,"<>Terminated")
But it returns zero... 😞 :(...Any ideas will be very welcome.
Thanks.
6 Replies
- OwenPriceIron Contributor
These two statements appear to cancel each other out:
- The probation enddate is more than TODAY or BLANK and the Probation status is NOT "Terminated"
- (If status is Terminated but the probation enddate is later than todays date or BLANK, this should still count as 1 Headcount)
You seem to be saying that regardless of the probation status, if the probation end date is greater than today or blank, then it should count as a headcount.
If you mean to say that the probation end date must not be before today (i.e. it can be today, after today, or empty), then use this:
=COUNTIFS(Table1[Employee Class],"<>Adecco",Table1[Employee Class],"<>",Table1[Contract Start Date],"<="&TODAY(),Table1[Probation Enddate],">="&TODAY(),Table1[Probation Status],"<>Terminated")+COUNTIFS(Table1[Employee Class],"<>Adecco",Table1[Employee Class],"<>",Table1[Contract Start Date],"<="&TODAY(),Table1[Probation Enddate],"",Table1[Probation Status],"<>Terminated")
This is actually summing these two counts:
1. Non-Adecco employees whose class is known and whose contract start date is before or on today with a probation date on or after today who have not been terminated, AND
2. Non-Adecco employees whose class is known and whose contract start date is before or on today with no probation date who have not been terminated
- OwenPriceIron Contributor
Can you confirm this is what you mean? If we break each condition down into bullets of their own:
- The employee class is not "Adecco", AND
- The employee class is not blank, AND
- The contract start date is less than today's date, AND
- The contract start date is not blank, AND
- Either:
- The probation status is not terminated, OR
- The probation status is terminated AND
- the contract end date is after today, OR
- the contract end date is blank
Regarding the bold items - should those actually be probation end date? I wonder whether the actual situation you're trying to capture here are people who have been terminated but they have not finished their probation yet, so they are still active headcount.
- mathetesSilver Contributor
Could I offer a suggestion? Let's make it simpler.
Your set of conditions is complex enough that you might be better suited to the use of "helper columns" to test one or at most two conditions and yield a "Y" or some other value, that could then be used as the basis for counting.
See the attached. I didn't try to verify the number...will leave that to you.