Contributor

# Pivot Table Unique Headcount Counting Issue (Not Able To Get Headcount # Right)

My goal is to uniquely find a headcount and movement (employees join or leave) per month and put this in a Pivot Table. My data is formatted like it is in the Table.

My issue is when I do a count of Employee number (Empl #) and based on a filter of monthly salary, I don’t get a correct count when the employees join and/or leave and get a constant headcount in the Pivot Table of 3 when it should be 2, 3, 2 for Jan, Feb, Mar.

1. How to do I fix this?
2. What is the logic to approach this? How would someone look at this and pick what method to fix this? This is more of a how did you get to your answer sorta question. Do you write down/think how and what to solve then find the right tools/formulas/process to get there?

My logic is and I used:

1. Look at Account Name (C2) does it equal “monthly salary” and return binary for Yes (1) or No (-) I’m using =IF(Table1[@[Account Name]]="monthly salary","1","0") to find my binary
2. If that is 1/yes then check to see if the employee left. This is where I fail to get my answer. I attempted a =if(and()), I attempted to add columns that may assist with getting to my answer (one of them being the Left column (column F in the Table).
1. My issue comes with my data always includes the all employees regardless of join date (even with Joe Blow not there Jan he still shows just as 0s)
3. I want to find, does a person earn a monthly salary? If yes then check to see if he or she has left the company and if no then count him or her towards the month’s headcount and only count the employees still there but count them in months they were actually working (answer being 2,3,2)
3 Replies

# Re: Pivot Table Unique Headcount Counting Issue (Not Able To Get Headcount # Right)

@Jpalaci1 Perhaps like in the attached revised file?

# Re: Pivot Table Unique Headcount Counting Issue (Not Able To Get Headcount # Right)

That’s it! Thank you. How did you do it?

# Re: Pivot Table Unique Headcount Counting Issue (Not Able To Get Headcount # Right)

@jpalaci22 Entered a formula in column G and set the "Left?" filter in the pivot table to "-".