Pivot table count of students (counts same many times)

drom

Well-known Member
Joined
Mar 20, 2005
Messages
543
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and thanks in advance!

I have a table with many rows
This table shows Students names School, Subjects, Initial mark, Final Mark, Attendance...
Obviously a student has many subjects
So When I am showing a pivot table (See attached) my Count of Students shows many more students than the real ones because I am summing the same student many times
So if a student named eg Peter has 5 Subjects My Count of students In my Pivot table will show 6 for him, not just 1 when I am summarizing by School

ps: I now how to add a new column and put 1 or 0 when necessary
I am trying to learn if there is any other way?

My Table, just for this eg: (can contain many rows)
StudentSubject1SubSubjectInitial MarkFinal MarkSchool
PETERMathsExercices6,56,5XXX
PETERMathsExercices44XXX
PETERMathsAptitude6,56,5YYY
PETERMathsAptitude6,56,5XXX
PETERMathsLearning46,5XXX
PETERMusicLearning7,47,55XXX
PETERMusicCooperation6,57,25XXX
MikeSpanishCooperation6,56,5XXX
This is my Pivot table for this egI would like to see 2 stead of 7
Row LabelsAverage of Initial MarkAverage of Final MarkCount of Student
XXX5,916,407
YYY6,506,501
Grand Total5,996,418
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
If using Excel 2016 and onwards if you check the 'Add this data to the Data Model' when creating the Pivot Table you can do a distinct count of student rather than count of rows

1634219588278.png


So if you add your Student to the values field in the pivot table, it will count all rows. If you then right click on this field in the pivot table and go to Value Field Settings then go to the bottom of the list and select Distinct Count as per below it will give the desired result

1634219663441.png
 
Upvote 0
Solution

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top