Split a number into various factors (packs of 50, packs of 25 etc)

scottwsms

New Member
Joined
Oct 14, 2021
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi All, I know this is possible because I'm sure I've learned how to do it in the past but I'm drawing a blank, so coming to you for help!

In a spreadsheet I'm building we need to provide a number of Earplugs (lets say 158). We can buy Earplugs in packs of 50 and packs of 25. Essentially i would like to input the Total number of earplugs needed in cell A3, and then cell B3 would calculate how many packs of 50 I would need, and cell C3 would calculate how many packs of 25 I would need.

In the example shown it would be 3 packs of 50, one pack of 25. I would also like it if the formula prioritized the packs of 50 first (buying in bulk is cheaper!).

Any help would be greatly appreciated (formula rather than VBA if possible)

Thanks
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
One idea i had was using ROUNDDOWN and ROUNDUP as follows:

A3 = 158
B3 (packs of 50) : =ROUNDDOWN(A3/50,0) ANSWER OF 3
C3 (Packs of 25) : =ROUNDUP((A3-(B3*50))/25,0) ANSWER OF 1

Not sure if that's the most efficient way but it does work. Any other alternatives?
 
Upvote 0
How about
+Fluff 1.xlsm
ABC
1
2
315831
Main
Cell Formulas
RangeFormula
B3B3=INT(A3/50)
C3C3=ROUNDUP((A3-B3*50)/25,0)
 
Upvote 0
Solution
How about
+Fluff 1.xlsm
ABC
1
2
315831
Main
Cell Formulas
RangeFormula
B3B3=INT(A3/50)
C3C3=ROUNDUP((A3-B3*50)/25,0)
Integer round down is nice for the first formula yeah, a little more compact. Thanks!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,871
Members
449,055
Latest member
excelhelp12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top