MrExcel Publishing
Your One Stop for Excel Tips & Solutions

decimal places in text file export

Posted by Kevin Jones on January 02, 2002 6:27 AM

I am exporting data to text file.

I need to keep the decimal places to two or less. but can't seem to do this.

The program I am importing the data into can not handle the long string of numbers.

P.S. The numbers look correct on screen, after I have formated them, but when exporting to a text file all formating is gone.

ex. 10 divided by 3 yields 3.333333333333333333333333333

I want it to be 3.33

Thanks in advance for your help

Posted by Scott on January 02, 2002 6:43 AM

Changing the format does not change the number itself, only the way that it is viewed in excel, so when you transfer to a text file, the entire number gets transfered. If you want to change the number so it only has two decimal spaces, you have to round the number. You can use a formula like: =Round(A1,2) The number after the cell location specifies the decimal spaces.

Posted by Aladin Akyurek on January 02, 2002 6:45 AM

Make a copy of your workbook.
Format all numbers to 2 decimals.
Check Precision as displayed via Tools|Options (via Preferences on the Mac).

Then export.