Q
QUESTION-MARK
I have a column of numbers: 4.29, 5.79, 6.34, 7.89 and so on
I got a CustomRound function but it doesn't work right. I want to be
able to round the above numbers to the nearest quarter. I suspect that
either I need to use a case statement or more If Then statements. Can
anyone point me in the right direction.
Thank you, Mark
Function CustomRound(pValue As Double) As Double
Dim LWhole As Long
Dim LFraction As Double
'Retrieve integer part of the number
LWhole = Int(pValue)
'Retrieve the franction part of the number
LFraction = pValue - LWhole
If LFraction < 0.5 Then
CustomRound = LWhole
Else
CustomRound = LWhole + 0.5
End If
End Function
I got a CustomRound function but it doesn't work right. I want to be
able to round the above numbers to the nearest quarter. I suspect that
either I need to use a case statement or more If Then statements. Can
anyone point me in the right direction.
Thank you, Mark
Function CustomRound(pValue As Double) As Double
Dim LWhole As Long
Dim LFraction As Double
'Retrieve integer part of the number
LWhole = Int(pValue)
'Retrieve the franction part of the number
LFraction = pValue - LWhole
If LFraction < 0.5 Then
CustomRound = LWhole
Else
CustomRound = LWhole + 0.5
End If
End Function