Bill Martin -- (Remove NOSPAM from address)
Guest
Re: Leading zeros
JC wrote:
> How does one force Excel 2003 to retain leading zeros? This is related to my
> earlier messages on "Sorting problem".
>
> One option is to use a number to binary conversion. Each binary number has 8
> bits, either 1's of 0's, and all bits are significant so leading 0's must be
> retained. The conversion will simply be a lookup table of number and associated
> binary equivalent and use the number as a cell reference to get the binary
> equivalent.
>
> Another option is to insert leading 0's in numbers that have only 1 or 2 digits
> to convert all numbers to 3 digit numbers.
>
> The only way I have thought of is to define the cell as being text rather than a
> number.
>
---------------------
Internally Excel carries numbers as .... well, as numbers. No number
has leading zeros as you are asking. The formatted *presentation* of a
number can have leading zeros, but that's just Excel humoring you by
pasting them on the front for a poor dumb human to look at. In it's
heart Excel knows that numbers don't have leading zeros -- as a
mathematician also knows the same thing. Therefore it's not about to
use leading zeros in a sort (though I can't quite see why you'd want it
to anyhow as it wouldn't affect the outcome).
If you want to force leading zeros to be carried internally then you're
right, you need to store text not a number.
Bill
Bookmarks