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 Mar 12th, 2002, 08:22 AM   #1
lbgolferga
New Member
 
Join Date: Mar 2002
Posts: 5
Default

I am trying to gather and sum multiple conditions over several worksheets. I have tried this:
=SUMPRODUCT((('NVDM Direct No Maint'!S4:S30="LB")*('NVDM Direct No Maint'!F4:F30={"1-B","1-T","1-B,T","1-T,B"})+('NVDM Direct Maint '!S4:S133="LB")*('NVDM Direct Maint '!F4:F133={"1-B","1-T","1-B,T","1-T,B"})+('Distributor HPO'!S4:S4="LB")*('Distributor HPO'!F4:F4={"1-B","1-T","1-B,T","1-T,B"}))
Which always gives me a #NA error. If I shorten it to just:
=SUMPRODUCT(('NVDM Direct Maint '!S4:S133="LB")*('NVDM Direct Maint '!F4:F133={"1-B","1-T","1-B,T","1-T,B"}))
It works fine, but adding any other number of worksheets gives the #NA error. Is this not allowed?
lbgolferga is offline   Reply With Quote
Old Mar 12th, 2002, 12:32 PM   #2
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-03-12 07:22, lbgolferga wrote:
I am trying to gather and sum multiple conditions over several worksheets. I have tried this:
=SUMPRODUCT((('NVDM Direct No Maint'!S4:S30="LB")*('NVDM Direct No Maint'!F4:F30={"1-B","1-T","1-B,T","1-T,B"})+('NVDM Direct Maint '!S4:S133="LB")*('NVDM Direct Maint '!F4:F133={"1-B","1-T","1-B,T","1-T,B"})+('Distributor HPO'!S4:S4="LB")*('Distributor HPO'!F4:F4={"1-B","1-T","1-B,T","1-T,B"}))
Which always gives me a #NA error. If I shorten it to just:
=SUMPRODUCT(('NVDM Direct Maint '!S4:S133="LB")*('NVDM Direct Maint '!F4:F133={"1-B","1-T","1-B,T","1-T,B"}))
It works fine, but adding any other number of worksheets gives the #NA error. Is this not allowed?
Are you trying to total the results of multiconditional sums from different worksheets?
Aladin Akyurek is offline   Reply With Quote
Old Mar 12th, 2002, 12:35 PM   #3
Guest
 
Posts: n/a
Default

Quote:
On 2002-03-12 11:32, Aladin Akyurek wrote:
Quote:
On 2002-03-12 07:22, lbgolferga wrote:
I am trying to gather and sum multiple conditions over several worksheets. I have tried this:
=SUMPRODUCT((('NVDM Direct No Maint'!S4:S30="LB")*('NVDM Direct No Maint'!F4:F30={"1-B","1-T","1-B,T","1-T,B"})+('NVDM Direct Maint '!S4:S133="LB")*('NVDM Direct Maint '!F4:F133={"1-B","1-T","1-B,T","1-T,B"})+('Distributor HPO'!S4:S4="LB")*('Distributor HPO'!F4:F4={"1-B","1-T","1-B,T","1-T,B"}))
Which always gives me a #NA error. If I shorten it to just:
=SUMPRODUCT(('NVDM Direct Maint '!S4:S133="LB")*('NVDM Direct Maint '!F4:F133={"1-B","1-T","1-B,T","1-T,B"}))
It works fine, but adding any other number of worksheets gives the #NA error. Is this not allowed?
Are you trying to total the results of multiconditional sums from different worksheets?
Not exactly, I am trying to count the number of occurances of certain conditions over multiple worksheets.
  Reply With Quote
Old Mar 12th, 2002, 01:04 PM   #4
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-03-12 11:35, Anonymous wrote:
Quote:
On 2002-03-12 11:32, Aladin Akyurek wrote:
Quote:
On 2002-03-12 07:22, lbgolferga wrote:
I am trying to gather and sum multiple conditions over several worksheets. I have tried this:
=SUMPRODUCT((('NVDM Direct No Maint'!S4:S30="LB")*('NVDM Direct No Maint'!F4:F30={"1-B","1-T","1-B,T","1-T,B"})+('NVDM Direct Maint '!S4:S133="LB")*('NVDM Direct Maint '!F4:F133={"1-B","1-T","1-B,T","1-T,B"})+('Distributor HPO'!S4:S4="LB")*('Distributor HPO'!F4:F4={"1-B","1-T","1-B,T","1-T,B"}))
Which always gives me a #NA error. If I shorten it to just:
=SUMPRODUCT(('NVDM Direct Maint '!S4:S133="LB")*('NVDM Direct Maint '!F4:F133={"1-B","1-T","1-B,T","1-T,B"}))
It works fine, but adding any other number of worksheets gives the #NA error. Is this not allowed?
Are you trying to total the results of multiconditional sums from different worksheets?
Not exactly, I am trying to count the number of occurances of certain conditions over multiple worksheets.
lbgolferga,

If it's totaling of multiconditional counts (I said "sums" by mistake), you need:

=SUMPRODUCT(...)+SUMPRODUCT(...)+...

If you're OR'ing over multiple sheets, as you seem to do, the ranges tested must be of equal size:

Lets say that A1:B4 in Sheet1 houses the following sample:

{"a",1;"a",2;"b",2;"a",1}

and B4:C7 in Sheet2

{"a",1;"a",8;"b",2;"a",9}

Suppose I want to count records consisting of "a" and 1 in both sheets:

The formula that follows, entered in some cell in Sheet3,

[1]

=SUMPRODUCT((Sheet1!A1:A4="a")*(Sheet1!B1:B4=1)+(Sheet2!B4:B7="a")*(Sheet2!C4:C7=1))

gives us a total count of 3.

Lets pretend that the range in Sheet2 is

B4:C6 (instead of B4:C7). Notice that the size of the B4:C6 range is smaller than the size of the range of interest in Sheet1.

The [1] adapted as

[2]

=SUMPRODUCT((Sheet1!A1:A4="a")*(Sheet1!B1:B4=1)+(Sheet2!B4:B6="a")*(Sheet2!C4:C6=1))

gives us #N/A.

Whereas

[3]

=SUMPRODUCT((Sheet1!A1:A4="a")*(Sheet1!B1:B4=1))+SUMPRODUCT((Sheet2!B4:B6="a")*(Sheet2!C4:C6=1))

will give us the correct count of 3.

Aladin

Aladin Akyurek is offline   Reply With Quote
Old Mar 12th, 2002, 02:25 PM   #5
lbgolferga
New Member
 
Join Date: Mar 2002
Posts: 5
Default

Quote:
On 2002-03-12 12:04, Aladin Akyurek wrote:
Quote:
On 2002-03-12 11:35, Anonymous wrote:
Quote:
On 2002-03-12 11:32, Aladin Akyurek wrote:
Quote:
On 2002-03-12 07:22, lbgolferga wrote:
I am trying to gather and sum multiple conditions over several worksheets. I have tried this:
=SUMPRODUCT((('NVDM Direct No Maint'!S4:S30="LB")*('NVDM Direct No Maint'!F4:F30={"1-B","1-T","1-B,T","1-T,B"})+('NVDM Direct Maint '!S4:S133="LB")*('NVDM Direct Maint '!F4:F133={"1-B","1-T","1-B,T","1-T,B"})+('Distributor HPO'!S4:S4="LB")*('Distributor HPO'!F4:F4={"1-B","1-T","1-B,T","1-T,B"}))
Which always gives me a #NA error. If I shorten it to just:
=SUMPRODUCT(('NVDM Direct Maint '!S4:S133="LB")*('NVDM Direct Maint '!F4:F133={"1-B","1-T","1-B,T","1-T,B"}))
It works fine, but adding any other number of worksheets gives the #NA error. Is this not allowed?
Are you trying to total the results of multiconditional sums from different worksheets?
Not exactly, I am trying to count the number of occurances of certain conditions over multiple worksheets.
lbgolferga,

If it's totaling of multiconditional counts (I said "sums" by mistake), you need:

=SUMPRODUCT(...)+SUMPRODUCT(...)+...

If you're OR'ing over multiple sheets, as you seem to do, the ranges tested must be of equal size:

Lets say that A1:B4 in Sheet1 houses the following sample:

{"a",1;"a",2;"b",2;"a",1}

and B4:C7 in Sheet2

{"a",1;"a",8;"b",2;"a",9}

Suppose I want to count records consisting of "a" and 1 in both sheets:

The formula that follows, entered in some cell in Sheet3,

[1]

=SUMPRODUCT((Sheet1!A1:A4="a")*(Sheet1!B1:B4=1)+(Sheet2!B4:B7="a")*(Sheet2!C4:C7=1))

gives us a total count of 3.

Lets pretend that the range in Sheet2 is

B4:C6 (instead of B4:C7). Notice that the size of the B4:C6 range is smaller than the size of the range of interest in Sheet1.

The [1] adapted as

[2]

=SUMPRODUCT((Sheet1!A1:A4="a")*(Sheet1!B1:B4=1)+(Sheet2!B4:B6="a")*(Sheet2!C4:C6=1))

gives us #N/A.

Whereas

[3]

=SUMPRODUCT((Sheet1!A1:A4="a")*(Sheet1!B1:B4=1))+SUMPRODUCT((Sheet2!B4:B6="a")*(Sheet2!C4:C6=1))

will give us the correct count of 3.

Aladin

Aladin,

I have overlooked the very important fact that the ranges must be of equal size. Your analysis and proposed solution is exactly correct and corrects my error. Thank You again for shedding some light where there was only darkness.

lbgolferga 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 06:40 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