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 Sep 14th, 2004, 08:41 PM   #1
Pekkavee
 
Join Date: May 2004
Location: Vantaa, Finland
Posts: 1,194
Default 9.9999999 .... ?

Hey there

I see this

9.99999999999..

to be used now and then in formulas like
=IF((Sheet2!D2<>"")*(Sheet2!D2=$A$1),LOOKUP(9.99999999999999E+307,$B$1:B1)+1,"")

What is the function of that. I know it works in those cases I have seen but I would like to learn how to use it and why?

Regards
Pekka
:o :o :o
Pekkavee is offline   Reply With Quote
Old Sep 14th, 2004, 09:26 PM   #2
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,653
Default Re: 9.9999999 .... ?

9.99999999999999E+307 is the largest numeric value that can be represented in Excel. When you search for this value using an approximate lookup (i.e., when MATCH's 3rd, optional argument is 1 or omitted) then the last value in the lookup array is returned. LOOKUP is always an approximate match. Quoting the LOOKUP Help topic...

Quote:
If LOOKUP can't find the lookup_value, it matches the largest value in lookup_vector that is less than or equal to lookup_value.
__________________
Windows XP Pro/Office 2003 SP2
Mark W. is offline   Reply With Quote
Old Sep 14th, 2004, 10:02 PM   #3
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 40,228
Default Re: 9.9999999 .... ?

Quote:
Originally Posted by Pekkavee
...

I see this

9.99999999999..

to be used now and then in formulas like
=IF((Sheet2!D2<>"")*(Sheet2!D2=$A$1),LOOKUP(9.99999999999999E+307,$B$1:B1)+1,"")

What is the function of that. I know it works in those cases I have seen but I would like to learn how to use it and why?...
A) The algorithm, known as binary search (BS), finds the largest value that is less than or equal to the search value in a reference.

B) Lookup functions like:

MATCH(LookupValue,Reference,MatchType), with MatchTpe = 1,

VLOOKUP(LookupValue,Reference,1,MatchType), with MatchType = 1,

HLOOKUP(LookupValue,Reference,1,MatchType), with MatchType = 1,and

LOOKUP(LookupValue,Reference)

all invoke binary search and attempt to return a result, conditioned upon the fact that matching/binary search finds the largest value that is less than or equal to the lookup value.

C) 9.99999999999999E+307 is the largest positive number Excel knows (hereafter, referred to as BigNum).

D) BigNum is an improbable value to occur in references of interest to us.

Given A-D, whenever there is a need to retrieve the last numerical value from a reference [1] or to determine the position of the last numerical value in a reference [2], we can invoke for...

[1]

=LOOKUP(BigNum,Reference)

=INDEX(Reference,MATCH(BigNum,Reference))

=VLOOKUP(BigNum,Reference,1), and for...

[2]

=MATCH(BigNum,Reference)

With MatchType omitted, Excel defaults to 1 (or TRUE). LOOKUP() is designed, as it were, to operate under MatchType = 1.

Note that BigNum is preferred instead of MAX(Reference)+1, which would play an identical role in the foregoing formulas, for reasons of efficiency: not too loose processing cycles with MAX.

For more, search on this board and thru Google.
Aladin Akyurek is offline   Reply With Quote
Old Sep 14th, 2004, 11:02 PM   #4
RalphA
 
Join Date: May 2003
Location: Katy, Texas
Posts: 3,829
Default Re: 9.9999999 .... ?

Aladin wrote:
Quote:
C) 9.99999999999999E+307 is the largest positive number Excel knows (hereafter, referred to as BigNum).
Why is this number known as "the largest positive number Excel knows"? I can write, for example, these larger and much easier to write numbers, among others:
=9^323, which Excel shows as 1.6609E+308
=5^441, which Excel shows as 1.3762E+308
=3^646, which Excel shows as 1.6609E+308 (this one, 3^646, is mathematically identical to the first one, 9^323).

Now, I have a sneaking suspicion that, at least without further magic, 1.6609E+308 just might be THE largest number. Am I wrong?
__________________
Ralph A. Esquivel, Excel 97 SR2 (Ver. 8.0), Windows XP, Home Edition, Service Pack 2, HP LaserJet 4L printer.
RalphA is offline   Reply With Quote
Old Sep 14th, 2004, 11:21 PM   #5
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 40,228
Default Re: 9.9999999 .... ?

Quote:
Originally Posted by RalphA
Aladin wrote:
Quote:
C) 9.99999999999999E+307 is the largest positive number Excel knows (hereafter, referred to as BigNum).
Why is this number known as "the largest positive number Excel knows"? I can write, for example, these larger and much easier to write numbers, among others:
=9^323, which Excel shows as 1.6609E+308
=5^441, which Excel shows as 1.3762E+308
=3^646, which Excel shows as 1.6609E+308 (this one, 3^646, is mathematically identical to the first one, 9^323).

Now, I have a sneaking suspicion that, at least without further magic, 1.6609E+308 just might be THE largest number. Am I wrong?
Apparently, I shouldn't have used positive as qualifier... What follows is from the Help file under the heading: Excel specifications and limits

