Friday, February 28, 2014

MS Excel: Get preceding Zero of fixed width text field

When you open csv file in MS Excel, for any text field as number with preceding Zero, excel treats them as number and remove the preceding Zero.

Let us say, that field is 5 characters long:

00542

Excel will open it as (Assume in cell A1):

542

You can use the following formula to get back the Zero:

=Text(A1,”00000”)


See the example below: