How to Combine Duplicate PivotTable Items Caused by Hidden Characters
Question details
The user needs to consolidate duplicate rows or labels in a PivotTable that appear identical but are being treated as separate items by the software.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Importing text data and generating a PivotTable where categorical labels should be grouped together into single rows.
- Observed behavior
- The PivotTable displays two or more separate rows with the exact same visible label instead of consolidating them, typically caused by trailing spaces or hidden characters in the source data.
Verify that your PivotTable is connected to the exact data range you intend to edit, and ensure you have identified which specific column is generating the duplicated labels.
Use TRIM and CLEAN Functions to Remove Hidden Characters
This solution normalizes the source data by removing extra spaces and non-printing formatting characters commonly found in imported data.
Often, data copied from a web page or another database carries hidden characters or non-breaking spaces. To the naked eye, the labels look exactly the same, but the spreadsheet engine reads them as unique strings. Cleaning the source data is the only reliable way to fix the PivotTable aggregation.
In an empty cell, test the two duplicates by typing a comparison formula like =B5=B25 (replace with your cell references). If this returns FALSE, the cells contain hidden differences.
Insert a new column next to your data. Enter the formula =TRIM(CLEAN(A2)) to remove leading/trailing spaces and non-printing characters. If the data is from the web, non-breaking spaces may exist; run =TRIM(CLEAN(SUBSTITUTE(A2, CHAR(160), " "))) instead.
Copy the newly created formula column, select the original messy data column, right-click, select 'Paste Special,' and click 'Values' to convert the formulas back to static text.
Return to your PivotTable sheet, right-click anywhere inside the PivotTable, and select 'Refresh' from the context menu to re-calculate the categories and combine the duplicates.

Easily Manage and Clean PivotTable Data in WPS Spreadsheet
WPS Spreadsheet provides a robust platform for data analysis. You can effortlessly clean hidden characters using built-in functions, manage complex PivotTables, and analyze large datasets efficiently.
- 1. Open your file in WPS Spreadsheet: Launch WPS Office, select Spreadsheet, and open your existing .xlsx file containing the PivotTable.
- 2. Apply data cleaning formulas: Navigate to the Formulas tab to easily insert TRIM and CLEAN functions in an adjacent column to normalize your labels.
- 3. Refresh your PivotTable: Right-click your PivotTable and click 'Refresh Data' to instantly combine the duplicate items using the newly cleaned source data.

Frequently Asked Questions
Why does my PivotTable show the same item twice?
This usually happens because the source data contains hidden characters, leading or trailing spaces, or non-breaking spaces. Even if 'Apple' and 'Apple ' look identical, the trailing space makes the spreadsheet read them as completely different values.
How can I quickly find out if two cells contain identical data?
You can use a simple logical formula. Select an empty cell and type =A2=A3 (replacing A2 and A3 with your cell references). If it returns FALSE, there are hidden differences in the text.
Does the TRIM function remove all hidden characters?
No, TRIM only removes regular spaces. To remove non-printing ASCII characters, you also need to use the CLEAN function. For non-breaking spaces (often found in web data), you must use the SUBSTITUTE function to replace CHAR(160) with a regular space before using TRIM.
Why didn't my PivotTable update automatically after I cleaned the source data?
PivotTables cache their source data in memory to maintain performance, meaning they do not update automatically when the original cells change. You must always right-click inside the PivotTable and select 'Refresh' to see your changes applied.




