Forum Discussion
Using Countifs to Calculate Headcounts
OwenPrice Many thanks for your observation and you are absolutely right!
I have modified my initial submission. Can you take a look and let me know if this makes sense to you? It does to me now.
If yes, how can I capture this with a formula?
Thanks.
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.
- NoviceKBJul 15, 2020Brass Contributor
Hi OwenPrice !
Yes to points 1 through 4.
Regarding your point 5, as you see from my test sheet, the probation column will have those who have completed probation or have their probation ongoing. These 2 categories of staff should of course be counted as part of the current HC. What I wanted to capture in addition to the above two categories is exactly what you mentioned in your point 5.2.1. Normally once we terminate someones probation we align the contract enddate to the probation enddate but for the sake of the formula please use only PROBATION ENDDATE though.
Thanks and have a goodnight!
Your support is much much appreciated!
- OwenPriceJul 16, 2020Iron Contributor
I think this formula will do what you need. It returns 24 rows from your sample data:
=COUNTIFS(Table1[Employee Class],"<>Adecco",Table1[Employee Class],"<>",Table1[Contract Start Date],"<="&TODAY(),Table1[Contract Start Date],"<>",Table1[Probation Status],"<>Terminated")+COUNTIFS(Table1[Employee Class],"<>Adecco",Table1[Employee Class],"<>",Table1[Contract Start Date],"<="&TODAY(),Table1[Contract Start Date],"<>",Table1[Probation Status],"Terminated",Table1[Probation Enddate],">="&TODAY())
Please see attached.