Last digits are changed to zeroes when you type long numbers in cells of Excel (269370)



The information in this article applies to:

  • Microsoft Office Excel 2003
  • Microsoft Excel 2002
  • Microsoft Excel 2000
  • Microsoft Excel 97 for Windows
  • Microsoft Excel 2004 for Mac
  • Microsoft Excel X for Mac
  • Microsoft Excel 2001 for Mac
  • Microsoft Excel 98 Macintosh Edition

This article was previously published under Q269370

SYMPTOMS

When you type a number that contains more than 15 digits in a cell, Microsoft Excel changes any digits past the fifteenth place to zeroes. For example, if you attempt to type a credit card ID number in the following format

####-####-####-####

Excel changes the last digit to a zero.

CAUSE

Excel follows the IEEE 754 specification on how to store and calculate floating-point numbers. Excel therefore stores only 15 significant digits in a number, and changes digits after the fifteenth place to zeroes.

WORKAROUND

To work around this behavior, format the cell as text. The cell can then display up to 1,024 characters.

MORE INFORMATION

This behavior only occurs with numbers that are intended for calculation, that is, in cells that are formatted as numbers. In cells that are formatted as text, you can type up to 32,767 characters, of which Excel displays up to 1,024 characters on the worksheet.

Because custom number formats are designed to work primarily with numbers, you cannot create a custom number format that stores more than 15 digits. For example, you cannot use the following format to store a 16-character credit card ID as a number:

####-####-####-####

If you type the number 1111222233334444 in a cell that uses the ####-####-####-#### format, Excel displays 1111-2222-3333-4440 in the cell. The actual number that you are attempting to store is 1,111,222,233,334,444, which is over one quadrillion. But because this number is so large, Excel drops the last (least significant) digit, and puts a zero in its place.

If you type the number in the cell that is formatted as text, all the characters remain as you type them, because Excel does not attempt to store the credit card id as a number, but leaves it as text.

Modification Type:MajorLast Reviewed:5/5/2005
Keywords:kbformat kbprb KB269370