Creating packages with a maximum limit in a column | Excel 2016

Copper Contributor

Hello!

I want to create Packages with a maximum limit. You can think of a transport pallett and the weight of a pallett is not allowed to have a weight over 1 kg. Now i have my excel list with a column for my package number and the weight of the package. We don't have to worry about the size and so on. Only the weight is interesting for us.

As an Example:

01 - 0,35kg

02 - 0,65kg

04 - 1,00kg

05 - 0,23kg

06 - 0,18kg

07 - 0,27kg

08 - 0,36 kg

09 - 0,21kg

10 - 0,21kg

11 - 0,21kg

12 - 0,21kg

20 - 0,48kg

Now i want Excel to create packages for me. Like Number 1 and 2 is one package. Number 4 is one package. And so on.

I would be very happy about every help!

 

Thank you very much in advance!

Jonas

1 Reply

@JonasBer , this is not an easy problem to solve. This is a variation of the classic Knapsack problem (Knapsack problem - Wikipedia). After a quick search, I found a couple of solutions you can try:

 

Here's a VBA solution: Knapsack Problem in Excel VBA - Easy Excel Macros

An Excel solution : Solving the 0-1 Knapsack problem with Excel – Jonas Lindstrøm

An add-in that seems to help (I tried the Trial and looks promising) :  Excel SumMatch

 

Hope these get you started.