Returns the integer portion of a number (Double).

numberThe number you want to round (Double).

* This function is identical to the INT function for positive numbers.
* The difference between this function and the INT function is that negative numbers are rounded up.
* The value returned has the same data type as the value passed in. For example if an Integer data type is passed in, then an Integer data type is returned.
* This function always returns a Double.
* This function truncates without rounding.
* If "number" contains Null, Null is returned.
* If "number" contains a fractional part then the resulting integer value is used.
* If "number" < 0, then the first negative integer greater than or equal to "number" is returned.
* The results from this function are equivalent to : Sgn(number) * Int(Abs(number))
* You can use the INT function to return the number rounded down to the nearest integer.
* The equivalent .NET function is Microsoft.VisualBasic.Conversion.Fix
* For the Microsoft documentation refer to

Fix(12.34) = 12 
Fix(12.99) = 12
Fix(-8.4) = -8

Dim iInteger As Integer
iInteger = 20
Debug.Print TypeName(Fix(iInteger))

Dim lLong As Long
lLong = 20.5
Debug.Print TypeName(Fix(lLong))

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited Top