find duplicates in a column and sum

fenerbhace

New Member
Joined
Jun 14, 2018
Messages
1
Hi guys,

im new here and have a question.

I have a table with 14 colums. In colum D are costumer numbers. I want to check with a VBA if a costumer number inside more than one time.
In colum C are order quantities. If the costume numer dublicate i want to sum all of the order quantities from this costumer number and delet all dublikates.

Im sry for my bad english.

http://up.picr.de/32969679oo.jpg


Sub tester()letzte_Zeile = Sheets(1).UsedRange.SpecialCells(xlCellTypeLastCell).Row


For i = 1 To letzte_Zeile
For j = 2 To letzte_Zeile





If Cells(i, 4).Value = Cells(j, 4).Value Then
Cells(i, 3) = Cells(i, 3) + Cells(j, 3)
Rows(j).Delete
End If
Next j
Next i


End Sub

****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">order quantitiesorder quantities</body>
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hello and welcome to the board. Maybe someone will give you some code you need to do what you want, but if it were me, I would simply use a Pivot Table to do what you want, or if you have Power Pivot / Power Query that may be more flexible depending on what you need to do.
 
Upvote 0

Forum statistics

Threads
1,215,641
Messages
6,125,984
Members
449,276
Latest member
surendra75

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