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 15th, 2002, 02:19 PM   #1
Big Blue
Board Regular
 
Join Date: Mar 2002
Location: Ontario
Posts: 52
Default

I am trying to replace cell ranges with named ranges in my array formulas, but I keep getting #NUM errors.

example: trying to replace A1:A1000 with Range1

why won't my arrays accept named ranges?
Big Blue is offline   Reply With Quote
Old Apr 15th, 2002, 02:29 PM   #2
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-15 13:19, Big Blue wrote:
I am trying to replace cell ranges with named ranges in my array formulas, but I keep getting #NUM errors.

example: trying to replace A1:A1000 with Range1

why won't my arrays accept named ranges?
Care to post the array formula in which you want to use range names, along with the type of data that each range houses?

Aladin
Aladin Akyurek is offline   Reply With Quote
Old Apr 15th, 2002, 02:57 PM   #3
Big Blue
Board Regular
 
Join Date: Mar 2002
Location: Ontario
Posts: 52
Default

{=SUM((salesbase2!$E$2:$E$1000>='02 Holidays'!$A13)*(salesbase2!$E$2:$E$1000<='02 Holidays'!$B13))}

col E is dates in ddmmyy format, as is
"02 Holidays' which is a 2 column worksheet of start/end dates for every week in 2002

I have named E:E as DATEIN and want to use it to replace salesbase2!$E$2:$E$1000

this formula effectively subtotals a count of log entries by work week.
Big Blue is offline   Reply With Quote
Old Apr 15th, 2002, 03:40 PM   #4
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-15 13:57, Big Blue wrote:
{=SUM((salesbase2!$E$2:$E$1000>='02 Holidays'!$A13)*(salesbase2!$E$2:$E$1000<='02 Holidays'!$B13))}

col E is dates in ddmmyy format, as is
"02 Holidays' which is a 2 column worksheet of start/end dates for every week in 2002

I have named E:E as DATEIN and want to use it to replace salesbase2!$E$2:$E$1000

this formula effectively subtotals a count of log entries by work week.
Array formulas do not accept whole columns as range arguments. DATEIN is E:E, so it cannot be used in your array formula.

May I propose a different scheme, which allows the relevant range in E to change by additions or deletions.

I'll assume that both worksheets salebase2 and 02 Holidays are in the same workbook.

Activate salebase2.
Activate the option Insert|Name|Define.
Enter as name DateRecs in the Names in Workbook box.
Enter as formula in the Refers to box:

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

