MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 5th, 2002, 01:37 PM   #1
Larry
New Member
 
Join Date: Apr 2002
Location: Plano, Texas
Posts: 29
Default

I know this can be done in a Pivot Table, but I am not using a Pivot. I have tried to code it out using a macro, but I have yet to be successful.

Any information will be greatly appreciated.
Larry is offline   Reply With Quote
Old Apr 5th, 2002, 02:05 PM   #2
dk
MrExcel MVP
 
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
Default

Hi,

Unfortunately you can't remove the Grand Total when using subtotals either manually or through code. If you omit the SummaryAboveData argument of the Subtotal method it will just default to adding the grand total at the bottom. The one way around this is to use some custom subtotal macro which subtotals the data and adds the SUBTOTAL formula for each change in your data. If you want some sample code then post an example of your data.

Regards,
Dan
dk is offline   Reply With Quote
Old Apr 5th, 2002, 02:07 PM   #3
Al Chara
MrExcel MVP
 
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
Default

You can't do it within the subtotal function, but how about something like the following:

Set GrandTotal = Cells.Find("Grand Total", LookIn:=xlWhole)
GrandTotal.EntireRow.Clear

__________________
Kind regards,

Al Chara
Al Chara is offline   Reply With Quote
Old Apr 5th, 2002, 02:11 PM   #4
Larry
New Member
 
Join Date: Apr 2002
Location: Plano, Texas
Posts: 29
Default

Thank your for the information. I have been banging my head against my desk for two days trying to do this. Below is some sample data. I am needing to include subtotals at each change in WMS Part#.

WMS
Part# AVL
54321 2
55432 1
56789 0

[ This Message was edited by: larry on 2002-04-05 13:16 ]
Larry is offline   Reply With Quote
Old Apr 5th, 2002, 02:17 PM   #5
Larry
New Member
 
Join Date: Apr 2002
Location: Plano, Texas
Posts: 29
Default

Al,

That worked to eliminate the GT row, but the range still exists. I am also needing to eliminate the range so I will still be able to dynamically set the print range.

Thanks for your help.
Larry is offline   Reply With Quote
Old Apr 5th, 2002, 03:20 PM   #6
Al Chara
MrExcel MVP
 
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
Default

Not sure if I know what you mean by eliminating the range, but you can try and replace "clear" with "delete". That might do what you want to do.
__________________
Kind regards,

Al Chara
Al Chara is offline   Reply With Quote
Old Apr 5th, 2002, 08:38 PM   #7
Larry
New Member
 
Join Date: Apr 2002
Location: Plano, Texas
Posts: 29
Default

By range, I am referring to the range at the left of the spreadsheet designated by the 1,2 and 3 buttons in the subtotal column. For some reason, when I refresh the data, the grand total row keeps being placed further and further down the spreadsheet even though the range of data is the same.



[ This Message was edited by: Larry on 2002-04-05 19:43 ]
Larry is offline   Reply With Quote
Old Apr 5th, 2002, 10:09 PM   #8
Anne Troy
MrExcel MVP
 
Anne Troy's Avatar
 
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,510
Default

Don't know if I'm helping here or not. Have you thought about doing the subtotals, then selecting all cells (except grand) and hitting Edit-Go to-Visible cells only and copy/paste to another worksheet?
__________________
~Anne Troy
Anne Troy is offline   Reply With Quote
Old Apr 6th, 2002, 01:15 AM   #9
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Larry,
Larry,

You seem to want just (sub)totals per WMS Part. It is not clear to me why you don't use Pivot Tables. What follows might also meet your need.

Consider the following sample in A1:B10 in a sheet called Data:

{"WMS Part#","AVL";
59238,2;
59238,1;
59239,3;
59239,2;
59241,1;
59241,3;
59242,2;
59242,1;
59244,2}

Activate the option Insert|Name|Define.
Enter NumDataRecs in the Names in Workbook box.
Enter in the Refers to box:

=MATCH(9.99999999999999E+307,Data!$B:$B)

Activate Add.

Enter WMSrange in the Names in Workbook box.
Enter in the Refers to box:

=OFFSET(Data!$A$2,0,0,NumDataRecs-1,1)

Activate Add.

Enter WMSrange in the Names in Workbook box.
Enter in the Refers to box:

=OFFSET(Data!$B$2,0,0,NumDataRecs-1,1)

Activate OK.

Note 1. The minus 1 in the NumDataRecs-1 bit refers to the fact that there is one row before the row where the actual data start.

Make a unique list of WMS Part#'s in A from A1 on (including the label 'WMS Part#') in a sheet called Summary. You can create such a list using Advanced Filter. In this sheet:

In B1 enter: SubTotals [ just a label ]

In B2 enter and copy down as far as needed:

=SUMIF(WMSrange,A2,AVLrange)

This is what you get in the results area in the Summary sheet:

{"WMS Part#","SubTotals";
59238,3;
59239,5;
59241,4;
59242,3;
59244,2}

For comparison: A Data|Subtotals approach would give you:

{"WMS Part#","AVL";
59238,2;
59238,1;
"59238 Total",3;
59239,3;
59239,2;
"59239 Total",5;
59241,1;
59241,3;
"59241 Total",4;
59242,2;
59242,1;
"59242 Total",3;
59244,2;
"59244 Total",2;
"Grand Total",17}

Note 2. The range names are so-called dynamic range names, allowing one to add records to and/or delete records from the data in the Data sheet without the need to adjust the SUMIF formula that we use here.

Aladin

Aladin Akyurek is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 07:09 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes