Monday, October 10, 2011

Leading Zeroes

In finance, it's very common to have numbers that are text that should have leading zeroes - like account numbers or other types of identifiers.

So for example, let's talk zip codes.  Your spreadsheet has decided to make your column of zip codes a number so for the zip "000123", you're seeing just "123".  Since all zip codes need to be 5 digits, the formula in a cell would be:

=right("00000"&A1, 5) where A1 contains the zip code "123".

Logically, this formula is taking the right 5 characters of the string "00000123" which would be "00123".

No comments:

Post a Comment