问题
When I set custom number format #0.####, it works fine with whole numbers 123 & 123.23, but it is not working with decimal numbers like 123.00, as it is displaying this as 123.
How can one set a correct number format so as not to display the . at the end?
回答1:
You can use conditional formatting to do this, in Excel 2007 and later, I believe. Format the cells with your custom format of #0.#### as you've already done. Then add custom formatting to use the General Format if the cell value has no decimal portion.
In the Condtional Formatting dialog add a formula-based format. In the "Format values where this formula is true" box enter:
=INT(A2)=A2
In the Format Cells dialog click the Number tab and choose General as the format.
回答2:
# are optional digits to show. 0 will enforce that digit even if it is zero. Make your number format #0.00##. This will display
- 123 as 123.00
- 123.00 as 123.00
- 123.000 as 123.00
- 123.001 as 123.001
- 123.001111 as 123.0011
来源:https://stackoverflow.com/questions/15178668/excel-custom-decimal-number-format-trailing-dot