Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Kathy
 
Posts: n/a
Default How do I save a leading 0 in a csv format?

Hello, I receive data from our geologist from a program that drops the
leading 0 from the API #'s for different wells. I need/have to restore this
0 in order to do imports into the software I use.
So I have a #: 11256094 that should read: 011256094
I have tried using the concatonate function sucessfully in excel (setting up
a '0 in one cell and the 11256094 in another cell), but when I save it as a
csv file, it drops the lead zero. I've reformatted my cells to text, but
this is still not helping solve this problem.
Any help will be appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
David McRitchie
 
Posts: n/a
Default How do I save a leading 0 in a csv format?

Excel will save the leading zeros in a CSV file for text data, but it will
have a problem inputting them back into Excel. From the sounds of
your problem another application (not Excel) is creating the fields without
the leading zeros. If they are all of a fixed length and below 16 digits
you could change the format, cells, custom format to something like:
000000000

Try formatting as text when you import the file
Data, Import file, external data which should bring up the imput text wizard.
Changing format between number and text is not effective until data is reentered.

If you want them in Excel as text you could modify the macro at
http://www.mvps.org/dmcritchie/excel/join.htm#fixUSzip5
to have nine digits instead of 5 digits and remove redundant coding.

For a worksheet solution as text via a helper column.
=RIGHT("000000000" & TRIM(A1), 9)

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Kathy" <Kathy @discussions.microsoft.com wrote in message ...
Hello, I receive data from our geologist from a program that drops the
leading 0 from the API #'s for different wells. I need/have to restore this
0 in order to do imports into the software I use.
So I have a #: 11256094 that should read: 011256094
I have tried using the concatonate function sucessfully in excel (setting up
a '0 in one cell and the 11256094 in another cell), but when I save it as a
csv file, it drops the lead zero. I've reformatted my cells to text, but
this is still not helping solve this problem.
Any help will be appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Kathy
 
Posts: n/a
Default How do I save a leading 0 in a csv format?

David,
Thank you for your suggestions - I will try them out next time... in the
meantime, I found a helpful path from Excel where I used 2 cells and merged
them with this command:
=A2&""&B2&"
then I pasted it to another column with the values only - when I saved this
in Excel and then in a csv file - it imported just fine into my software!
I'm not sure if my approach is harder or not?
Thank you again,

"David McRitchie" wrote:

Excel will save the leading zeros in a CSV file for text data, but it will
have a problem inputting them back into Excel. From the sounds of
your problem another application (not Excel) is creating the fields without
the leading zeros. If they are all of a fixed length and below 16 digits
you could change the format, cells, custom format to something like:
000000000

Try formatting as text when you import the file
Data, Import file, external data which should bring up the imput text wizard.
Changing format between number and text is not effective until data is reentered.

If you want them in Excel as text you could modify the macro at
http://www.mvps.org/dmcritchie/excel/join.htm#fixUSzip5
to have nine digits instead of 5 digits and remove redundant coding.

For a worksheet solution as text via a helper column.
=RIGHT("000000000" & TRIM(A1), 9)

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Kathy" <Kathy @discussions.microsoft.com wrote in message ...
Hello, I receive data from our geologist from a program that drops the
leading 0 from the API #'s for different wells. I need/have to restore this
0 in order to do imports into the software I use.
So I have a #: 11256094 that should read: 011256094
I have tried using the concatonate function sucessfully in excel (setting up
a '0 in one cell and the 11256094 in another cell), but when I save it as a
csv file, it drops the lead zero. I've reformatted my cells to text, but
this is still not helping solve this problem.
Any help will be appreciated.




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
macro save a workbook whilst increasing file no shrek Excel Worksheet Functions 0 November 10th 05 02:40 PM
How to save worksheet in .cvs format? Carlannie Excel Discussion (Misc queries) 1 April 21st 05 07:19 PM
cannot edit and save jp New Users to Excel 1 February 9th 05 03:25 AM
cannot edit and save jp Excel Discussion (Misc queries) 0 February 8th 05 03:27 AM
How do I format data cells in Excel to keep leading zeroes? LennyD Setting up and Configuration of Excel 2 December 15th 04 10:42 PM


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