Sum Duplicate Rows in Excel

No_Hedge

New Member
Joined
Jul 6, 2017
Messages
2
Hello,

I'm tracking truck deliveries. I have a dynamic data set. I want to consolidate the data and sum duplicate lines. Below is my example:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]CONCAT Code[/TD]
[TD]Delivery Date[/TD]
[TD]Customer[/TD]
[TD]Origin[/TD]
[TD]Destination[/TD]
[TD]Line #[/TD]
[TD]Carrier[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]7/6/2017[/TD]
[TD]Oil Co.
[/TD]
[TD]Houston[/TD]
[TD]Dallas[/TD]
[TD]1[/TD]
[TD]Energy Transport[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]7/6/2017[/TD]
[TD]Fuel Ltd.[/TD]
[TD]Oklahoma City[/TD]
[TD]Kansas City[/TD]
[TD]1[/TD]
[TD]Tanker Co.[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]7/6/2017[/TD]
[TD]Oil Co.[/TD]
[TD]Houston[/TD]
[TD]Dallas[/TD]
[TD]1[/TD]
[TD]Energy Transport[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]7/6/2017[/TD]
[TD]Oil Co.[/TD]
[TD]Houston[/TD]
[TD]Dallas[/TD]
[TD]1[/TD]
[TD]Fuel Delivery[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]7/6/2017[/TD]
[TD]Fuel Ltd.[/TD]
[TD]Oklahoma City[/TD]
[TD]Kansas City[/TD]
[TD]1[/TD]
[TD]Tanker Co.[/TD]
[/TR]
</tbody>[/TABLE]

I want to sum/count the "Line #" column for duplicate rows. I'm not too worried about deleting duplicate rows as once counted I can clear all duplicates in the data set. I do have a CONCAT code in Column A in order to make referencing easier. Any help is much appreciated!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Welcome to the forum!

You can use a SUMPRODUCT function to find the sum of rows that match in columns B:G (with the exception of F/Line#). This is entered as an array, so may take a bit if you have a large data set. It would only be valid prior to deleting rows, so you'd have to hand type the number into line number manually. You could also create a macro to do all of this work for you. (depending on your comfort and skill level)


Excel 2010
ABCDEFGH
1CONCAT CodeDelivery DateCustomerOriginDestinationLine #Carrier
27/6/2017Oil Co.HoustonDallas1Energy Transport2
37/6/2017Fuel Ltd.Oklahoma CityKansas City1Tanker Co.2
47/6/2017Oil Co.HoustonDallas1Energy Transport2
57/6/2017Oil Co.HoustonDallas1Fuel Delivery1
67/6/2017Fuel Ltd.Oklahoma CityKansas City1Tanker Co.2
Sheet1
Cell Formulas
RangeFormula
H2{=SUMPRODUCT(--(B:B=B2),--(C:C=C2),--(D:D=D2),--(E:E=E2),--(G:G=G2),F:F)}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
CalcSux78,

This is definitely in the right direction. Since I have the identifying information concatenated in Column A, would the function look like the below?

{=SUMPRODUCT(--(A:A=A2),F:F)}

I am pretty comfortable with macros and VBA. Funny you mention it...I'm actually probably going to code a macro to apply the function and delete duplicates after function is applied. Sort of a workaround.
 
Upvote 0

Forum statistics

Threads
1,223,881
Messages
6,175,159
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top