How to merge duplicate rows and sum the values in excel
Tutor 5 (95 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
Merging duplicate rows and summing values in Excel means consolidating rows that share the same identifier and calculating the total of one or more numeric columns for each unique identifier.
Method 1: Use a PivotTable (Fastest and Most Reliable)
Why use a PivotTable?
A PivotTable groups duplicate entries automatically and applies aggregation logic with high accuracy. This method handles large datasets efficiently and reduces manual errors.
Steps
Select the entire dataset, including headers.
Go to the Insert tab.
Click PivotTable.
Choose From Table/Range.
Select New Worksheet.
Click OK.
Drag the column containing duplicates into the Rows area.
Drag the column containing numbers into the Values area.
Confirm the Values field shows Sum.
Windows vs Mac
Windows shows the PivotTable Fields pane docked on the right.
Mac shows the PivotTable Builder pane floating or docked on the right.
Method 2: Use SUMIF or SUMIFS (Formula-Based Control)
When is this method appropriate?
This method fits structured reports where results must appear beside a predefined list of unique values.
Steps
Create a column containing unique identifiers.
Select the cell next to the first unique identifier.
Enter a SUMIF formula.
Fill the formula down.
Example
=SUMIF(A:A, E2, B:B)
Explanation
Column A contains duplicate identifiers.
Column B contains numeric values.
Cell E2 contains a unique identifier.
Excel returns the total for matching rows.
Windows vs Mac
No functional difference exists between platforms.
Method 3: Use Power Query (Best for Repeated Tasks)
Why use Power Query?
Power Query performs repeatable data transformations and refreshes results automatically when source data changes.
Steps
Select the dataset.
Go to the Data tab.
Click From Table/Range.
Confirm headers are correct.
Click OK.
Select the duplicate identifier column.
Go to Transform.
Click Group By.
Choose Sum for numeric columns.
Click Close & Load.
Windows vs Mac
Windows supports full Power Query functionality.
Mac supports Power Query with fewer advanced transformation options.
Method 4: Use Remove Duplicates Combined with SUMIF
Why use this method?
This approach works when the original table must remain visible and calculations need separation.
Steps
Copy the identifier column to a new location.
Select the copied column.
Go to Data.
Click Remove Duplicates.
Apply a SUMIF formula next to each unique value.
Which method produces the most accurate results?
PivotTables and Power Query produce the most accurate results due to automatic grouping logic and reduced dependency on manual formulas.
Does Excel merge rows visually when summing duplicates?
No. Excel consolidates data logically, not by physically merging cells, which preserves data integrity and calculation accuracy.
Can multiple columns be summed at the same time?
Yes. PivotTables and Power Query support multiple numeric columns with independent aggregation rules.
Does sorting affect the final result?
No. Aggregation depends on matching values, not row order.
Are blank cells included in the sum?
No. Excel ignores blank cells during summation and treats them as zero values.
Does this work with large datasets?
Yes. PivotTables and Power Query handle hundreds of thousands of rows with stable performance and low memory overhead.
Which method should be used for automation?
Power Query should be used for automation because refresh operations reapply transformations without manual intervention.
. Was this Helpful?Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
What is the formula to highlight duplicate values
Answers · 1
What is the formula to remove duplicates
Answers · 1
How to delete duplicate values in excel
Answers · 1
How to delete duplicate rows based on one column
Answers · 1