A simple excel formula problem that requires support from experts!

Mr Kaka

New Member
Joined
Oct 19, 2022
Messages
12
Office Version
  1. 2021
Platform
  1. Windows
Hi,

I need your help in creating an excel formula that solve the following problem:

I need a formula that allows me to find the size of the smallest box that can contain a certain number of products.

On C10, I input the number of units, whereas on C13:C16 is where I would like to get the output.
On C6:C8 I reported the size of the product.
On I4:L15, I reported the available boxes.

Here you can see my worksheet:

Book2
ABCDEFGHIJ
1
2
3Product DimensionType of boxes
4Longest side (cm)20IDLongest side (cm)Median side (cm)Shortest side (cm)
5Median side (cm)81202010
6Shortest side (cm)62202020
73302020
8Units4303020
95353015
10Box6352919
11ID7403030
12Longest side (cm)8433531
13Median side (cm)9503732
14Shortest side (cm)10504040
1511604040
16
Sheet1
Cell Formulas
RangeFormula
F6:F15F6=F5+1
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
I adjusted the data in the sheet according to your description.

Dante Amor
ABCDEFGHIJKL
1
2Type of boxes
3IDLongest side (cm)Median side (cm)Shortest side (cm)
41202010
5Product Dimension2202020
6Longest side (cm)203302020
7Median side (cm)84303020
8Shortest side (cm)65353015
96352919
10Units7403030
118433531
12Box9503732
13ID10504040
14Longest side (cm)11604040
15Median side (cm)
16Shortest side (cm)
Hoja3


So in cell C13 the following formula:
Excel Formula:
=MINIFS(I4:I14,J4:J14,">="&C6,K4:K14,">="&C7,L4:L14,">="&C8)

In cell C14:
Excel Formula:
=TRANSPOSE(FILTER(J4:L14,I4:I14=C13))


--------------
Let me know the result and I'll get back to you as soon as I can.
Cordially
Dante Amor
--------------​
 
Upvote 0
I adjusted the data in the sheet according to your description.

So in cell C13 the following formula:
Excel Formula:
=MINIFS(I4:I14,J4:J14,">="&C6,K4:K14,">="&C7,L4:L14,">="&C8)

In cell C14:
Excel Formula:
=TRANSPOSE(FILTER(J4:L14,I4:I14=C13))


--------------
Let me know the result and I'll get back to you as soon as I can.
Cordially
Dante Amor
--------------​

Thanks Dante for the prompt reply.
Unfortunately your answer does not solve the problem.

More specifically the inputs of the problem are:
  1. Product dimension: these dimensions represent the size of my product. Please bear in mind that the product can be placed in the box in any position, meaning that there is not a straight relation between (for example) the longest dimension of product with the longest dimension of the box, etc..
  2. Number of products: if i have for example 5 Units of the product (Cell C10), I need a bigger box.
 
Upvote 0
  1. Product dimension: these dimensions represent the size of my product. Please bear in mind that the product can be placed in the box in any position...
  2. Number of products: if i have for example 5 Units of the product (Cell C10), I need a bigger box.

In my case, we need some auxiliary cells, let's say cells N4 to Q9.

In cell N4 put the following formula:
Excel Formula:
=LET(a,$C$6:$C$8*C10,VSTACK(INDEX(a,{1,2,3},0),ÍNDICE(a,{1,3,2},0),INDEX(a,{2,1,3},0),INDEX(a,{2,3,1},0),INDEX(a,{3,1,2},0),INDEX(a,{3,2,1},0)))

In cell Q4 this formula and copy down to Q9:
Excel Formula:
=MINIFS($I$4:$I$14,$J$4:$J$14,">="&N4,$K$4:$K$14,">="&O4,$L$4:$L$14,">="&P4)

In cell C13:
Excel Formula:
=MIN(Q4:Q9)

In cell C14:
Excel Formula:
=TRANSPOSE(FILTER(J4:L14,I4:I14=C13))

