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 29th, 2002, 07:43 AM   #1
pilot
Board Regular
 
Join Date: Feb 2002
Location: Houston, TX
Posts: 303
Default

This formula in A1 properly displays 2004

=YEAR($AI$2)+INDEX(YEARS,MATCH(INDEX(SICK,MATCH(INDEX(SICK,MATCH(TRUNC(((DATE(Base,12,31))-$AI$2)/365),YEARS)),SICK)+1),SICK,0))

This formula in A2 properly displays 01-01-04

=DATE(A1,1,1)

When I replace A1 in the formula above with the actual formula from A1, I get an error with DATE just after ((( highlighted. Why won't this work?

=DATE((YEAR($AI$2)+INDEX(YEARS,MATCH(INDEX(SICK,MATCH(INDEX(SICK,MATCH(TRUNC(((DATE(Base,12,31))-$AI$2)/365),YEARS)),SICK)+1),SICK,0))),1,1)
pilot is offline   Reply With Quote
Old Mar 29th, 2002, 07:59 AM   #2
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Quote:
On 2002-03-29 06:43, pilot wrote:
This formula in A1 properly displays 2004

=YEAR($AI$2)+INDEX(YEARS,MATCH(INDEX(SICK,MATCH(INDEX(SICK,MATCH(TRUNC(((DATE(Base,12,31))-$AI$2)/365),YEARS)),SICK)+1),SICK,0))

This formula in A2 properly displays 01-01-04

=DATE(A1,1,1)

When I replace A1 in the formula above with the actual formula from A1, I get an error with DATE just after ((( highlighted. Why won't this work?

=DATE((YEAR($AI$2)+INDEX(YEARS,MATCH(INDEX(SICK,MATCH(INDEX(SICK,MATCH(TRUNC(((DATE(Base,12,31))-$AI$2)/365),YEARS)),SICK)+1),SICK,0))),1,1)
Hi Pilot:
If your formula for the year in A1 works OK, then a cursory look at your formula in A2, shows you have an extra left parentheses ...
so replace the formual in A2 with

=DATE(YEAR($AI$2)+INDEX(YEARS,MATCH(INDEX(SICK,MATCH(INDEX(SICK,MATCH(TRUNC(((DATE(Base,12,31))-$AI$2)/365),YEARS)),SICK)+1),SICK,0))),1,1)

I have not cheked this formula ... but give it a shot.

Please post back if it works for you ... otherwise explain a little further and let us take it from there!




_________________
Yogi Anand

Edit: Deleted inactive website from hardcoded signature

[ This Message was edited by: Yogi Anand on 2003-01-19 14:19 ]
Yogi Anand is offline   Reply With Quote
Old Mar 29th, 2002, 08:07 AM   #3
pilot
Board Regular
 
Join Date: Feb 2002
Location: Houston, TX
Posts: 303
Default

The formula in A2 works and I count the net parentheses as zero. In your suggestion, I count one extra right paren. It's gotta be something else. Thanks for all help.
pilot is offline   Reply With Quote
Old Mar 29th, 2002, 08:30 AM   #4
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-03-29 07:07, pilot wrote:
The formula in A2 works and I count the net parentheses as zero. In your suggestion, I count one extra right paren. It's gotta be something else. Thanks for all help.
That's right, I mean, your hypothesis. I'd like to have a look at the WB itself, if possible.

Aladin
Aladin Akyurek is offline   Reply With Quote
Old Mar 29th, 2002, 08:31 AM   #5
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Quote:
On 2002-03-29 07:07, pilot wrote:
The formula in A2 works and I count the net parentheses as zero. In your suggestion, I count one extra right paren. It's gotta be something else. Thanks for all help.
Hi Pilot:
Some times it is so difficult to check -- especially one's own work. If you like you can email your workbook to me and I will be glad to look at where the problem might be.
__________________
Regards!

Yogi Anand, D.Eng, P.E.
Energy Efficient Building Network LLC
www.energyefficientbuild.com
Yogi Anand is offline   Reply With Quote
Old Mar 29th, 2002, 11:41 AM   #6
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Hi Jim:
I did get you workbook -- I did analyze it. The problem was that in using the year calculation in the date formula you exceeded the limit of 7 levels of nested functions. It is surprising that Excel will not point this out but consider this an error. Solution -- use the results of your year calculation in another formula so you don't exceed the limit of nested functions.

Please post back if it works for you ... otherwise explain alittle further and let us take it from there!
__________________
Regards!

Yogi Anand, D.Eng, P.E.
Energy Efficient Building Network LLC
www.energyefficientbuild.com
Yogi Anand is offline   Reply With Quote
Old Mar 29th, 2002, 12:18 PM   #7
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default


This formula in A1 properly displays 2004

=YEAR($AI$2)+INDEX(YEARS,MATCH(INDEX(SICK,MATCH(INDEX(SICK,MATCH(TRUNC(((DATE(Base,12,31))-$AI$2)/365),YEARS)),SICK)+1),SICK,0))

This formula in A2 properly displays 01-01-04

=DATE(A1,1,1)

When I replace A1 in the formula above with the actual formula from A1, I get an error with DATE just after ((( highlighted. Why won't this work?

=DATE((YEAR($AI$2)+INDEX(YEARS,MATCH(INDEX(SICK,MATCH(INDEX(SICK,MATCH(TRUNC(((DATE(Base,12,31))-$AI$2)/365),YEARS)),SICK)+1),SICK,0))),1,1)


Pilot,

I see you already got a reply as to the nature of the problem: Wrapping the first working formula within an additional function causes to exceed a built-in limit in Excel. One solution is what Yogi suggested, another for which I opted is:

=DATE(YEAR($AI$2)+INDEX(YEARS,MATCH(INDEX(SICK,MATCH(INDEX(SICK,MATCH(TRUNC((BaseDate-$AI$2)/365),YEARS)),SICK)+1),SICK,0)),1,1)

where BaseDate is a named formula consisting of:

[A]

=DATE(Base,12,31)

If this solution sounds good to you,

activate Insert|Name|Define,
enter BaseDate (or something more intelligible) as name in the Names in Workbook box, and
enter [A] as formula in the Refers to box.

Aladin

[ This Message was edited by: Aladin Akyurek on 2002-03-29 11:20 ]
Aladin Akyurek is offline   Reply With Quote
Old Mar 29th, 2002, 03:37 PM   #8
pilot
Board Regular
 
Join Date: Feb 2002
Location: Houston, TX
Posts: 303
Default

Thanks Yogi and Aladin, it works like a charm. I like the limitation workaround that Aladin suggested - and I learned something new and quite useful, too. This is a great resource!!!
pilot 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 05:13 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