Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Padding a text column with leading zeros

I have a text file with a column containing numeric codes. I need to 'pad'
the code values with leading zeros--so that all of the codes are of the same
length. I imported the file into a new workbook, specifying the code column
to be of type text.

I've tried every method and searched the web and newsgroups every way, but
can't figure out how to pad the column. The many references for Excel 2003
don't seem to apply to Excel 2007. Can someone help?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,440
Default Padding a text column with leading zeros

If the fixed length has to be 10:

=REPT("0",10-LEN(A1))&A1

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Chris" wrote in message ...
|I have a text file with a column containing numeric codes. I need to 'pad'
| the code values with leading zeros--so that all of the codes are of the same
| length. I imported the file into a new workbook, specifying the code column
| to be of type text.
|
| I've tried every method and searched the web and newsgroups every way, but
| can't figure out how to pad the column. The many references for Excel 2003
| don't seem to apply to Excel 2007. Can someone help?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,393
Default Padding a text column with leading zeros

Are they all composed of digits only?
Then use Custom format such as "0000000000"
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Chris" wrote in message
...
I have a text file with a column containing numeric codes. I need to 'pad'
the code values with leading zeros--so that all of the codes are of the
same
length. I imported the file into a new workbook, specifying the code
column
to be of type text.

I've tried every method and searched the web and newsgroups every way, but
can't figure out how to pad the column. The many references for Excel 2003
don't seem to apply to Excel 2007. Can someone help?



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Padding a text column with leading zeros

Yes, they are all composed of the numbers 0 through 9.

Prior to my posting my original message, I selected the entire column and
then applied a custom format of "0000000000" (as numerous online references
was the way to do it--at least, for Excel 2003); however, nothing happened.

"Bernard Liengme" wrote:

Are they all composed of digits only?
Then use Custom format such as "0000000000"
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Chris" wrote in message
...
I have a text file with a column containing numeric codes. I need to 'pad'
the code values with leading zeros--so that all of the codes are of the
same
length. I imported the file into a new workbook, specifying the code
column
to be of type text.

I've tried every method and searched the web and newsgroups every way, but
can't figure out how to pad the column. The many references for Excel 2003
don't seem to apply to Excel 2007. Can someone help?




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,393
Default Padding a text column with leading zeros

Seems the cells are full of text values notwithstanding you have only
digits.
Try in a separate cell entering 1234; then give it the custom format just to
be sure we are on the same wavelength.
Feel free to send me sample file (my private email not the newsgroup)
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Chris" wrote in message
...
Yes, they are all composed of the numbers 0 through 9.

Prior to my posting my original message, I selected the entire column and
then applied a custom format of "0000000000" (as numerous online
references
was the way to do it--at least, for Excel 2003); however, nothing
happened.

"Bernard Liengme" wrote:

Are they all composed of digits only?
Then use Custom format such as "0000000000"
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Chris" wrote in message
...
I have a text file with a column containing numeric codes. I need to
'pad'
the code values with leading zeros--so that all of the codes are of the
same
length. I imported the file into a new workbook, specifying the code
column
to be of type text.

I've tried every method and searched the web and newsgroups every way,
but
can't figure out how to pad the column. The many references for Excel
2003
don't seem to apply to Excel 2007. Can someone help?








  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Padding a text column with leading zeros

Hmm...interesting. The custom formatting works on a separate cell!

There are about 10,000 rows in this file. Figuring that (perhaps) one or
more of the rows has something other than numeric digits in the target
column, I selected just a few consecutive cells within the target column
(they *definitely* contain just numeric digits) and applied the custom
formatting to them. It still didn't work! So what's the problem with this
column and with these cells?

"Bernard Liengme" wrote:

Seems the cells are full of text values notwithstanding you have only
digits.
Try in a separate cell entering 1234; then give it the custom format just to
be sure we are on the same wavelength.
Feel free to send me sample file (my private email not the newsgroup)
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Chris" wrote in message
...
Yes, they are all composed of the numbers 0 through 9.

Prior to my posting my original message, I selected the entire column and
then applied a custom format of "0000000000" (as numerous online
references
was the way to do it--at least, for Excel 2003); however, nothing
happened.

"Bernard Liengme" wrote:

Are they all composed of digits only?
Then use Custom format such as "0000000000"
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Chris" wrote in message
...
I have a text file with a column containing numeric codes. I need to
'pad'
the code values with leading zeros--so that all of the codes are of the
same
length. I imported the file into a new workbook, specifying the code
column
to be of type text.

I've tried every method and searched the web and newsgroups every way,
but
can't figure out how to pad the column. The many references for Excel
2003
don't seem to apply to Excel 2007. Can someone help?






  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,393
Default Padding a text column with leading zeros

Maybe there are hidden spaces after the last character.
Let's say you have one of these in A1
What do these formulas return:
=2*A1
=1*A1 and then use the custom format if you do not get an error result
=ISNUMBER(A1)

I'm sure we can solve this with some patience!
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Chris" wrote in message
...
Hmm...interesting. The custom formatting works on a separate cell!

There are about 10,000 rows in this file. Figuring that (perhaps) one or
more of the rows has something other than numeric digits in the target
column, I selected just a few consecutive cells within the target column
(they *definitely* contain just numeric digits) and applied the custom
formatting to them. It still didn't work! So what's the problem with this
column and with these cells?

"Bernard Liengme" wrote:

Seems the cells are full of text values notwithstanding you have only
digits.
Try in a separate cell entering 1234; then give it the custom format just
to
be sure we are on the same wavelength.
Feel free to send me sample file (my private email not the newsgroup)
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Chris" wrote in message
...
Yes, they are all composed of the numbers 0 through 9.

Prior to my posting my original message, I selected the entire column
and
then applied a custom format of "0000000000" (as numerous online
references
was the way to do it--at least, for Excel 2003); however, nothing
happened.

"Bernard Liengme" wrote:

Are they all composed of digits only?
Then use Custom format such as "0000000000"
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Chris" wrote in message
...
I have a text file with a column containing numeric codes. I need to
'pad'
the code values with leading zeros--so that all of the codes are of
the
same
length. I imported the file into a new workbook, specifying the code
column
to be of type text.

I've tried every method and searched the web and newsgroups every
way,
but
can't figure out how to pad the column. The many references for
Excel
2003
don't seem to apply to Excel 2007. Can someone help?








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
TEXT TO COLUMNS WITH LEADING ZEROS Peggy Excel Discussion (Misc queries) 6 April 27th 23 03:45 AM
Padding with leading zeros GKW in GA Excel Discussion (Misc queries) 2 July 4th 07 12:42 AM
Remove leading zeros from column Rich K. Excel Discussion (Misc queries) 2 January 2nd 07 09:43 PM
save text field w/ leading zeros in .csv format & not lose zeros? Ques Excel Discussion (Misc queries) 1 May 4th 05 06:21 PM
Adding Leading Zeros to Text Jenn Excel Discussion (Misc queries) 4 January 12th 05 06:51 PM


All times are GMT +1. The time now is 07:24 AM.

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"