#1   Report Post  
Matt
 
Posts: n/a
Default add zeros

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
  #2   Report Post  
Bernard Liengme
 
Posts: n/a
Default

No function needed, just give the cells the custom format: 000
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Matt" wrote in message
...
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



  #3   Report Post  
Matt
 
Posts: n/a
Default

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

"Bernard Liengme" wrote:

No function needed, just give the cells the custom format: 000
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Matt" wrote in message
...
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




  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

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

--

HTH

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


"Matt" wrote in message
...
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



  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

=text(a1,"000.")&text(b1,"000.")&text(c1,"000.")&t ext(d1,"000")

Matt wrote:

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

"Bernard Liengme" wrote:

No function needed, just give the cells the custom format: 000
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Matt" wrote in message
...
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





--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating formulas that allow the solutions to start with zeros. mevans Excel Discussion (Misc queries) 2 July 20th 05 05:00 PM
How do I force leading zeros in an Excel cell? EricKei Excel Discussion (Misc queries) 2 June 15th 05 08:28 PM
Leading zeros Paul Excel Discussion (Misc queries) 4 June 12th 05 04:04 AM
Excel file saved as csv - dropping zeros Kathy Excel Discussion (Misc queries) 3 February 18th 05 07:15 PM
Displaying leading zeros in an Excel spreadsheet marianthelibrarian Excel Discussion (Misc queries) 1 January 25th 05 02:08 PM


All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"