+ Reply to Thread
Results 1 to 4 of 4

Finding what multiples to a target number, multiple cells.

  1. #1
    Registered User
    Join Date
    10-04-2017
    Location
    USA
    MS-Off Ver
    2013
    Posts
    1

    Finding what multiples to a target number, multiple cells.

    Hello- I am trying to figure out if there is a function in excel, to determine what numbers 'x' must be to get a sum total of $21,843.00..

    Missing # Multiplier SUM
    A X $180.00 $- (X*180)
    B X $180.00 $- (X*180)
    C X $92.00 $- (X*92)
    D X $92.00 $- (X*92)
    E X $92.00 $- (X*92)

    $21,843.00 (Total of all sums aka target number)


    I can use excel and type in numbers individually until it sums up to correct number, but that takes a long time. I am looking for a shortcut. Does anyone have an idea?
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Finding what multiples to a target number, multiple cells.

    Check out xl's solver addin.

    http://www.excel-easy.com/data-analysis/solver.html

  3. #3
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: Finding what multiples to a target number, multiple cells.

    There is no simple function, formula or built in feature to do this. What your asking sounds simple but is much more complex than people guess. Solver is likely the closest built in option, but that wont give you a combination of variables, only 1 as far as i know.

    You are not the first and by far not the last who will ask how to do this. Many people come to this question when trying to balance books, etc.

    The problem is, that just because a number of values add up to a sum, doesn't mean they are the values you want unless you are dealing with an extremely limited set of data...in which case its still faster to do manually.

    Any automated approach to this will require taking into consideration many factors and assuming a margin of error that may not be acceptable to you. Taking the example you gave, I would be surprised if there wasnt a dozen or more combinations that sum up to the number you have as the total. Which one is right then? The first match found? The one with the least # of "items" (ie: 2x something instead of 5x something)?

    The above doesn't even broach what happens when there is no exact match/combination. Thats the other aspect that makes this hard, when do you stop checking combinations? If you exhaust every possible combination that could be thousands, millions, or more guesses which takes time.

    So to answer your question, you need to know what qualifies a result (combination of things that sum up to your total) as done, correct, etc?

    If you want all combinations, then you can brute force it with a macro.

    If you need a single answer, you have to decide the conditions the answer needs to meet to be correct.

    hopefully this helps

    EDIT: as a matter of fact, after reviewing your example...in the example I do not think there are any combinations that would work...unless you can multiply by decimal numbers (ex: 1.5x). I say this because all the values you gave are even numbers....any sum of all even numbers is always even, but your sum is odd. Im a bit tired, hopefully I didnt put my foot in my mouth but I think I am correct here. If I were, any method of trying to find the combination would exhaust all possible combinations before realizing the same as I did, which could be thousands or millions or more combinations.
    Last edited by Zer0Cool; 10-04-2017 at 05:05 PM.

  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: Finding what multiples to a target number, multiple cells.

    I agree with Zer0cool that there probably is not any combination that will work unless you allow for decimals.

    Just for fun I set up 3 different models.

    My first model used Simplex LP engine and it gave a difference of 55 $ (target value - Objective function).

    My second model using the GRT Nonlinear engine gave me a difference of 15 $

    And finally the third model using the Evolutionary engine where the difference was 3 $

    For the first two models I only needed two constraints. The numbers in range B2:B6 should be integers and all values should be >= 1.

    In the third model I did have to set a max limit on the size of the numbers in range B2:B6 i.e. <= 80. If there was no upper limit on these numbers solver added so huge numbers
    in the range B2:B6 that when solver started to reduced these numbers there was no significant change in the object function so solver reported it had an optimal solution after 10 seconds.

    Alf
    Attached Files Attached Files
    Last edited by Alf; 10-07-2017 at 12:03 PM.

+ 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. Finding a Target Number
    By PaulB1980 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-22-2017, 12:19 PM
  2. [SOLVED] Conditional Formatting For Cells with Multiples of a Certain Number
    By JAMES456 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-08-2015, 12:59 PM
  3. Sum of and multiples two values should give me the nearest target value.
    By Roopa Rani in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-22-2013, 08:25 AM
  4. [SOLVED] Worksheet_Change(ByVal Target As Range) - set to only update when 3 target cells changed?
    By trillium in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-07-2012, 06:40 PM
  5. [SOLVED] increasing a cells number by multiples
    By Earthfury in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 08-09-2012, 02:50 AM
  6. Finding a number in multiple cells with each of its own range
    By mmm213 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-14-2009, 06:46 PM
  7. [SOLVED] can 1 excel's DROP target change MULTIPLE cells?
    By Huy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-18-2006, 04:05 AM

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