问题
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