Excel has no integer data type. If you’re like me, you probably think that it does and you’ve used it before! But it doesn’t. Every number in Excel is a double-precision floating point number. If a number appears to to be interpreted as an integer, that’s just the way it’s formatted for printing.

So what? Well, this means Excel can’t handle integers larger than 53 bits (= 15.95 digits) to a precision of 1. Even more confusingly (for a programmer at least), while Excel internally stores everything in base 2, it rounds everything to 15 decimal digits. Presumably this is to avoid confusing users who might be wondering why their numbers are rounded to a power of 2.

I found out about this while trying to use excel to store 64 bit primary keys from a database export, and noticed the primary keys all ended in several zeros. Unfortunately, there doesn’t seem to be a way around this behavior. The only alternative is to treat integers as strings and hope you never need to do math on them.