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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding numbers in XL 2

Status
Not open for further replies.

ribhead

Technical User
Jun 2, 2003
384
US
I have made a shipping receipt and what I would like to do is automatically fill in the number of boxes that are being shipped. The constant is 48 pcs per box. so if the person ships 41 pcs that would be 1 box and if he/she ships 51 pcs it would be two boxes and so on. I could write if statements until the cows come home but their must be a better way to skin this puppy. But I don't know all the Worksheet Functions so can anyone help?


Thanks, Rib

Bartender:Hey aren't you that rope I threw out an hour ago?

Rope:No, I'm a frayed knot.
 
Have a look at the ROUNDUP worksheet function.

-Gary
 
Hi,

I like basic math approch...

Number of boxes, where A1 has Number of pieces
[tt]
=INT((A1-1)/48)+1
[/tt]


Skip,

[glasses] [red]Be advised:[/red] It's been reported that a wee psychic is roaming the countryside.
Small Medium @ Large! [tongue]
 
Everybody gets a star. I went with the RoundUp function but the basic math approach is very impressive.

Private Sub tbqty_AfterUpdate()
Dim lngqty As Long
Dim dblnum As Double
Dim lngboxes As Long
Const mynum As Integer = 48
lngqty = Me.tbqty.Value
dblnum = lngqty / mynum
lngboxes = WorksheetFunction.RoundUp(dblnum, 0)
Me.tbboxes = lngboxes
End Sub

Thanks, Rib

Bartender:Hey aren't you that rope I threw out an hour ago?

Rope:No, I'm a frayed knot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top