If you need to round down all the time, you will have to use a bit of code as well.
There is a simpler way.
Use the Int() function when the
rounding requires zero decimal places.
It returns the integer part of the expression.
Rounding down:
Int(
expression)
However be acutely aware of the danger when using
any up or down rounding technique. Small discrepancies can be hugely exaggerated.
Input expressions resulting in numbers like 1.9999 can occur when 2.0000 is expected and will round down. Scooterbug's technique could also be vulnerable in some situations (though not the exact circumstance in this thread).
A safer expression for rounding down where there is any risk is:
Int(
expression + 0.0009)
Use as many zeros as the required precision.
0.09 will round down from #.9
0.009 will round down from #.09
This avoids results like 1.999 being rounded down.
Rounding up:
Int(
expression + 0.999)
Include as many nines as precision required.
0.9 will round up numbers from #.1
0.999 will round up numbers from #.001
This avoids results like 1.0001 being rounded up.
With decimal calculations use double precision numbers if accuracy is essential. Single precision numbers become unreliable from about three decimal places and failing to account for these small discrepancies can lead to unexpected results especially when rounding up or down.
Also note that the Round() function uses banker's rounding which favours even final digits in the result. For example the numbers 1.5 and 2.5 both round to 2.
It is a better method than the ill-conceived arbitrary "always round up the five digit" we were taught in school because it tends to level out the errors when multiple roundings are processed.