Round Up

Harry Taylor

Registered User.
Local time
Today, 05:55
Joined
Jul 10, 2012
Messages
90
Hi,

I have a Cost field & and a calculated Price field generating a sell price ( calculation *1.16 / .75 )

How do I add to the expression [Cost]*1.16/0.75 to round UP to the nearest 50

E.G. - My cost is 1119.35 generating a sell price of 1731.26. I want this to be 1750

I hope this makes sense

Any help would be appreciated
 
Code:
Function CeilingToMultiple(ByVal value As Double, ByVal multiple As Integer) As Double
    CeilingToMultiple = -Int(-value / multiple) * multiple
End Function
Code:
? CeilingToMultiple(1731.26, 50)
 1750
 
In general, you convert the sell price to "block" integers by dividing the sell price by 50, then using something like CLNG to make it an integer, then add 1 to it, then multiply it by 50 and convert it to whatever data type you need it to be, like DOUBLE or CURRENCY.
 
Thank you all,

I understand the principle and should be ok from here. Again, your help is very much appreciated :)
 

Users who are viewing this thread

Back
Top Bottom