add zeros

M

Matt

Is there a function that will add zeros to the beginning of my data. I have
four fields that consist of the four octets for an IP address. I would like
to create a function that will pad each field with zeros if the field is less
than 3 numbers. Such as if the existing data is 1, I want it to change the
data to 001 or if the the data is 10, I want it to be 010. Also, if the data
is 0, I want it to be 000. I actually want the data to change, not just the
way it displays. I intend on importing this changed data into an Access
database. If there is a better way to do this, I am open to suggestions.
Thanks. Matt
 
M

Matt

Thanks Bernard. That worked great. Now is there a way to combine these four
fields into one separated by periods so that it appears as an IP address.
example
010.100.010.000. Thanks. Matt
 
B

Bob Phillips

=TEXT(A1,"000")&"."&TEXT(B1,"000")&"."&TEXT(C1,"000")&"."&TEXT(D1,"000")

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Top