# How to limit max number of digits after comma, but not set minimum

My Excel spreadsheet is calculating some decimal values. Depending on the input value, the result may be e.g.

``````0
0.5
0.04166(6)
``````

I would like these values to appear as

``````0
0.5
0.0417
``````

that is limit the maximum number of decimal digits but not set the minimum one, allowing it to be 0 or more as needed.

With "general" format, I get the minimum required but unlimited number of digits, i.e. 0, 0.5, 0.0416667.
With "number" format, I get 0.0000 and 0.5000 if I want to get 0.0417.

Any way around? FWIW I am on Excel 2010.

• Why would trailing zeros be a problem? A value of 0.0000 would be equal to 0. The same for 0.5 and 0.500. Right now there doesn't seem to be an easy way to do this. Of course you could always use the `ROUND` function and not use a specific format. – Seth May 26 '17 at 10:15
• @Seth because of readability. In my case 0 means there's no data. Redundant digits increase "noise". – texnic May 27 '17 at 7:00

In case, if you need to keep the values not rounded, try custom format `0.####`:
This is just one extra point off (in `0.`) from the described format.
If changing the value is not an issue for you (you wrote 'appear as'), you can use `=ROUND(...)` around whatever you calculate, or in a new column. The second parameter defines to how many digits you want it rounded, for example
`=ROUND(2/3,4)` will give you `0.6667`.