G
Guest
I am trying to get a query to roundup to the nearest whole number when
divided by 150
divided by 150
Allen Browne said:Int() rounds a number down, so you can round up like this:
- negate the number
- divide by 150
- take the Int()
- multiply by 150
- negate the result.
Result: -150 * Int(-[YourFieldNameHere] / 150)
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Paul LeBlanc said:I am trying to get a query to roundup to the nearest whole number when
divided by 150
Paul LeBlanc said:That works to roundup the original number but doesn't give me the number
divided by 150. it gives me some ideas though thanks
Paul
Allen Browne said:Int() rounds a number down, so you can round up like this:
- negate the number
- divide by 150
- take the Int()
- multiply by 150
- negate the result.
Result: -150 * Int(-[YourFieldNameHere] / 150)
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Paul LeBlanc said:I am trying to get a query to roundup to the nearest whole number when
divided by 150
Paul said:Int(-([SumOfqty])/150)*-1 was the final solution
thanks for the tip!
Paul
Vincent Johns said:Paul said:Int(-([SumOfqty])/150)*-1 was the final solution thanks for the tip!
Paul
Depending on what you need, this might not work for negative numbers.
Another possibility might be
ROUNDUP([SumOfqty]/150, 0)
Douglas said:Paul LeBlanc wrote:
Int(-([SumOfqty])/150)*-1 was the final solution thanks for the tip!
Paul
Depending on what you need, this might not work for negative numbers.
Another possibility might be
ROUNDUP([SumOfqty]/150, 0)
That might be a possibility if you've written a ROUNDUP function.
AFAIK, there's no ROUNDUP function built into Access.
KARL DEWEY said:Round([YourField]/150)
Paul LeBlanc said:I am trying to get a query to roundup to the nearest whole number when
divided by 150
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.