Excel-macro to group by column & sum value

Solved/Closed
Joe - Dec 9, 2011 at 12:23 PM
 Joe - Dec 10, 2011 at 10:19 AM
I was searching your web site for an example of how to group two columns and sum two different columns. I found an example under the question "Excel - Macro to group by column & sum value" but this only summed one column. Is there a way to have it sum two columns? Thanks, Joe
This is my example
Item Qty Length $ Sold
A 1 100 $50
A 1 100 $50
B 2 200 $120
B 1 100 $30
B 5 100 $150
C 4 200 $600
C 2 100 $150
C 1 200 $150
C 3 100 $225
Basically I want to group by Column A (i.e. Item) and Column C (i.e. length) and also wants to add total of quantity and $ Sold for each change in lengths for an item. In this case, the result on new sheet would be as below:
Item Qty Length $ Sold
A 2 100 $100
B 2 200 $120
B 6 100 $180
C 5 200 $750
C 5 100 $375

Related:

1 response

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Dec 9, 2011 at 10:30 PM
download the file "joe.xls" from this web page
http://speedy.sh/4u6ch/JOE.XLS
as the two relevant columns item and length are not contiguous I have to copy only these two columns in col. F and G
now on this F and G column advanced filter was used with criteria range as I1:J1
and the result in I1 (with "copy to another location" and "unique records only" chosen in the advanced filter window.

you get what you have in column I and j
see formulas K2 and L2 which is copied down.

this is spread sheet solution.
4
Thanks alot! It worked well on my spreadsheet.
0