Example:
1688609532759.png



I hope it helps you.
:giggle:
 
Upvote 0
Ok, here's a single formula without the helper cells.

In cell C13:
Excel Formula:
=MIN(LET(m,LET(a,$C$6:$C$8*C10,VSTACK(INDEX(a,{1,2,3},0),INDEX(a,{1,3,2},0),INDEX(a,{2,1,3},0),INDEX(a,{2,3,1},0),INDEX(a,{3,1,2},0),INDEX(a,{3,2,1},0))),MINIFS(I4:I14,J4:J14,">="&INDEX(m,SEQUENCE(6),1),K4:K14,">="&INDEX(m,SEQUENCE(6),2),L4:L14,">="&INDEX(m,SEQUENCE(6),3))))

In Cell C14:
Excel Formula:
=TRANSPOSE(FILTER(J4:L14,I4:I14=C13))

Example (Just to demonstrate that it works with a sigle formula):
1688611531349.png


:cool:
 
Upvote 0
In my case, we need some auxiliary cells, let's say cells N4 to Q9.

In cell N4 put the following formula:
Excel Formula:
=LET(a,$C$6:$C$8*C10,VSTACK(INDEX(a,{1,2,3},0),ÍNDICE(a,{1,3,2},0),INDEX(a,{2,1,3},0),INDEX(a,{2,3,1},0),INDEX(a,{3,1,2},0),INDEX(a,{3,2,1},0)))

In cell Q4 this formula and copy down to Q9:
Excel Formula:
=MINIFS($I$4:$I$14,$J$4:$J$14,">="&N4,$K$4:$K$14,">="&O4,$L$4:$L$14,">="&P4)

In cell C13:
Excel Formula:
=MIN(Q4:Q9)

In cell C14:
Excel Formula:
=TRANSPOSE(FILTER(J4:L14,I4:I14=C13))

Example:
View attachment 94794


I hope it helps you.
:giggle:

Thanks Dante, I really appreciate your support on this problem.

I think there is an issue on the name_value of the LET formula. Indeed, if we set "$C$6:$C$8*C10" we are saying that there are "n^3" units and not "n" units.

As per your example, if we have 7 units of a product with dimension 4x5x2, we should use the box with dimension "20x20x10", given that in this box we can fit 100 units.
From your formula, I believe that we are getting the box "35x30x15" because you are asking to find a box that can contain 343 units (i.e. 7^3).
 
Upvote 0
Forget my formula, it's only to solve a part of the big problem. The first thing is to accommodate the packages in different ways, and each way look for the best option. then you have to find an algorithm that will accommodate the packets and form one big packet. I'm afraid that would be very complicated with a single formula. I guess it could be with vba.
 
Upvote 0
thanks dante.
Do you think there can be a solution if we use more than a single formula? If yes, what it could be?
 
Upvote 0
Do you think there can be a solution if we use more than a single formula? If yes, what it could be?
Sincerely I dont know.
The formula system or the VBA must have the ability or skill to perform all possible combinations.

I tried to make an example of how to accommodate 6 packages. I got 9 different ways considering the width as the base, you have to rotate the packages to consider the height as the base, you have to rotate the packages to consider the length as the base.
Which will give us 27 combinations:

1688668020374.png

Then you will have to combine the dimension as the base, for example 2 packages with the width as the base, 2 packages with the height as the base and 2 packages with the length as the base, something like this:

1688668398970.png

Considering different bases, I don't know how many combinations could be given.

After obtaining more than 30 combinations, and of course, obtain the dimensions of length, width and height of each combination, each combination must be verified with the 11 box sizes, that is, make 330 comparisons and identify which is the most optimal.

I guess you already knew. I just wanted to carry out the exercise to gauge the size of the problem.

🫡
 
