Excel-macro to group by column & sum value

 Joe -
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

1 reply

Registration date
Sunday June 14, 2009
Last seen
August 7, 2021
download the file "joe.xls" from this web page
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.
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2821 users have said thank you to us this month

Thanks alot! It worked well on my spreadsheet.