Activate Add (don't leave the Define Name window yet).

Enter as name DATEIN in (or select it if already available from) the Names in Workbook box.
Enter as formula in the Refers to box:

=OFFSET(salebase2!$E$2,0,0,DateRecs-1,1)

Activate OK.

Now go to the worksheet 02 Holidays and in C13 enter either your array formula modified as

{=SUM((DATEIN>=$A13)*(DATEIN<=$B13))}

or, ordinarily entered,

=SUMPRODUCT((DATEIN>=$A13)*(DATEIN<=$B13))

However, if dates in A from A13 on and in B from B13 on are dates that define effectively calendar weeks, I'd suggest replacing them by a single range in A from A3 on where you create the 52 week numbers and using the following formula in B13:

=SUMPRODUCT((WEEKNUM(DATEIN)=$A13)+0)

Note. WEEKNUM is available from Analysis Toolpak (which is available thru Tools|Add-Ins).

Aladin
Aladin Akyurek is offline   Reply With Quote
Old Apr 16th, 2002, 07:53 AM   #5
Big Blue
Board Regular
 
Join Date: Mar 2002
Location: Ontario
Posts: 52
Default

Thank you Aladin
I think that may be an elegant solution.
However, I was surprised when I replaced other references to salesbase2!$E2:$E1000 with DateIn, and I wound up getting #N/A

example below:

{=SUM((DateIn>='02 Holidays'!$A13)*(DateIn<='02 Holidays'!$B13)*(salesbase2!$C$2:$C$1000="POC"))}

any ideas?
Big Blue is offline   Reply With Quote
Old Apr 16th, 2002, 08:35 AM   #6
Ian Mac
MrExcel MVP
 
Join Date: Feb 2002
Location: Newcastle, UK
Posts: 1,174
Default

Quote:
On 2002-04-16 06:53, Big Blue wrote:
Thank you Aladin
I think that may be an elegant solution.
However, I was surprised when I replaced other references to salesbase2!$E2:$E1000 with DateIn, and I wound up getting #N/A

example below:

{=SUM((DateIn>='02 Holidays'!$A13)*(DateIn<='02 Holidays'!$B13)*(salesbase2!$C$2:$C$1000="POC"))}

any ideas?
The ranges need in the array need to be the same, I suspect salesbase2!$C$2:$C$1000 is not the same size range as DateIn.

you can do the same as before with col C

=OFFSET(salebase2!$C$2,0,0,DateRecs-1,1)
and use a name appropriate to the column.

Then use:

{=SUM((DateIn>='02 Holidays'!$A13)*(DateIn<='02 Holidays'!$B13)*(AppropriateName="POC"))}

or

=SUMPRODUCT((DateIn>='02 Holidays'!$A13)*(DateIn<='02 Holidays'!$B13)*(AppropriateName="POC"))




__________________
"Have a good time......all the time"
Ian Mac
Ian Mac is offline   Reply With Quote
Old Apr 16th, 2002, 08:41 AM   #7
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-16 06:53, Big Blue wrote:
Thank you Aladin
I think that may be an elegant solution.
However, I was surprised when I replaced other references to salesbase2!$E2:$E1000 with DateIn, and I wound up getting #N/A

example below:

{=SUM((DateIn>='02 Holidays'!$A13)*(DateIn<='02 Holidays'!$B13)*(salesbase2!$C$2:$C$1000="POC"))}

any ideas?
It is not a good idea to mix fixed ranges with dynamic names ranges in an array or SUMPRODUCT formula, because it may lead to the problem of unequal sized ranges.

Give also a name, say, Crange, to the range $C$2:$C$1000 in salesbase2 following the proc I described by using the following formula in the Refers to box:

=OFFSET(salebase2!$C$2,0,0,DateRecs-1,1)

and change the array formula:

{=SUM((DateIn>='02 Holidays'!$A13)*(DateIn<='02 Holidays'!$B13)*(Crange="POC"))}


By the way, In which sheet is this formula?

Aladin
Aladin Akyurek is offline   Reply With Quote
Old Apr 16th, 2002, 08:53 AM   #8
Big Blue
Board Regular
 
Join Date: Mar 2002
Location: Ontario
Posts: 52
Default

Thanks Again.
The formulae are actually ina 3rd worksheet titled SUMMARY.

I take it then, that one has to use either all named ranges, or all cell ranges, but not a combination of both?

Any advantages (ie speed) to using SUMPRODUCT instead of Array?
Big Blue is offline   Reply With Quote
Old Apr 16th, 2002, 09:21 AM   #9
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

[i]
On 2002-04-16 07:53, Big Blue wrote:
Thanks Again.
The formulae are actually ina 3rd worksheet titled SUMMARY.

I take it then, that one has to use either all named ranges, or all cell ranges, but not a combination of both?

The main reason not to mix up is that the OFFSET formulas (if set up correctly) will pick out the exact used range which might not be equal in size to the size fixed range, making the formula run havoc.

Any advantages (ie speed) to using SUMPRODUCT instead of Array?

Presumably not in speed. When both applicable, with SUMPRODUCT you don't have the hassle of control+shift+enter when entering and after an edit. You might experience some improvement in performance because of dynamic name ranges, but not enough. If your data is date-oriented (consists of ascending dates) and since you're doing counts and totals, you can attempt to further reduce the ranges the array or SUMPRODUCT formulas look at. You can find an example for this approach at this board in a reply to a problem posted by Andonny. If interested, use Search.

BTW, I asked for the sheet location of the formula in case it was in 02 Holidays in order to further simplify the formula. But, no luck.

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 12:39 PM.


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