Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Round a field to the nearest multiple of another field

Status
Not open for further replies.

trulyblessed

Programmer
Feb 10, 2003
15
0
0
US
Hi. I have a qty field and a pack size field. I need to be able to round the qty field to the nearest multiple of the pack size field. How do I go about that?

Any help would be appreciated!
Thanks,
Kim
 
Try this
Code:
SELECT Qty, Pack, 

       iif ((qty mod pack) <= pack/2, 
            int(qty/pack) * pack, 
            qty + (pack - (qty mod pack))) As [Rounded]

FROM tbl
 
Thank you so much. This worked beautifully. Sorry it took me so long to post a thank you, but your help is really appreciated.

Kim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top