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?
Here is how this formula works: You can change this according to your data. =REPT(0,5-LEN(A2))&A2 would simply add the number of zeroes to the value of the cell. For example, if the value in the cell is 123, this would return 00123.
The day of the month. Single-digit days will have a leading zero. The abbreviated name of the day of the week.
Apply Custom Format with Leading Zeros Select the cell in which you want to add zeros as a prefix. Right click ➜ Format Option or you can also use the shortcut key Ctrl + 1 open “Format Cell Dialog Box”. In Category ➜ Select Custom. In the custom input dialog box, enter “0000000”.
I know this is an oldie, but when I googled for a solution this was the first result.
What I did was:
=concatenate(year(A1),text(month(A1),"00"),text(day(A1),"00"))
Where A1 is a date field.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With