Round up to nearest .50 or dollar

Hi experts,

I'm trying to figure out how to calculate the rate increases in my company but we have a special specs.
What I need is to increase rates by 6% but I need to round UP to the nearest 50 cents or to the dollar, whichever is closer.
EX:
my rate is 106
6% increase would be 106 + 6.36 = 112.36
This should round up to 112.5

Any questions let me know.

Thanks
cm
LVL 1
carlosmonteAsked:
Who is Participating?
 
bdreed35Commented:
This will always round up, except when the value is evenly divisible by .5:

local numbervar input := {table.rate}*1.06;

if remainder(input, 0.5) > 0
then (int(input/ 0.5) *.5) + .5
else input
0
 
bdreed35Commented:
Here is some logic that you can use to round to the nearest 50 cents:

Round ( ({table.rate}*1.06) / .5 , 0 ) * .5

You can replace {table.rate}*1.06 with another formula if you are already doing this calculation
0
 
carlosmonteAuthor Commented:
This rounds down to. I only need it to round UP.
0
 
carlosmonteAuthor Commented:
This is almost working. Thanks
how can I know when its divisible by 0.5?
I want to insert another if statement to keep the number when its ends with .5
At the moment if the input is for example 111.5 it rounds UP to 112. I want it to stay as 111.5
0
 
carlosmonteAuthor Commented:
forget last comment. Sorry my mistake, was using different formula
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.