![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Location: Chicago
Posts: 8
|
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 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Try using the subtotal method. Data|Subtotals
__________________
Kind regards, Al Chara |
|
|
|
|
|
#3 |
|
New Member
Join Date: Apr 2002
Location: Chicago
Posts: 8
|
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 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
The subtotal method can also be done in VBA. Look up the subtotal function.
__________________
Kind regards, Al Chara |
|
|
|
|
|
#5 |
|
New Member
Join Date: Dec 2003
Location: Denver, CO
Posts: 15
|
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 |
|
MrExcel MVP
Int'l Moderator Join Date: Jun 2002
Location: 39° 17' 15" N, -94° 40' 26" W
Posts: 9,610
|
Jimijon, don't forget your good friend - the macro recorder!
__________________
Greg ……………………………………………… Work: XL 2003, 2007 and 2010 on Windows 7 Please use CODE tags - especially for longer excerpts of code. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|