Feature Maximum limit
Number precision 15 digits
Largest number allowed to be typed into a cell 9.99999999999999E+307
Largest allowed positive number 1.79769313486231E+308
Smallest allowed negative number -2.2250738585072E-308
Smallest allowed positive number 2.229E-308
Largest allowed negative number -1E-307
Length of formula contents 1,024 characters
Iterations 32,767
Worksheet arrays Limited by available memory. Also, arrays cannot refer to entire columns. For example, an array cannot refer to the entire column C:C or to the range C1:C65536. However, an array can refer to the range C1:D65535 because the range is one row short of the maximum worksheet size and does not include the entire C or D column.
Selected ranges 2,048
Arguments in a function 30
Nested levels of functions 7
Number of available worksheet functions 329
Earliest date allowed for calculation January 1, 1900 (January 1, 1904, if 1904 date system is used)
Latest date allowed for calculation December 31, 9999
Largest amount of time that can be entered
Aladin Akyurek is offline   Reply With Quote
Old Sep 14th, 2004, 11:47 PM   #6
RalphA
 
Join Date: May 2003
Location: Katy, Texas
Posts: 3,829
Default Re: 9.9999999 .... ?

Ahhh! Thanks again, Aladin, for your magic! Now I can't help but see it! But, why even use the BigNum? It seems a little troublesome to write in a formula. Why not just use LargeNum, defined as 9E+307 ? Wouldn't that large a number be a totally adequate and practical size to use for the cases in point? Or is it that it is imperitive to use the largest possible number allowed?
__________________
Ralph A. Esquivel, Excel 97 SR2 (Ver. 8.0), Windows XP, Home Edition, Service Pack 2, HP LaserJet 4L printer.
RalphA is offline   Reply With Quote
Old Sep 15th, 2004, 12:06 AM   #7
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 40,228
Default Re: 9.9999999 .... ?

Quote:
Originally Posted by RalphA
Ahhh! Thanks again, Aladin, for your magic! Now I can't help but see it! But, why even use the BigNum? It seems a little troublesome to write in a formula. Why not just use LargeNum, defined as 9E+307 ? Wouldn't that large a number be a totally adequate and practical size to use for the cases in point? Or is it that it is imperitive to use the largest possible number allowed?
I often suggest to define BigNum thru Insert|Name|Define as referring to:

9.99999999999999E+307

I don't see why to abolish a de facto consensus. It's mystifying and confusing to see so many variations, just because one needs once a while to type this big number. When it was suggested to invoke this constant as such instead of ever changing arbitrary big constants at the original MrExcel Board, I stopped posting variations ever since.
Aladin Akyurek is offline   Reply With Quote
Old Sep 15th, 2004, 12:11 AM   #8
Zack Barresse
MrExcel MVP
 
Zack Barresse's Avatar
 
Join Date: Dec 2003
Location: Oregon, USA
Posts: 9,631
Default Re: 9.9999999 .... ?

Quote:
Originally Posted by Aladin Akyurek
... When it was suggested to invoke this constant as such instead of ever changing arbitrary big constants at the original MrExcel Board, I stopped posting variations ever since.
Although some of us didn't have the pleasure of being members of the original board - me included - it may be news to everyone.
__________________
Regards,
Zack Barresse

All Excel Functions
(If you would like comments in any code, please say so.)
Zack Barresse is offline   Reply With Quote
Old Sep 15th, 2004, 12:19 AM   #9
RalphA
 
Join Date: May 2003
Location: Katy, Texas
Posts: 3,829
Default Re: 9.9999999 .... ?

I accept! What you are saying is, I guess, that BigNum is now a de facto standard in MrExcel. Well, that sounds, to me, as reason enough to maintain it as defined, and explains, at least to me, why you don't use 9E+307.

Of course, folks do say, "Rules are meant to be broken", "This is the exception that proves the rule", and, "Nothing is set in concrete" (and, I have seen badly-poured concrete torn up and repoured...).
__________________
Ralph A. Esquivel, Excel 97 SR2 (Ver. 8.0), Windows XP, Home Edition, Service Pack 2, HP LaserJet 4L printer.
RalphA is offline   Reply With Quote
Old Sep 15th, 2004, 03:45 AM   #10
tusharm
MrExcel MVP
 
tusharm's Avatar
 
Join Date: May 2002
Posts: 9,101
Default Re: 9.9999999 .... ?

For a different take on the 'wisdom' of using this 9.however-many-9s-E-whatever approach see http://groups.google.com/groups?thre....microsoft.com
Quote:
Originally Posted by Pekkavee
Hey there

I see this

9.99999999999..

to be used now and then in formulas like
=IF((Sheet2!D2<>"")*(Sheet2!D2=$A$1),LOOKUP(9.99999999999999E+307,$B$1:B1)+1,"")

What is the function of that. I know it works in those cases I have seen but I would like to learn how to use it and why?

Regards
Pekka
:o :o :o
__________________
Tushar Mehta (Microsoft MVP Excel 2000-2009)
Excel & PowerPoint tutorials and add-ins; custom productivity solutions for MS Office
tusharm 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 +1. The time now is 04:29 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
All contents Copyright 1998-2009 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