+ Reply to Thread
Results 1 to 7 of 7

Find which items sum up to a given amount

  1. #1
    Registered User
    Join Date
    06-21-2018
    Location
    UK
    MS-Off Ver
    2010
    Posts
    5

    Find which items sum up to a given amount

    Dear Experts,

    I would very much appreciate with the following challenge.

    In light table below I have a register of goods. In dark table I have figures to match with light table. In other words, how can I find which lines from light table compute to a sum of 650 if I also know the q-ty 80? In this sample they are items 3, 4 and 6.

    2018-07-11 17_55_08.jpg

    Expected result can be any: cells can be highlighted, referenced, marked, deleted, moved, copied. Literally any way to select those items would very much help.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Find which items sum up to a given amount

    The Solver add-in should help but I dont know anything else about it.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

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

    Re: Find which items sum up to a given amount

    Subset sum problems are common. In Excel, one usually uses Solver, though, Solver may not reliably find correct solutions when multiple solutions are possible or as the data set becomes larger.

    Previous discussion: https://www.excelforum.com/excel-for...l-to-cell.html
    Outside tutorial: http://www.k2e.com/tech-update/tips/...specific-value

    How can we help you implement a solution like that?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Registered User
    Join Date
    06-21-2018
    Location
    UK
    MS-Off Ver
    2010
    Posts
    5

    Re: Find which items sum up to a given amount

    Thank you MrShorty. Let me study those links and I will get back here.

  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: Find which items sum up to a given amount

    a possible solver setup could be like this but beware of the problems mentioned by MrShorty

    Alf
    Attached Files Attached Files
    Last edited by Alf; 07-12-2018 at 12:42 AM.

  6. #6
    Registered User
    Join Date
    06-21-2018
    Location
    UK
    MS-Off Ver
    2010
    Posts
    5

    Re: Find which items sum up to a given amount

    Alf,

    Thank you very much for the template. It helped a lot and saved me time to develop one.

    Overall Solver resolved the problem. The are two deficiencies in this solution (if its true for all cases):

    1) it works only with up to 200 rows. I had to split the pool into batches of 200 rows, which not always gave the correct result.
    2) it stops when finds first match. Otherwise it would have given a chance to select closest result from several possibilities.

    Thank you both MrShorty for intro of Solver and Alf for kind template.

    Do appreciate.

  7. #7
    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: Find which items sum up to a given amount

    You are welcome and thanks for feedback.

    it works only with up to 200 rows.
    Yes, so sad but true. On the other hand there is the freebie "OpenSolver" developed by the University of Auckland N.Z. It integrates nicely with Excel and as long as the problem is a linear one you can use it for your problem which also is a linear one.

    You can build your model in Excel as "OpenSolver" can read an Excel solver model and the best of all, according to the website there are no limit to the number of constraint so you can have as many rows as you need. To download see link below:

    https://opensolver.org/

    it stops when finds first match.
    Yes, that is the way solver works but you can try to add some constraint i.e. perhaps setting a min and max number (value) on quantity and amount or specify that one or more of the
    F values that in a precious run was 1 should be 0, this will force solver to try and find another solution.

    Alf
    Last edited by Alf; 07-12-2018 at 09:46 AM.

+ 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. [SOLVED] Allocating $ amount based on ranked items
    By riordanandy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-14-2017, 05:23 AM
  2. Replies: 5
    Last Post: 06-17-2016, 10:22 AM
  3. [SOLVED] Need to find a negative amount and match it to the positve amount based on Acct# and Date
    By sbrandhorst in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-07-2016, 07:49 PM
  4. [SOLVED] having multiple data in one cell and amount of items shipped
    By jaapaap in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 08-27-2015, 06:40 AM
  5. [SOLVED] Calculating amount of master items based on mixed amount of items
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-21-2014, 11:21 AM
  6. [SOLVED] Combine like invoice items into total amount
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-05-2013, 11:19 PM
  7. Pivot table to find number of items moved given in an amount of time
    By dsoeder in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 02-20-2013, 01:16 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