+ Reply to Thread
Results 1 to 15 of 15

Excel solver only exact number

  1. #1
    Registered User
    Join Date
    07-04-2022
    Location
    Hungary
    MS-Off Ver
    2019
    Posts
    36

    Excel solver only exact number

    Hello guys!

    Is there any way to make this:
    I have demands (200,132,100,82,340 for example), and a box with 80 slot, and i want that my result divisible by 80, result as an integer, so only exact number is a result, so its says im gonna need ~4boxes.
    Obviously i have a lot of demands, and somehow i want to optimize.

    Thanks in advance.

  2. #2
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Excel solver only exact number

    Why do you need ~4boxes?

  3. #3
    Registered User
    Join Date
    07-04-2022
    Location
    Hungary
    MS-Off Ver
    2019
    Posts
    36

    Re: Excel solver only exact number

    Well i just wrote a random number, that wasnt my point.
    I just a result which is divisible by 80

  4. #4
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Excel solver only exact number

    And in what ways is it allowed to get a correct result?
    Can you give an example of that?

  5. #5
    Registered User
    Join Date
    07-04-2022
    Location
    Hungary
    MS-Off Ver
    2019
    Posts
    36

    Re: Excel solver only exact number

    So my idea is this: If i have a boxes with 80 slots, but i have (for example) 421 demands. Thats 421/80 = 5,26, so my result should be 400 or 5, and whats left it shouldnt add to it, so 21 waiting for new demands, for a new calculation.

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

    Re: Excel solver only exact number

    Whatever the details are, your problem sounds like a kind of knapsack problem. Whatever the details are, I would expect to use a template like this one put together by the programmers of Excel's Solver: https://www.solver.com/partial-loading-knapsack-problem (if you look around, you should be able to find a download with many example problems).

    Somehow, you will need to calculate your objective function (whatever that looks like in relation to demand and boxes and exactly what you are trying to optimize). Then you will need to incorporate somewhere in your Solver model a way to force the result to be even multiples of 80. Then tell Solver to optimize the objective function by changing your decision variables subject to the constraint that respects this multiple of 80 constraint.

    In order for us to provide more specific help, it would be helpful for you to put together a basic spreadsheet model of a knapsack problem showing your best guess at objective function, decision variables, and constraint calculations. Then we will be in a better position to see how you want to set up the spreadsheet/Solver model and can make suggestions from there.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  7. #7
    Registered User
    Join Date
    07-04-2022
    Location
    Hungary
    MS-Off Ver
    2019
    Posts
    36

    Re: Excel solver only exact number

    Thank you very much, if i can't figure it out, i'll write here again.

  8. #8
    Valued Forum Contributor
    Join Date
    11-29-2022
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    435

    Re: Excel solver only exact number

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Excel solver only exact number

    I don't understand in which way it is allowed to get a result.

    I don't know what you mean with a box and a slot.

    Please give some concrete samples of input and expected results which an explanation?
    Last edited by HansDouwe; 12-17-2022 at 02:54 PM.

  10. #10
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Excel solver only exact number

    A Guess

    If demand in A2:A<n>, please try in B2 and copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and for the number of total boxes, please try
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    07-04-2022
    Location
    Hungary
    MS-Off Ver
    2019
    Posts
    36

    Re: Excel solver only exact number

    So basicially i have found a way to do it, i uploaded it, my only problem is that somehow i need to proritize the dates, the most upcoming dates should be used first, then the later upcoming dates.
    Any ideas how should i do that?
    (24000kg is the max amount i can put in a truck that i want to use)

    sh_test.xlsx

  12. #12
    Registered User
    Join Date
    07-04-2022
    Location
    Hungary
    MS-Off Ver
    2019
    Posts
    36

    Re: Excel solver only exact number

    Upload: I divided the demands by 80*

  13. #13
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Excel solver only exact number

    Sorry.
    I still don't get it because I still don't see a concrete example with manually added expected results and explanation.
    I also asked for a concrete example in post #4 and in post #9, but which I still have not seen.

  14. #14
    Registered User
    Join Date
    07-04-2022
    Location
    Hungary
    MS-Off Ver
    2019
    Posts
    36
    Quote Originally Posted by HansDouwe View Post
    Sorry.
    I still don't get it because I still don't see a concrete example with manually added expected results and explanation.
    I also asked for a concrete example in post #4 and in post #9, but which I still have not seen.
    In that excel i uploaded was made by solver, the amounts column

  15. #15
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Excel solver only exact number

    I can't do anything with that.
    You have to show the problem that needs to be solved and you have to indicate the rules that have to be followed.
    This is often easiest with a concrete example.

+ 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. SOLVER Error Message: excel solver objective cell contents must be a formula
    By bluevil in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-03-2022, 05:38 AM
  2. Replies: 5
    Last Post: 10-09-2020, 03:33 AM
  3. Excel solver - Trouble with linear programming using solver excel
    By spicyscreamer in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-04-2017, 08:01 AM
  4. Replies: 9
    Last Post: 04-25-2017, 12:22 PM
  5. [SOLVED] Solver loop with macro - exact code
    By fidocze in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-27-2016, 12:36 AM
  6. [SOLVED] Excel Solver VBA - Solver Violating Constraints
    By lespaul00 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-19-2015, 04:00 PM
  7. Formula to work out an exact average over an exact number
    By Sandyshirl in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-11-2013, 01:35 AM

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