Forum Discussion
Variance analysis for headcount
- Nov 16, 2024
This requires Excel 365 insider at present. The formula
= LET( employee, CHOOSECOLS(Table2[#All], 1, 5, 2), month, Table2[[#All],[Month]], FTE, Table2[[#All],[FTE]], PT, PIVOTBY(employee, month, FTE, SUM,,0,,0), PT )will create a pivoted array
PivotedTo calculate the difference between month 1 and month 3, adds to the length of the formula
= LET( employee, CHOOSECOLS(Table2[#All], 1, 5, 2), month, Table2[[#All],[Month]], FTE, Table2[[#All],[FTE]], PT, PIVOTBY(employee, month, FTE, SUM,,0,,0), onroll, DROP(PT, 1,3), counts, IF(onroll<>"", VALUE(onroll), 0), change, TAKE(counts,,-1) - TAKE(counts,,1), HSTACK(TAKE(DROP(PT,1),,3), change) )giving
ChangeThat could be filtered to give non-zero changes only
FilteredFILTER(HSTACK(TAKE(DROP(PT,1),,3), change), change)
Did you consider a pivot table? Example attached.
It allows you to see all changes that took place. People joining, leaving and transferring between departments. And in your example, you even see that Andres and Catherine have the same employee code. Something that would probably not happen in real life.
Riny thanks for your reply. Certainly the code btw Andres and Catherine is my error putting the dummy data. Ideally, a pivot would work but it doesnt display the variance which is the one I'm interested. Furthermore, I have probably 300 people in the company... tks!!!