ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   csv file drops zeros at beginning of a set of Numbers (https://www.excelbanter.com/excel-discussion-misc-queries/3376-csv-file-drops-zeros-beginning-set-numbers.html)

Lisa

csv file drops zeros at beginning of a set of Numbers
 
I have programs that only import the csv format. When I create the file with
a text field using number such as 0101, 0321 if I close and reopen the file
it drops the zero. How do I correct this?

Nick Hodge

Lisa

Three ways

1) If all the 'numbers' are the same length (4 characters) then via
FormatCells...NumberCustom, type 0000
2) Pre-format the cells to text and it will retain the leading zeroes.
3) rename the file with no extension or a *.txt one and then when you open
it Excel will invoke the import wizard, choose delimited, comma and then in
the third stage of the wizard, mark the offending column(s) as text

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Lisa" wrote in message
...
I have programs that only import the csv format. When I create the file
with
a text field using number such as 0101, 0321 if I close and reopen the
file
it drops the zero. How do I correct this?




Earl Kiosterud

Lisa,

It probably isn't dropping the zeroes when it writes the csv file, but when
you reopen it with Excel. Go to www.smokeylake.com/excel. Go to "Very
Frequently Asked Questions (VFAQ)" and look at "TEXT FILE -- SAVING -- DATA
GETS CHANGED."

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Lisa" wrote in message
...
I have programs that only import the csv format. When I create the file
with
a text field using number such as 0101, 0321 if I close and reopen the
file
it drops the zero. How do I correct this?





All times are GMT +1. The time now is 01:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com