+ Reply to Thread
Results 1 to 8 of 8

Excel to choose all possible combinations

  1. #1
    Registered User
    Join Date
    04-21-2017
    Location
    Peterborough, United Kingdom
    MS-Off Ver
    2010
    Posts
    18

    Excel to choose all possible combinations

    Hi all,

    I've been trying to create this spreadsheet for days, but I'm just not sure on how to approach the final part of it, so I'm hoping someone on here will be able to help me.

    To give you some context I'm trying optimize how many pallets of certain products we can fit onto a truck. Some pallets weigh more than others and some are much more common than others. We always put 24 pallets on, but if we were to combine with other less common products that weight less we could fit on 25.

    I need to create a spreadsheet where the user enters an amount of a certain item (product A which is the most common) and it gives all the possible combinations of the other products that could go with it that keeps it under a certain weight.

    So for example. The user says they need to send out 17 of product A. It would then give you all the combinations that could fit with those 17 that keeps it below weight and at 25 in total.

    Product A = 1.138
    Product B = 1.009776
    Product C = 1.089
    Product D = 1.092
    Product E = 0.86556

    Maximum weight is 28.

    Is anyone help to help me achieve this?
    Last edited by doodlelurch; 04-21-2017 at 11:26 AM.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,827

    Re: Excel to choose all possible combinations

    It sounds like a pretty classic "knapsack problem" (Wikipedia page: https://en.wikipedia.org/wiki/Knapsack_problem ). Here are a couple of excel specific tutorials for solving the knapsack problem:
    http://blog.excelmasterseries.com/20...el-solver.html
    http://www.excel-easy.com/vba/exampl...k-problem.html

    I would suggest you start there. If you have specific questions about implementing any of the steps in those tutorials, post those questions and we will do our best to help.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    04-21-2017
    Location
    Peterborough, United Kingdom
    MS-Off Ver
    2010
    Posts
    18

    Re: Excel to choose all possible combinations

    Quote Originally Posted by MrShorty View Post
    It sounds like a pretty classic "knapsack problem" (Wikipedia page: https://en.wikipedia.org/wiki/Knapsack_problem ). Here are a couple of excel specific tutorials for solving the knapsack problem:
    http://blog.excelmasterseries.com/20...el-solver.html
    http://www.excel-easy.com/vba/exampl...k-problem.html

    I would suggest you start there. If you have specific questions about implementing any of the steps in those tutorials, post those questions and we will do our best to help.
    Thanks for your answer, it gives me a good place to start.

    Reading through them, it seems to include 'value' which I don't need. Instead I need all the possible combinations of weight instead, is this possible?

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Excel to choose all possible combinations

    and it gives all the possible combinations of the other products that could go with it that keeps it under a certain weight.
    Is your problem really that simple? Normally when loading pallets not only wight is a constraint but also size of product. I.e. a box with a given size may be stacked in a 3 dimensional way to fill the pallet to a specified height / length.

    If so there are a number of programs that can solve problem like this

    http://www.packer3d.com/online/pal-by-box

    Alf

  5. #5
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Excel to choose all possible combinations

    As you only seem to be interested in weight combination to add up to a given value perhaps this thread could be of interest

    https://www.excelforum.com/excel-gen...-up-to-it.html

    See post # 5

    Alf

  6. #6
    Registered User
    Join Date
    04-21-2017
    Location
    Peterborough, United Kingdom
    MS-Off Ver
    2010
    Posts
    18

    Re: Excel to choose all possible combinations

    Quote Originally Posted by Alf View Post
    Is your problem really that simple? Normally when loading pallets not only wight is a constraint but also size of product. I.e. a box with a given size may be stacked in a 3 dimensional way to fill the pallet to a specified height / length.

    If so there are a number of programs that can solve problem like this

    http://www.packer3d.com/online/pal-by-box

    Alf
    No, the pallets are already stacked. I'm interested in what combinations we can put pallets into a lorry based on their weight while not going over 28.

  7. #7
    Registered User
    Join Date
    04-21-2017
    Location
    Peterborough, United Kingdom
    MS-Off Ver
    2010
    Posts
    18

    Re: Excel to choose all possible combinations

    Quote Originally Posted by Alf View Post
    As you only seem to be interested in weight combination to add up to a given value perhaps this thread could be of interest

    https://www.excelforum.com/excel-gen...-up-to-it.html

    See post # 5

    Alf
    Ok thanks, I'll have a look now.

  8. #8
    Registered User
    Join Date
    04-21-2017
    Location
    Peterborough, United Kingdom
    MS-Off Ver
    2010
    Posts
    18

    Re: Excel to choose all possible combinations

    Quote Originally Posted by Alf View Post
    As you only seem to be interested in weight combination to add up to a given value perhaps this thread could be of interest

    https://www.excelforum.com/excel-gen...-up-to-it.html

    See post # 5

    Alf
    Ok so I can figure some of it out. That document is useful but there's two things it doesn't do:

    1. I need a maximum of 26 items (pallets). Most likely 25.
    2. I don't need it to exactly add up to 28 it just needs to be less than 28.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. combinations with excel
    By gtemp in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-06-2017, 12:08 PM
  2. Excel Function Combinations
    By Greystones in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-11-2015, 05:27 AM
  3. Two validations: first choose the sheet (1-5), then choose the option
    By bee88 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-17-2014, 08:12 AM
  4. [SOLVED] Formula help to choose lowest cost from multiple vendors and then choose vendor
    By roland_arv in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-27-2013, 07:48 PM
  5. Excel Combinations
    By mariolspeter in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-23-2013, 03:29 AM
  6. [SOLVED] how to generate combinations in excel
    By sgrondines in forum Excel General
    Replies: 5
    Last Post: 08-13-2012, 07:24 AM
  7. Finding possible combinations & listing the wanted combinations
    By Zoke in forum Excel Programming / VBA / Macros
    Replies: 30
    Last Post: 07-16-2012, 03:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1