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
Title | # Comments | Views | Activity |
---|---|---|---|
second highest value difference | 11 | 24 | |
VBA to automatically save the workbook every 2 minutes | 3 | 29 | |
Automate outlook - modify a 'reply' email from another office app. | 10 | 19 | |
Populate data based on a criteria | 2 | 13 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
9 Experts available now in Live!