How do I format a field in Excel to allow for leading zeros?

G

Guest

I am creating an Excel Document that has certain values that must have
leading zeros. Does anyone know how to allow leading zeros in Excel?
 
D

Dave Peterson

You have a few options.

If you want to treat the value as text:
#1. Preformat the cell as Text (format|cells|Number tab|Text)
(then do the data entry)
#2. Prefix your entry with an apostrophe: '0012345

If you want to treat the value as a number:
#1. Give the cell a custom format like:
Format|cells|number tab|Custom category|000000
(to show 6 digits--including leading digits if required)
 
J

Jon Peltier

Use a number format like 0000, with one zero per digit. For example, a zip
code requires a number format of 00000 or 00000-0000.

- Jon
 
T

T. Valko

You can either use a custom NUMBER format if the length of all entries will
be the same.

For example: Custom format 00000

Then:

1 becomes 00001
12 becomes 00012
123 becomes 00123
1234 becomes 01234
12345 stays 12345

However, using this method Excel will still not recognize the leading 0's.
00001 has a true underlying value of 1.

Or, you can preformat the cells as TEXT.

Or, you can precede the entry with an apostrophe as you enter them: '00001.
This also results in a TEXT entry.

Biff
 

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