Return the Fractional Part of a Number

No native VB function returns a fractional part of a decimal number. However, by subtracting the whole portion, obtained with Fix, from the original value, you can derive the fractional portion easily. Return the absolute value of this calculation to remove unwanted negatives:

 Public Function Frac(ByVal Value As Double) _As DoubleFrac = Abs(Value - Fix(Value))End Function
Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: