How to Group and Sum Excel Rows Based on Three Matching Columns
Question details
The user needs to group data rows where the values in the first three columns are identical, and then calculate the sum of the fourth column for each resulting group.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Aggregating and consolidating tabular data based on multiple criteria columns.
- Observed behavior
- Data is listed in individual rows and needs to be consolidated into unique groups (based on 3 columns) with a summed total for the fourth column.
Ensure your dataset has clear column headers and no empty rows to prevent errors when creating PivotTables or applying advanced formulas.
Use a PivotTable to Group and Sum Data
A PivotTable is the fastest, no-code method to group multiple columns and calculate totals without altering your original data.
By placing multiple fields in the 'Rows' area of a PivotTable, you can create a grouped hierarchy. Adjusting the layout to 'Tabular Form' makes it look like a standard flat table.
Select your entire dataset, navigate to the Insert tab on the ribbon, and click PivotTable. Choose to place it on a new or existing worksheet.
In the PivotTable Fields pane, drag your first three columns into the 'Rows' area in the exact order you want them grouped.
Drag the fourth column (the one containing the values you want to total) into the 'Values' area. Ensure it is set to 'Sum' (if it says 'Count', click it, choose Value Field Settings, and change it to Sum).
To make the PivotTable look like a normal data table, go to the Design tab, click 'Report Layout', and select 'Show in Tabular Form'. Click 'Report Layout' again and choose 'Repeat All Item Labels'.

Use UNIQUE and SUMIFS Formulas
Ideal if you need the grouped data to update dynamically as the source data changes without having to manually refresh a PivotTable.
Use Power Query for Advanced Grouping
Best for large datasets or when you are importing data from external sources and want an automated cleaning pipeline.
Group and Summarize Data Easily with WPS Spreadsheet
WPS Spreadsheet provides powerful and intuitive tools like PivotTables and advanced dynamic array formulas to help you consolidate multi-column data quickly and accurately.
- 1. Open your file: Launch WPS Spreadsheet and open your dataset containing the columns.
- 2. Insert PivotTable: Navigate to the Insert tab on the top ribbon and click on 'PivotTable'.
- 3. Configure Fields: Drag your three matching columns to the 'Rows' box and the numeric column to 'Values' to get instant grouped sums.

Frequently Asked Questions
Can I sum based on more than three columns?
Yes, both PivotTables and the SUMIFS function can handle dozens of criteria columns. For PivotTables, simply drag additional fields into the Rows area. For SUMIFS, add more criteria range and criteria pairs to the end of the formula.
Why is my PivotTable showing 'Count' instead of 'Sum'?
If your value column contains any blank cells or text values, the PivotTable defaults to counting instead of summing. To fix this, right-click any value in the PivotTable, select 'Summarize Values By', and choose 'Sum'.
Will my grouped data update automatically if I change the original numbers?
If you use the UNIQUE and SUMIFS formula method, the totals will update instantly. If you use a PivotTable or Power Query, you will need to right-click the table and select 'Refresh' to see the updated totals.




