Thread
:
adding zeros before a number depending on the number of digits
View Single Post
11-26-2021, 09:08 AM
Pecoflyer
Windows 7 64bit
Office 2010
Expert
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,920
Sorry I misunderstood. Perhaps
Code:
=if(LEN(A1)=3,TEXT(A1,"00000"),TEXT(A1,"0000000"))
.
This only changes the formatting, the underlying value will not change
If you need to use the obtained string then
Code:
=IF(LEN(A1)=3,"00"&A1,"000"&A1)
__________________
Using O365 v2503
- Did you know you can thank someone who helped you
? Click on the tiny scale in the right upper hand corner of your helper's post
Pecoflyer
View Public Profile
Find all posts by Pecoflyer