Converting .txt file to Excel

  • Thread starter Thread starter Kurch
  • Start date Start date
K

Kurch

I have a csv .txt file that I want to open in Excel. I have no trouble
opening it in Excel, but when I do I lose all the leading zeroes that
are in the records. Is there a way to convert teh .txt file and
maintain exactly what is between the commas when it opens in Excel?

Thank you kindly
 
Hi Kurch,

Couple of ways of doing this.

Insert a column beside the column with the numbers and then use the TEXT
function to create a text value from the numeric value similar to the
following using as many zeros as is required.

=TEXT(A1,"0000")

Copy the formula down.

Select the column with the formulas and then Copy -> Paste Special -> Values
(Pastes over top of itself)

Delete the numeric column.

The other way is to change the name of the file extension from .csv to .txt
before opening it with Excel.

If your file extensions do not show in Windows Explorer then display them
with the following method.

Select Control Panel -> Folder Options -> View Tab.

Uncheck the option to Hide extensions for known file types.

Use Windows Explorer to navigate to the file and change the extension from
..csv to .txt (Click OK or whatever to ignore the warning message re changing
file types.)

Now open Excel and then open the .txt file (In the Excel Open dialog set txt
file type so you can find it) and you will be taken into the Text to Columns
dialog immediately the file opens.

Use Delimited option and click Next.

Check the Delimiter box for Comma (uncheck the rest) and click Next.

Select the column that you want to have the leading zeros and click the Text
option button.

Click Finish.
 
Back
Top