#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 460
Default Lead Zeros in Text

We want to use Text to Columns to divide a field with four digits into two
columns with two digits. If one of the digits begins with zero, this does
not work - (the zero drops from the display). How do we retain the lead zero
in the resulting cell?

We have tried formatting the workbook as text prior to importing and
afterward too, to no avail. FormatNumberCustom00 did nor work either.

'Suggestions?


DOUG
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,696
Default Lead Zeros in Text

an alternative would be to instead in a separate column enter =LEFT(A2,2) and
the next column would be =right(A2,2)

This woudl retain your 0's

"DOUG" wrote:

We want to use Text to Columns to divide a field with four digits into two
columns with two digits. If one of the digits begins with zero, this does
not work - (the zero drops from the display). How do we retain the lead zero
in the resulting cell?

We have tried formatting the workbook as text prior to importing and
afterward too, to no avail. FormatNumberCustom00 did nor work either.

'Suggestions?


DOUG

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Lead Zeros in Text

hi
when the first text to columns dialog comes up, choose fixed width.
on the second dialog, position your seperator
on the third dialog, in the upper right corner, choose text. if you leave it
at default of general, excel will strip your leading zeros and convert it
back to numbers. choosing text keeps it as text. the other groups may be
coverted to numbers unless they are mixed data.
click finish.

regards
FSt1

"DOUG" wrote:

We want to use Text to Columns to divide a field with four digits into two
columns with two digits. If one of the digits begins with zero, this does
not work - (the zero drops from the display). How do we retain the lead zero
in the resulting cell?

We have tried formatting the workbook as text prior to importing and
afterward too, to no avail. FormatNumberCustom00 did nor work either.

'Suggestions?


DOUG

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 460
Default Lead Zeros in Text

I had tried importing as TEXT, but it did not work this time for some reason.

What did work was the formula: =REPT("0",4-LEN(D1))&D1

Then, I was able to use the formula: = LEFT (D1,2)

Thanks,
DOUG

"FSt1" wrote:

hi
when the first text to columns dialog comes up, choose fixed width.
on the second dialog, position your seperator
on the third dialog, in the upper right corner, choose text. if you leave it
at default of general, excel will strip your leading zeros and convert it
back to numbers. choosing text keeps it as text. the other groups may be
coverted to numbers unless they are mixed data.
click finish.

regards
FSt1

"DOUG" wrote:

We want to use Text to Columns to divide a field with four digits into two
columns with two digits. If one of the digits begins with zero, this does
not work - (the zero drops from the display). How do we retain the lead zero
in the resulting cell?

We have tried formatting the workbook as text prior to importing and
afterward too, to no avail. FormatNumberCustom00 did nor work either.

'Suggestions?


DOUG

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Lead Zeros in Text

Dear Doug

From the 'Convert Text to Columns' Wizard Step 3; hold 'Shift' key and
select the two columns displayed under 'Data Preview Area'. Once selected the
background will be black and the text will be white. Then on the same window
from the group 'Column Data format' select Text and hit Finish


If this post helps click Yes
---------------
Jacob Skaria


"DOUG" wrote:

We want to use Text to Columns to divide a field with four digits into two
columns with two digits. If one of the digits begins with zero, this does
not work - (the zero drops from the display). How do we retain the lead zero
in the resulting cell?

We have tried formatting the workbook as text prior to importing and
afterward too, to no avail. FormatNumberCustom00 did nor work either.

'Suggestions?


DOUG



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 460
Default Lead Zeros in Text

Jacob: That worked - (I had not selected ALL of the columns to format as
text). However, in attempting to use the subsequent command "=LEFT(D1,2)",
the formula would not return a number. It just displayed the formula in the
cell. Do you know why that happened?

DOUG

"Jacob Skaria" wrote:

Dear Doug

From the 'Convert Text to Columns' Wizard Step 3; hold 'Shift' key and
select the two columns displayed under 'Data Preview Area'. Once selected the
background will be black and the text will be white. Then on the same window
from the group 'Column Data format' select Text and hit Finish


If this post helps click Yes
---------------
Jacob Skaria


"DOUG" wrote:

We want to use Text to Columns to divide a field with four digits into two
columns with two digits. If one of the digits begins with zero, this does
not work - (the zero drops from the display). How do we retain the lead zero
in the resulting cell?

We have tried formatting the workbook as text prior to importing and
afterward too, to no avail. FormatNumberCustom00 did nor work either.

'Suggestions?


DOUG

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 460
Default Lead Zeros in Text

A work around I just discovered was to split the four digits again, using
TEXT TO COLUMNS again, remembering to select both columns as you just
suggested.

DOUG

"DOUG" wrote:

Jacob: That worked - (I had not selected ALL of the columns to format as
text). However, in attempting to use the subsequent command "=LEFT(D1,2)",
the formula would not return a number. It just displayed the formula in the
cell. Do you know why that happened?

DOUG

"Jacob Skaria" wrote:

Dear Doug

From the 'Convert Text to Columns' Wizard Step 3; hold 'Shift' key and
select the two columns displayed under 'Data Preview Area'. Once selected the
background will be black and the text will be white. Then on the same window
from the group 'Column Data format' select Text and hit Finish


If this post helps click Yes
---------------
Jacob Skaria


"DOUG" wrote:

We want to use Text to Columns to divide a field with four digits into two
columns with two digits. If one of the digits begins with zero, this does
not work - (the zero drops from the display). How do we retain the lead zero
in the resulting cell?

We have tried formatting the workbook as text prior to importing and
afterward too, to no avail. FormatNumberCustom00 did nor work either.

'Suggestions?


DOUG

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
Keeping lead zeros in excel text format when saving as CSV file Richard James Excel Worksheet Functions 1 March 31st 08 11:30 AM
Excel drops my lead zeros: need 0051 not 51 Monet Excel Discussion (Misc queries) 3 December 26th 07 10:06 PM
Keep Lead Zeros Laury Excel Discussion (Misc queries) 6 April 13th 06 04:28 PM
Deleting Lead Zeros Hardip Excel Worksheet Functions 4 August 31st 05 01:37 PM
Lead Zeros to Show? [email protected] Excel Worksheet Functions 4 February 9th 05 08:21 PM


All times are GMT +1. The time now is 07:45 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"