Fix Function

Returns the integer portion of a number.

Syntax

Fix(number)

Remarks

The number argument can be any valid numeric expression. Fix removes the fractional part of number and returns the resulting integer value.

The difference between Fix and Int is that if number is negative, Int returns the first negative integer less than or equal to number, whereas Fix returns the first negative integer greater than or equal to number. For example, Int converts -8.4 to -9, and Fix converts -8.4 to -8.

The following examples illustrate how the Int and Fix functions return integer portions of numbers:

Example

Dim MyNumber
MyNumber = Fix(-99.8)  
'Output: -99.
MyNumber = Int(-99.2)   
'Output: -100.
MyNumber = Fix(-99.2)   
'Output: -99.
MyNumber = Fix(99.8)  
'Output: 99