![]() |
Adding sub-total
Hi, I got a column with items and their categories. I need to sum up those
belonging to the same category. I am thinking of looping the column and comparing the 1st row with the 2nd row, if they are the same, I add them up. But I don't how to continue from there. Please advise. Elsie |
Adding sub-total
Hi,
If your list is like this state price NY 2 NY 33 NY 4 NY 4 NY 5 NY 35 CT 25 CT 32 CT 234 CT 234 then select the whole table then use DAta subtotal to get something like this state price NY 2 NY 33 NY 4 NY 4 NY 5 NY 35 NY Total 83 CT 25 CT 32 CT 234 CT 234 CT Total 525 Grand Total 608 hope it helps. Elsie wrote: Hi, I got a column with items and their categories. I need to sum up those belonging to the same category. I am thinking of looping the column and comparing the 1st row with the 2nd row, if they are the same, I add them up. But I don't how to continue from there. Please advise. Elsie |
Adding sub-total
Thanks for your suggestion cesar. But I need it to run automatically.
A sample of my data as follows: Category Unit Price Prev Mth Qty Prev Mth Amt This Mth Qty This Mth Amt YTD Qty YTD Amt ACC 100 1 100 2 200 3 300 ACC 200 0 0 1 200 1 200 I need a macro to sum up the prev mth qty and amt columns and this mth qty and amt columns and the ytd qty and amt columns. Anyone got any ideas? I think the code needed will be quite complex. Please help , I'm quite a newbie in VBA. Thanks. Elsie "Cesar Zapata" wrote in message ... Hi, If your list is like this state price NY 2 NY 33 NY 4 NY 4 NY 5 NY 35 CT 25 CT 32 CT 234 CT 234 then select the whole table then use DAta subtotal to get something like this state price NY 2 NY 33 NY 4 NY 4 NY 5 NY 35 NY Total 83 CT 25 CT 32 CT 234 CT 234 CT Total 525 Grand Total 608 hope it helps. Elsie wrote: Hi, I got a column with items and their categories. I need to sum up those belonging to the same category. I am thinking of looping the column and comparing the 1st row with the 2nd row, if they are the same, I add them up. But I don't how to continue from there. Please advise. Elsie |
All times are GMT +1. The time now is 10:51 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com