Padding a number using an IF statement?

  • Thread starter Thread starter couger77
  • Start date Start date
C

couger77

I need to know if it is possible to pad a number with a single digit (0)
if and only if the that number is less than 8 digits long.

Thanks!
 
Rather than using an If statement, why not just change the
format of the cells. Using a Custom format you can specify
the format of the number to contain a leading )

Format --> Cells --> Custom
0000000#

For example:
12345 = 00012345
1234567 = 01234567

Hope this makes it easier.

Allan Koodray
 
ACtually, it does not work still.
Here is the formula that is looking at the cell with 8 characters.

=DATE(RIGHT(D27,4),LEFT(D27,2),MID(D27,3,2))

If I just format it, the cell looks like it contains an extra zero, but
it is just the same number when you click on it.
 
Give some entries from D27 on, which you seem to convert into date values.
 

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

Similar Threads


Back
Top