Be the first user to complete this post

  • 0
Add to List

Excel-VBA/Formula : Math Functions – INT()

Description: The INT() function in MS excel returns the Integer part of a number

NOTE: If the number is negative, INT() will return the first negative number less than equal to the given number.

Read about Excel-VBA : FIX() If the number is negative, and you want the first negative number greater than equal to the given number.

Format:

VBA Function : INT(number)

Excel Formula : INT(number)

Arguments:

  • Number
    • Mandatory
    • Type: number
    • number for which integer part will be returned

Cases:

55.1155
-220-220
-22.38-23
-50.9-51

Example:

Function getINT()
    val1 = 10.2
    val2 = 33.9
    val3 = -22.2
    val4 = -10.9
    strResult = "The INTEGER part of " & val1 & " is " & Int(val1) & vbCrLf
    strResult = strResult & "The INTEGER part of " & val2 & " is " & Int(val2) & vbCrLf
    strResult = strResult & "The INTEGER part of " & val3 & " is " & Int(val3) & vbCrLf
    strResult = strResult & "The INTEGER part of " & val4 & " is " & Int(val4) & vbCrLf
    MsgBox strResult
End Function
INT-VBA
INT-VBA

As Excel Formula:

INT - Formula
INT - Formula