Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Allie
 
Posts: n/a
Default Why is Excel changing the last 2 digits of a 17 digit num to 00.

When I enter a 17 digit number in a cell in Excel, the last 2 digits turn to
00 when I leave the cell. Format - Cell does not have a setting to stop this
'feature'. How do I make Excel recongize the large number?
  #2   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Thu, 28 Jul 2005 19:09:01 -0700, "Allie"
wrote:

When I enter a 17 digit number in a cell in Excel, the last 2 digits turn to
00 when I leave the cell. Format - Cell does not have a setting to stop this
'feature'.


Excel Specifications and Limits:

Calculation specifications

Feature Maximum limit
Number precision 15 digits


How do I make Excel recongize the large number?


If the number does not require calculation (e.g. if it is an ID number, or a
credit card number, for example) you can enter it as TEXT. Either pre-format
the cell as text; or precede your entry by a single quote '12345678901234567

If you require mathematical operations with more than 15 digits of precision,
you will need to use a different tool.


--ron
  #3   Report Post  
Jerry W. Lewis
 
Posts: n/a
Default

Some additional comments (quite possibly more detail than you really
wanted):

Excel (and almost all other software) does binary math. The binary
storage format (IEEE double precision) Excel uses is discussed at
http://www.cpearson.com/excel/rounding.htm

In IEEE double precision, every 15 digit number can be distinguished,
but 17 digits are required to uniquely specify a particular binary
floating point number. Presumably Excel only displays 15 digits to
avoid having to answer questions like "why, when you enter
12345678901234567 do you get back 12345678901234568?" (the closest
double precision approximation).

When you enter more than 15 digits in Excel, the number is truncated to
15 digits before conversion to binary, even if that results in incorrect
rounding (e.g. 12345678901234567 will be converted to 12345678901234500
which displays as 1.23456789012345E16).

When you enter more than 15 digits in VBA, the number entered will be
directly converted to binary (e.g. 12345678901234567 will be converted
to 12345678901234568 which displays as 1.23456789012346E16).
Unfortunately, if you edit the line again, then Excel will reconvert
from the displayed number to binary, so the value will change from
12345678901234568 to 12345678901234600 which still displays as
1.23456789012346E16 but is a less accurate approximation to what you
originally entered.

If you reliably want the most accurate numeric approximation to a more
than 15 digit number, use something like CDbl("12345678901234567") in VBA.

You can use VBA to put more accurate approximations into Excel. Thus if
you use the VBA line
[A1] = CDbl("12345678901234567")
and directly enter 12345678901234567 in A2, or equivalently use the cell
formula
=VALUE("12345678901234567")
then the cell formula
=A1-A2
will return 68, showing that VBA gave you the more accurate binary
approximation.

Jerry

Ron Rosenfeld wrote:

On Thu, 28 Jul 2005 19:09:01 -0700, "Allie"
wrote:


When I enter a 17 digit number in a cell in Excel, the last 2 digits turn to
00 when I leave the cell. Format - Cell does not have a setting to stop this
'feature'.


Excel Specifications and Limits:

Calculation specifications

Feature Maximum limit
Number precision 15 digits



How do I make Excel recongize the large number?


If the number does not require calculation (e.g. if it is an ID number, or a
credit card number, for example) you can enter it as TEXT. Either pre-format
the cell as text; or precede your entry by a single quote '12345678901234567

If you require mathematical operations with more than 15 digits of precision,
you will need to use a different tool.


--ron


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
changing page break in an excel file ibs81 New Users to Excel 1 April 14th 05 07:03 PM
I entered 11/22/2004 in excel workbook and it keeps changing to ## Firefly Excel Worksheet Functions 1 February 24th 05 06:11 PM
Changing Dates in Excel Jackie Excel Worksheet Functions 3 January 14th 05 08:16 PM
How do I stop excel from changing single numbers like 1 into a de. Jendayii Excel Discussion (Misc queries) 1 January 5th 05 10:03 PM


All times are GMT +1. The time now is 09:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"