Thursday, August 11, 2016

How to use the FIX Function (VBA)

Description

The Microsoft Excel FIX function returns the integer portion of a number.

Syntax

The syntax for the FIX function in Microsoft Excel is:
Fix( expression )

Parameters or Arguments

expression
A numeric expression whose integer portion is returned.

Note

  • If the expression is negative, the FIX function will return the first negative number that is greater than or equal to the expression.

Applies To

  • Excel 2016, Excel 2013, Excel 2011 for Mac, xcel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

Type of Function

  • VBA function (VBA)

Example (as VBA Function)

The FIX function can only be used in VBA code in Microsoft Excel.
Let's look at some Excel FIX function examples and explore how to use the FIX function in Excel VBA code:
Fix(210.67)
Result: 210

Fix(2.98)
Result: 2

Fix(-2.98)
Result: -2
For example:
Dim LNumber As Double

LNumber = Fix(210.67)
In this example, the variable called LNumber would now contain the value of 210.

No comments:

Post a Comment