
This is tricky, since -2 is actually lower than -1.01. For negative numbers, the ROUNDUP(-1.01,0) will be -2.

This makes sense for positive numbers, the ROUNDUP(1.01,0) will be 2. Note that ROUNDUP will round away from zero. They work just like ROUND, requiring the number to round and the precision. To round to the nearest thousandth, use a precision of 3.Īdditional Details: If you always want to round up or round down, use ROUNDUP or ROUNDDOWN functions. To round to the nearest million, use a precision of -6. Although the figure above shows 2, 0, and -2, you could carry this logic forward. ROUND can use any number as the precision argument.
#Excel truncate currency compare code#
The ROUND function can be used in VBA code in Microsoft Excel. So please be careful before using this function. As a reminder, the ROUND function uses something commonly referred to as bankers rounding.

In Excel's VBA environment, the ROUND function returns a number rounded to a specified number of decimal places. So, be sure to only use the ROUND function if this is your desired result.

In these cases, the last digit after rounding is always an even number. If the expression that you are rounding ends with a 5, the ROUND function will round the expression so that the last digit is an even number. The ROUND function utilizes round-to-even logic. So before using this function, please read the following: It is very important to note that the VBA ROUND function behaves a little peculiar and uses something commonly referred to as bankers rounding. Please read our ROUND function (WS) page if you are looking for the worksheet version of the ROUND function as it has a very different syntax. As a VBA function, you can use this function in macro code that is entered through the Microsoft Visual Basic Editor. It can be used as a VBA function (VBA) in Excel. The ROUND function is a built-in function in Excel that is categorized as a Math/Trig Function. The Microsoft Excel ROUND function returns a number rounded to a specified number of digits.
