Rounding to the next number

A

Aliensmurf

i have a number field and i want it two round to the highest number

Like if it is 3.1 i want it to round to 4
this is for weight to be calculated for UPS shipping

Thanks
 
G

Guest

Hi, your Blueness.

Truncate and add one:

YourNewValue = int(YourCurrentValue) + 1

Hope that helps.
Sprinks
 
A

Aliensmurf

This works alot better then it was but still a problem. If it weights 8 lb
it then makes it 9 lbs. Which then it goes to the higher rate. I would need
for it to stay 8 and not 9.

i guess basically I need something like this

if me.pounds.value >="*.1" then
me.poundsrounded.value = int(pounds) + 1
else
me.poundsrounded.value = me.pounds.value
end if

The * is a wildcard.
 
G

Guest

Sorry, of course. How about:

If YourCurrentValue > int(YourCurrentValue) Then
YourNewValue = int(YourCurrentValue) + 1
Else
YourNewValue = int(YourCurrentValue)
End If

Sprinks
 
G

George Nicholson

How about: int(yourValue + 0.99375)?

0.99375 = 15.9 oz.. Adjust as required by your (or UPS') tolerance, but
should remain below 1.
 
A

Aliensmurf

Thanks Sprinks
Works Great

Sprinks said:
Sorry, of course. How about:

If YourCurrentValue > int(YourCurrentValue) Then
YourNewValue = int(YourCurrentValue) + 1
Else
YourNewValue = int(YourCurrentValue)
End If

Sprinks
 
G

Gregory Paret

Aliensmurf said:
i have a number field and i want it two round to the highest number

Like if it is 3.1 i want it to round to 4
this is for weight to be calculated for UPS shipping

Thanks

ShippingWeight: -Int(-[Weight])

-Greg.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top