Upvote 0
Test PN's to Convert to New Boxes.xlsx
ABCDEFGHIJKLMNOPQRSTUVWX
1ItemCodeItemShortDescUnitCodeProducedSoldLabelWidthLabelHeightRollDiameter(inch)(W,D)Roll LengthRoll WidthRollHeight (inch)QtyPerBoxLayersPer BoxBoxesPerPalletCore Current Box#Box VolumeCurrent Head HeightProduct VolumexyzNewBox
2LAKEY10038650L 6.35mm x 6.35mm, 10035964RMRLTrueTrue0.250.256.906.906.900.453111.00100.00B300045-25BOX103465.1172NA237.293
3LAKEY10038649L 0.1563 X 0.1563, 10035964RMRLTrueTrue0.160.166.906.906.900.453116.0084.00B300045-25BOX101837.2109NA345.1535
4LAKEY10018163L 0.1563 X 0.1563, 68165RMRLTrueTrue0.160.166.906.906.900.453116.00100.00B300045-25BOX101837.2109NA345.1535
5BOX290316-002L 0.500 X 5.500, 68148RMRLTrueTrue0.505.504.004.004.000.536.0096.00Z100500BOX114461.3203NA288
610036113L 0.250 X 0.250, 05827RMRLTrueTrue0.250.257.907.907.900.58.00200.00Z300500BOX209272NA249.64
710037132L 0.250 X 0.250, 10026487RMRLTrueTrue0.250.257.907.907.900.58.00200.00Z300500BOX209272NA249.64
810030319L 0.375 x 0.500, 66447RMRLTrueTrue0.382.007.907.907.900.510.00100.00Z300500BOX103465.1172NA312.05
910023519L 0.375 X 0.375, 66680RMRLTrueTrue0.380.387.907.907.900.515.00100.00Z300500BOX103465.1172NA468.075
10LAKEY10020816L 0.3906 X 0.3906, 68165RMRLTrueTrue0.390.397.707.707.700.51518.0084.00P300515BOX119660.1563NA549.6183
Rolls
Cell Formulas
RangeFormula
I2:I10I2=H2
J2:J10J2=H2
K2:K10K2=IFNA(VLOOKUP(O2,'CoreSizes'!$A$1:$B$1499,2,FALSE),NA)
Q2:Q10Q2=VLOOKUP(P2,'https://zebra-my.sharepoint.com/personal/dstone_zebra_com/Documents/Documents/!!Box Optimization Project/[ItemListRequest_Final_Live.xlsx]FullBoxList'!$A$1:$F$713022,6,FALSE)
S2:S10S2=PRODUCT(I2,J2,K2,L2)


Test PN's to Convert to New Boxes.xlsx
ABCDEFGH
1BoxIDLengthWidth2HeightVolumeMinMidMax
2BOX1168.1256.1254.25211.50390634.256.1258.125
3BOX13313.256.254.25351.9531254.256.2513.25
4BOX13810.257.54.75365.156254.757.510.25
5BOX17511.258.1255457.0312558.12511.25
6BOX11410.12510.1254.5461.32031254.510.12510.125
7BOX1037.8757.8757.5465.11718757.57.8757.875
8BOX19512.58.55.5584.3755.58.512.5
9BOX13413.258.255.75628.5468755.758.2513.25
10BOX1151510575051015
11BOX17611.258.1258.5776.9531258.1258.12511.25
12BOX10115.757.8756.75837.21093756.757.87515.75
13BOX11115.757.8758.51054.2656257.8757.87515.75
14BOX10415108.512758.51015
15BOX10215.757.87510.751333.3359387.8757.87515.75
StockBoxList
Cell Formulas
RangeFormula
E2:E15E2=PRODUCT(StockBoxList[@[Length]:[Height]])
F2:F15F2=MIN(StockBoxList[@[Length]:[Height]])
G2:G15G2=SUM(StockBoxList[@[Length]:[Height]])-[@Length]-[@Height]
H2:H15H2=MAX(StockBoxList[@[Length]:[Height]])
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,271
Members
452,628
Latest member
dd2

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