totn Excel Functions

MS Excel: How to use the FIX Function (VBA)

This Excel tutorial explains how to use the Excel FIX function with syntax and examples.

Description

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

The FIX function is a built-in function in Excel that is categorized as a Math/Trig Function. It can be used as a VBA function (VBA) in Excel. As a VBA function, you can use this function in macro code that is entered through the Microsoft Visual Basic Editor.

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.

Returns

The FIX function returns an integer value.
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 for Office 365, Excel 2019, Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 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.