|
Be the first user to complete this post
|
Add to List |
Excel-VBA : Math Functions – FIX()
Description: The FIX() function in MS excel returns the Integer part of a number
NOTE: If the number is negative, FIX() will return the first negative number greater than equal to the given number.
Read about Excel-VBA : INT() If the number is negative, and you want the first negative number less than equal to the given number.
Format:
VBA Function : FIX (number)
Arguments:
- Number
- Mandatory
- Type: number
- number for which integer part will be returned
Cases:
| 55.11 | 55 |
| -220 | -220 |
| -22.38 | -23 |
| -50.9 | -51 |
Example:
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
