Keep decimal places when open CSV

自闭症网瘾萝莉.ら 提交于 2019-12-25 03:38:30

问题


I have a .csv file looks like this:

"13,423.354679",

When I open it in Excel it looks like this:

13,423.35

I can let it show correctly by changing the format manually.

Is there a way I can keep it shown correctly without formatting in Excel?


回答1:


You can show as many as you want, including none.

AND use the 1000 separator option to split the numbers like you want = 13,423.35.

And yes you can't normally have the actual commas, the formating option just puts them there for visual appearance - but if you really want them someone can write you a vba in 1 minute. Keep in mind excel can't work with the numbers normally if they have actual commas in them. You have to duplicate the data in case you want to both work with the numbers and have an output that has them. In case one you can remove them with =SUBSTITUTE() and have VBA or a clever formula put them back in for your final use of the data.

In case of image loss: Home > Number Format (where it says General) > More Number Formats > Category Number > Decimal Places controller.

If for some reason they get lost on import - just open the csv with something else and copy-paste the numbers into excel.




回答2:


Unfortunately, not really. Excel by default displays 2 decimal places, according to here :

By default, Excel displays 2 decimal places when you apply a built-in number format, such as a currency format or a percentage, to the cells or data. However, you can change the number of decimal places that you want to use when you apply a number format




回答3:


I don't think we can control the format in .csv files.

slk can do limited format control for Excel. Cons is it only support ANSI and not very common use.

I also try to delete the comma from the number, then it becomes a general number which can show 11 digits.



来源:https://stackoverflow.com/questions/33771112/keep-decimal-places-when-open-csv

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!