How to Sum Values for Each Unique Key in Excel
Question details
The user needs a method to group data by unique identifiers and calculate the total sum of values associated with each identifier.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Summarizing large transaction lists by specific categories such as account number, customer name, product ID, or other repetitive identifiers.
- Observed behavior
- The user wants to generate an organized summary table that automatically extracts unique keys and displays their aggregated sum totals, rather than manually adding up individual rows.
Ensure your dataset is formatted as a proper table with clear column headers, and remove any blank rows or automatic subtotals before generating your summary.
Use an Excel PivotTable to Sum by Unique Key
The fastest and most reliable way to aggregate data by unique identifiers without writing complex formulas.
PivotTables are specifically designed to group, summarize, and calculate data. They are highly flexible and allow you to sum unique keys in just a few clicks. However, keep in mind that PivotTables do not update automatically and require a manual refresh when your source data changes.
Highlight your entire data table, navigate to the 'Insert' tab on the top ribbon, and click 'PivotTable'. Choose to place the PivotTable on a new or existing worksheet.
In the PivotTable Fields pane on the right side of the screen, click and drag your unique identifier field (e.g., Customer, Product ID) into the 'Rows' area.
Drag the numerical field you want to calculate into the 'Values' area. Excel will automatically apply the 'Sum of' aggregation to calculate the total for each unique key.

Use UNIQUE and SUMIFS Formulas
Best for Microsoft 365 users who want a fully dynamic summary that updates automatically.
Easily Sum Unique Keys with WPS Spreadsheet
WPS Spreadsheet provides powerful PivotTable tools and comprehensive formula support (including SUMIFS) to help you effortlessly summarize data. It is highly compatible with Microsoft Excel formats and offers a familiar interface.
- 1. Open Your Data: Launch WPS Spreadsheet and open the document containing your data.
- 2. Create a PivotTable: Select your dataset, click the 'Insert' tab, and choose 'PivotTable'.
- 3. Group and Sum: Drag your identifier to the 'Rows' box and the number column to the 'Values' box to instantly view the sum for each unique key.

Frequently Asked Questions
Why is my PivotTable counting values instead of summing them?
This usually happens if your value column contains blank cells or text entries. To fix this, right-click any number in the PivotTable's value column, select 'Value Field Settings', and change the calculation type from 'Count' to 'Sum'.
Do I need the latest version of Excel to sum unique keys using formulas?
The UNIQUE function is only available in newer versions like Microsoft 365 or the latest WPS Office. If you are using an older version, you can achieve similar results by using the 'Advanced Filter' tool to copy unique records to a new location, and then applying the SUMIF formula.
How can I calculate averages or maximum values instead of sums?
If using a PivotTable, simply right-click the values area, choose 'Value Field Settings', and select 'Average', 'Max', or 'Min'. If you are using formulas, replace the SUMIFS function with AVERAGEIFS, MAXIFS, or MINIFS.




