I am setting up a pivot table, and I would like for it to give me the count of the number of unique combinations of two fields, not just the total count. That is, each combination should only be counted once regardless if there are duplicate records for that combination.
For example, with the raw data below, I would like the pivot table to count 10 (not 12) total records for combinations of teacher and subject. That is, (Teacher 1, Math)
only gets counted once, and the same for (Teacher 3, English)
.
Teacher 1 Math Student 1
Teacher 1 Math Student 2
Teacher 1 English Student 3
Teacher 1 History Student 4
Teacher 2 Math Student 5
Teacher 2 Science Student 6
Teacher 2 Biology Student 7
Teacher 3 Math Student 8
Teacher 3 Science Student 9
Teacher 3 English Student 10
Teacher 3 English Student 11
Teacher 3 Math Student 12
How can I set up my pivot table to do this?
Best Answer
Unfortunately, this isn't directly possible in Excel 2007. If you were on Excel 2013 or Excel 2010 with the PowerPivot add-in, you could do it using the new 'Distinct Count' feature.
Siddharth Rout outlined a good workaround on StackOverflow. Add a column to your data, and copy this formula down:
Then create your pivot based on the 1st and 3rd column.