Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

Excel-VBA : Math Functions – FIX()

Descrip­tion: The FIX() func­tion in MS excel returns the Inte­ger part of a number

NOTE: If the num­ber is neg­a­tive, FIX() will return the first neg­a­tive num­ber greater than equal to the given number.

Read about Excel-VBA : INT() If the num­ber is neg­a­tive, and you want the first neg­a­tive num­ber less than equal to the given number.

For­mat:

VBA Func­tion : FIX (num­ber)

Argu­ments:

  • Num­ber
  • Manda­tory
  • Type: num­ber
  • num­ber for which inte­ger part will be returned

Cases:

55.11 55
–220 –220
–22.38 –23
–50.9 –51

Exam­ple:

Sub FnFIX()
    Dim val1
    Dim val2
    Dim val3
    Dim val4
    val1 = 55.11
    val2 = -220
    val3 = -22.38
    val4 = -50.9
    strResult = "The Integer part of number " & val1 & " Using FIX - " & Fix(val1) & " and using INT()- " & Int(val1) & vbCrLf
    strResult = strResult & "The Integer part of number " & val2 & " Using FIX - " & Fix(val2) & " and using INT()- " & Int(val2) & vbCrLf
    strResult = strResult & "The Integer part of number " & val3 & " Using FIX - " & Fix(val3) & " and using INT()- " & Int(val3) & vbCrLf
    strResult = strResult & "The Integer part of number " & val4 & " Using FIX - " & Fix(val4) & " and using INT()- " & Int(val4) & vbCrLf
    
    MsgBox strResult

End Sub

FIX()

FIX()

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: