How to add leading 0 to four digit number?

G

Guest

I have a column of Zip codes in an Excel spreadsheet. Some of the values are
4 digits in length and some are 5 digits in length. I need to have the
column in text format, but since the format was numeric the leading zero
disappears. I need a formula that determines that if the length of the value
is 4 characters than add a leading zero.
 
A

Arvi Laanemets

Hi

With numeric code in cell A2
=TEXT(A2,"00000")
With variable length numeric string as code in cell A2
=TEXT(VALUE(A2),"00000")

Arvi Laanemets
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top