96/25 = 3.84 ==> 3 Round down. Throw away the remainder. Yes this is a lot of waste.
96/14 = 6
96/22 = 4
You need normal division and round up for number of rods:
520/3 = 173.3 ==> 174 and so on
Function RodsNeeded(rQty As Range, rLen As Range) As Integer
RodsNeeded = rQty * rLen / 96
End Function
You can not work with the total length, you have to get the pieces per rod first.You are correct! I didn't think about that, but your formula given 8 pieces of length 49 returns 0.
Function RodsNeeded(rQty As Range, rLen As Range) As Integer
Dim intBoltsPerRod As Integer
intBoltsPerRod = 96 \ rLen
RodsNeeded = rQty * intBoltsPerRod
End Function
Private Sub Test()
Const QTY = 8
Const LENGTH = 49
Dim intBoltsPerRod As Integer
intBoltsPerRod = 96 \ LENGTH
MsgBox QTY * intBoltsPerRod ' ==> 8
End Sub
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
Split a string in excel | 9 | 30 | |
Sum iF based on a null cell | 11 | 29 | |
addressing a subform frim a subform inside it | 8 | 22 | |
Problem with Excel and File Size | 7 | 24 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
24 Experts available now in Live!