Solved

Excel VBA Sum amount of identical rows and delete duplicate

Posted on 2014-11-06
5
144 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

679 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