excel leading zeros format code example
Example 1: excel add leading zeros to existing values
Select Cell Range-->Format Cells-->Number-->Custom-->00000
=TEXT(A1,"00000")
Function Pad(s$, Optional padChr = "0", Optional num = 5)
Pad = String(num - Len(s), padChr) & s
End Function
Example 2: excel all numbers have same digits
Right click on the column, format cells, number, custom.
Choose the 0 type and put n zeros in the entry box (for n numbers).
click okay. All numbers entered will be n digits.
example : type: 00000
all number will have 5 digits : 00004, 03452,00876,45627 etc