Rounding


Rounding Up

Using Excel
Application.WorksheetFunction.RoundUp(value,0) - no decimal places


Example using VBA Round



Rounding Down

Using Excel
Application.WorksheetFunction.RoundDown(value,-1) - no decimal places


The CINT Function

The CINT function rounds up to the nearest integer if the fractional part is greater than 0.5 and rounds down if it is less than or equal to 0.5.

CInt(0.2) = 0 
CInt(0.5) = 0
CInt(0.6) = 1
CInt(0.9) = 1
CInt(1.1) = 1
CInt(1.5) = 1
CInt(-1.1) = -2
CInt(-1.9) = -2


The INT Function

The INT function however always rounds down to the nearest integer.

Int(0.2) = 0 
Int(0.5) = 0
Int(0.6) = 0
Int(0.9) = 0
Int(1.1) = 1
Int(1.5) = 1
Int(-1.1) = -2
Int(-1.9) = -2


Integers - Rounding Down

The INT function rounds numbers down to the nearest integer.
This function truncates without rounding
INT(-8.4) = -9
INT(14.2) = 14


The FIX function returns the integer potion of a number.
This function runcates without rounding.
eg
eg


The ROUND function rounds numbers to a given number of decimal places.



© 2017 Better Solutions Limited. All Rights Reserved. © 2017 Better Solutions Limited

PrevNext