Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Mround in Access?

243 views
Skip to first unread message

Jorg Gaubmann

unread,
Mar 22, 1999, 3:00:00 AM3/22/99
to
I need to round up a number to the nearest even multiple. Excell has a
function called Mround, but could not find anything like this in Access.
Does Access have a built in function to provide this? If not, can someone
help me out.

Thanks,

Jorg

PaulvG

unread,
Mar 23, 1999, 3:00:00 AM3/23/99
to
Jorg Gaubmann wrote in message ...
This one comes close:

Function MROUND(x As Variant, Multiple As Variant) As Double
'Decimal round to nearest multiple, else away from zero
'Mimics Excel MROUND() except: limited range, improved accuracy, allows different signs

Dim ScalingFactor As Variant

If IsNumeric(x) Then
ScalingFactor = CDec(Abs(Multiple))
MROUND = Fix(x / ScalingFactor + Sgn(x) / 2) * ScalingFactor
End If

End Function
--
Paul


0 new messages