Forum Discussion
jhbunce
Apr 03, 2023Copper Contributor
Importing a .csv file to Excel. Not all decimals are present in Excel
I have a.csv file that, when viewing it via Notepad++, I can clearly see numbers in this file with as many as 10 decimal positions to the right of the decimal point. However, when I open this file in...
JoeUser2004
Apr 03, 2023Bronze Contributor
jhbunce wrote: ``All I am doing is, via excel, opening the .csv file``
Amazing! It might help me help you if you could provide both an example CSV file and the Excel file after you open the CSV file.
Ideally, click "browse files" near the bottom of this window, and attach the files to a new response.
Alternatively, upload the files to a file-sharing website, and provide their download URLs.
If the forum does allow you paste bona fide URLs, modify them and enter them as text. For example, the modified URL for this discussion is techcommunity dot microsoft dot com /t5/excel/importing-a-csv-file-to-excel-not-all-decimals-are-present-in/m-p/3786480#M187301.
The CSV file can have just your example, 14759359.090908095 .
In the Excel file, be sure to format the cell as Number with 7 or more decimal places.
And be sure that the cell displays 14759359.0909081, not 14759359.0909080. That's the only thing that I find incredulous.
-----
Also, humor me with some directed experiments. Don't expect them to make sense. They're for my benefit. So follow the instructions precisely, even if they seem strange or unnecessary.
Suppose the cell where you "entered" (by opening the CSV file) 14759359.090908095 is A1. Please do the following.
1. Enter the formula =A1 & "" into some cell (B1). Select B1, press f2, then press f9. Copy the highlighted text in the Formula bar and paste into your response. Then press Esc to restore the formula in the cell.
2. Enter the formula =SUM(A1, -(A1 & "")) & "" into some cell (C1). Select C1, press f2, then press f9. Copy the highlighted text in the Formula bar and paste into your response. Then press Esc to restore the formula in the cell.
-----
In any case, whether you open the CSV file directly in Excel or import it, you will lose precision if your data has more than 15 significant digits and use it numerically.
We can discuss some work-arounds. But they might be too complicated with too little benefit.
Otilia89
Jul 27, 2023Copper Contributor
Did you find any solution to the problem? I have the same issue : if I open the CSV in NotePad I see all my decimals ( 2316500062.2316500062101, but once I open the CSV in Excel my last decimals become 0 - > 2316500062.2316500000000
- HansVogelaarJul 27, 2023MVP
That is unavoidable. 2316500062.2316500062101 has 24 significant digits. But Excel displays numbers only up to the first 15 significant digits (rounded), replacing any digits on the right with zeros (courtesy of JoeUser2004),
- Otilia89Jul 27, 2023Copper Contributor
I actually already found a solution in the meantime. Instead of just opening the CSV file in EXCEL you use the button from the menu DATA -> click FROM Text / CSV
when the import window opens you must click : do not detect data types. This way excel imports all the data from CSV, with all the decimals.
Worked for my above example.