Thanks:  0
Likes:  0

# Thread: Subtotals, Totals and GrandTotals

1. How does one programatically create subtotals, totals, and then GrandTotals.

I have data that once is entered I want to create the totals. I am keying off of the fact that in column a, there will either be numbers which represent skus, or the word Subtotal, Total, Grand Total.

Does anyone have a looping construct that will automatically create the sums in those indicated rows? The logic being that Subtotals are the totals of the prices above it. The Total is the sum of the just the subtotals above it, and finally the Grand Total is the sum of all the totals.

There can be multiple totals.

A | B

123 | 12.5
234 | 23.5
345 | 25.8
Subtotal abc

344 | 12.3
365 | 23.2
Subtotal bcd
Total = YYY (abc+bcd)

456 | 23.3
989 | 12.1
Subtotal cde

567 | 34.9
890 | 17.5
Subotal def
Total xyz (cde +def)
Grand Total XYXY (all totals)

Thanks

2. Try using the subtotal method. Data|Subtotals

3. I can't. Has to be done programatically since I am creating the spreadsheet from a setup sheet. In other words the individual sets up a set of skus and they want to create subtotals and totals. These are different for each individual. Of course once I figure out these totals I will be able to use them in other sheets too.

4. The subtotal method can also be done in VBA. Look up the subtotal function.

5. ## Re: Subtotals, Totals and GrandTotals

Ok, if a visual basic code can be written for this type of scenario, I have the same scenario, can it be adapted easily or deleting or adding a section? I have a need for a subtotal, total system that will auto-adjust if a section is added or deleted. (Salespersons that leave and sections are combined or salespeople added in surplus and sections are added). I am trying to create something for a group of people less excel savvy.

Please help me out. I think I am getting close

6. ## Re: Subtotals, Totals and GrandTotals

Jimijon, don't forget your good friend - the macro recorder!

## User Tag List

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•