How to Create Charts for Open and Closed Pupil Data in Excel
Question details
The user needs to create charts to visualize pupil analysis data, specifically showing open and closed pupil statuses categorized by gender and academic year.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Analyzing and charting pupil enrollment status data by demographic and temporal factors using an Excel worksheet.
- Observed behavior
- The COUNTIFS formulas fail to calculate correctly due to trailing spaces in the data columns, resulting in inaccurate or blank charts.
Before cleaning your data, ensure you identify which columns contain the hidden trailing spaces, as this dictates where you need to apply text-cleaning functions.
Clean Trailing Spaces and Create a PivotChart
Use text-cleaning functions to remove hidden spaces that break formulas, then utilize a PivotTable and PivotChart for dynamic data visualization.
Trailing spaces in your dataset are a common reason why aggregation formulas like COUNTIFS return zero or incorrect values. Excel treats 'Open' and 'Open ' as two entirely different text strings.
Instead of relying on complex COUNTIFS formulas, PivotTables offer a much more robust and flexible way to analyze multidimensional data like gender, year, and status.
Create a new helper column next to your pupil status data. Type =TRIM(A2) (assuming A2 is your first data cell) and press Enter. Drag the fill handle down to apply this formula to the entire column. Copy the newly trimmed column and paste it as 'Values' over the original data to remove the trailing spaces.
Select your newly cleaned dataset. Navigate to the 'Insert' tab on the Excel ribbon and click 'PivotTable'. Choose to place the PivotTable on a New Worksheet and click 'OK'.
In the PivotTable Fields pane, drag 'Gender' and 'Year' into the Rows or Axis area. Drag the 'Status' (Open/Closed) into the Columns area. Finally, drag 'Pupil ID' or 'Name' into the Values area, ensuring it is set to 'Count'.
Click anywhere inside your configured PivotTable. Go to the 'Insert' tab and click 'PivotChart'. Select a Clustered Column or Stacked Bar chart to visually compare the open and closed statuses across the different demographics.

Create Dynamic PivotCharts Easily in WPS Spreadsheet
WPS Spreadsheet provides powerful data cleaning tools and an intuitive PivotTable interface, making it incredibly simple to analyze complex pupil data and generate accurate visual reports.
- 1. Clean Data: Open your dataset in WPS Spreadsheet and use the TRIM function to remove any trailing spaces that disrupt your data counting.
- 2. Insert PivotTable: Highlight your data range, navigate to the 'Insert' tab, and click 'PivotTable' to organize the pupil data by gender and year.
- 3. Generate PivotChart: With the PivotTable selected, click on 'Insert PivotChart' to instantly visualize the open and closed pupil statuses.

Frequently Asked Questions
Why is my COUNTIFS formula returning zero when the data is clearly there?
This is almost always caused by invisible formatting issues, such as trailing spaces or non-breaking spaces at the end of your text strings. Excel reads 'Closed' and 'Closed ' as different values. Using the TRIM function on your data will remove these spaces and fix the formula.
What is the best way to visualize categorized data like gender and academic year?
A PivotChart is highly recommended. It dynamically aggregates the data and allows you to easily group multiple categories (like year and gender) into columns and rows without needing to write or maintain complex formulas.
Can I automatically remove trailing spaces without using formulas?
Yes, you can use the Power Query feature or the 'Find and Replace' tool. However, 'Find and Replace' (replacing a space with nothing) will remove all spaces, including those between words. For trailing spaces specifically, using the TRIM function in a helper column is the safest and most accurate method.




