What funtion/s should do I need

Solved/Closed
BJ - May 13, 2010 at 08:22 AM
 BJ - May 17, 2010 at 08:05 AM
I'm working on tool for a user to input a qty of items, then calulate the number of cartons required.

The cartons come in 1, 5 & 20 unit packs.

If a user asks for 56, how do i calculate in excel/VBA to get the answer of 2 x 20, 3 x 5 & 1 x 1?

BJ

2 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
May 13, 2010 at 08:46 AM
Use mod function

Twenties = (56 - (56 Mod 20)) / 20
NextBox = 56 Mod 20


Fives = (NextBox - (NextBox Mod 5)) / 5
NextBox = NextBox Mod 5

Ones = NextBox
0
Thanks for your help on this
0