Fix (function)

Syntax

Fix(number)

Description

Returns the integer part of number.

Comments

This function returns the integer part of the given value by removing the fractional part. The sign is preserved.

The Fix function returns the same type as number, with the following exceptions:

 

If number is Empty, then an Integer variant of value 0 is returned.

If number is a String, then a Double variant is returned.

If number contains no valid data, then a Null variant is returned.

Example

This example returns the fixed part of a number and assigns it to b, then displays the result in a dialog box.

Sub Main()
  a# = -19923.45
  b% = Fix(a#)
  MsgBox "The fixed portion of -19923.45 is: " & b%
End Sub

See Also

Int (function); CInt (function).

More information

F