views:

178

answers:

2

Is there a way to add a leading zero to a date that is 7 digits and should be 8?

7301982 should be 07301982.

I have a column full of these values, and need a way to do so with a formula. Any ideas?

+1  A: 

Set a custom format of 00000000

Stuart Dunkeld
only problem with this answer is that if it is January 1st 1982 you will get 00111982. The format should be mmddyyyy
guitarthrower
Guitarthrower, because Excel stores dates as numbers that's not going to work in this scenario. If I put the value 111982 in a cell and apply the custom format mmddyyyy I get 05/08/2206, if I put in 7301982 and apply that format Excel considers the date to be out of range..
Stuart Dunkeld
hmmm... good point. how to solve then? it seems a formula might be needed. because what you've listed will only work for days 10-31 of the first 9 months of the year. Unless I'm understanding incorrectly.
guitarthrower
+1  A: 

=text(A1, "00000000") will do it.

Ryan Shannon