Hi @nancy ross,
Welcome to Microsoft Q&A forum.
You were trying to use a PivotTable to count the total number of times each person's name appeared in each specific role column (Class President, Secretary, etc.), but the PivotTable wasn't grouping and counting the names by their respective columns as you intended.
To achieve the desired outcome, start by restructuring (unpivoting) your data. The simplest way to accomplish this is by using Excel’s built-in Power Query tool.
While my dataset is slightly different from your example, it is intended for the same objective. I have provided my data below for your review and testing.
Please follow the steps outlined below:
Step 1: Unpivot your data with Power Query
- Select your entire data table (including the headers).
- Go to the Data tab on the ribbon.
- In the "Get and Transform Data" section, click From Table/Range.
- In the editor, select all of the role columns (click the "Class President" header, then hold Shift and click the last column header, "Names").
- Go to the Transform tab.
- Click the Unpivot Columns button.
- Now, go to the Home tab and click Close & Load. This will create a new worksheet in your workbook with this new, properly formatted table.
Step 2: Create your PivotTable
Now that you have your new unpivoted data, creating the PivotTable is simple.
- Click anywhere inside your new two-column table (the one you just loaded from Power Query).
- Go to the Insert tab and click PivotTable.
- In the "PivotTable Fields" pane on the right:
- Drag Name to the Rows area.
- Drag Role to the Columns area.
- Drag Name again to the Values area.
- Drag Name again to the Values area.
It should automatically set to Count of Name, and your PivotTable will instantly look exactly like the example in your third image.
I hope this information is helpful. Please follow these steps and let me know if it works for you. If not, we can work together to resolve this.
Thank you for your patience and your understanding. If you have any questions, please feel free to reach out.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.