Solved

Excel VBA Sum amount of identical rows and delete duplicate

Posted on 2014-11-06
5
140 Views
Last Modified: 2014-11-06
please see attached File.

I have two tables,  the current one and the result needed.

i need to VBA that when i run in on current it make it like the "result needed"

basically, i have a huge data that i want to get rid of the identical rows by summing thier Order total and then deleting them.

thank you.
EE.xlsx
0
Comment
Question by:Flora
  • 3
  • 2
5 Comments
 
LVL 33

Accepted Solution

by:
Rob Henson earned 500 total points
ID: 40426394
Create a Pivot Table on the source data and have all columns populate into the pivot table with Order as a row header by which to sum. Choose option in Pivot Design tab ? Report layout > Repeat all Item labels.

Copy Pivot and Paste Values to break link to source data.

Re-arrange to put Order column back where required.

Delete Original Data.

Thanks
Rob H
0
 
LVL 6

Author Comment

by:Flora
ID: 40426437
Thank you Rob.

i need to do this everyday for a new set of data and pivot table can take alot of time.  would this be possible to be done programmatically using VBA?

thanks again
0
 
LVL 6

Author Comment

by:Flora
ID: 40426537
Dear Rob,

I think i am going to accept and use the solution you have provided.

i think this is the best way to do this.

thank you very much for your help.
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 40426604
If you leave the pivot with links to the source data and copy/paste elsewhere each time, you can then just update source with new data, refresh pivot, copy elsewhere again.

The pivot data range can be dynamic for when the size of the data changes.

Thanks
Rob
0
 
LVL 6

Author Comment

by:Flora
ID: 40426611
Thank you Rob.

this is very helpful
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Limit the # times a macro code will run 14 50
Excel Calculation 4 46
Excel - INDEX MATCH error 13 23
Testing for the presence of text in a range of cells 3 10
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question