+ Reply to Thread
Results 1 to 4 of 4

Finding right combination of numbers

  1. #1
    Registered User
    Join Date
    09-10-2011
    Location
    calgary, canada
    MS-Off Ver
    Excel 2007
    Posts
    1

    Finding right combination of numbers

    Hi there,

    Is there a way to determine the right combination of numbers that would sum up to a certain number either through vba or a built in excel function?

    for example:

    a1 1
    b1 2
    c1 3

    we want to pick the numbers that sum up to 3. The function would pick cell a1 and b1 or high light them.

    Your help would be appreciated

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,451

    Re: Finding right combination of numbers

    Hi shocktrop and welcome to the forum,

    I think we need a bigger and more real example. Why wouldn't C1 alone be the correct answer? It would equal to three all by itself.

    What would expect if no combination of the possible numbers would sum to the desired answer? Would you claim it wasn't possible or simply give the closest answer? What if different combinations of numbers added up the the desired answer?

    A better or real example might be needed to get closer to answering the bigger question.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Contributor
    Join Date
    09-23-2008
    Location
    Mexico
    Posts
    200

    Re: Finding right combination of numbers

    Maybe this:
    http://www.tushar-mehta.com/excel/te...e_combinations

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,451

    Re: Finding right combination of numbers

    Hi Armondo,

    I've seen these "find the numbers" problems before. They normally tell how many numbers you get to select to add to some target value. Because this OP (original poster) didn't specify, it could be any number of numbers, which makes the problem MUCH harder.

    My approach is to let the computer guess, using random numbers, and see if the guess is correct. For us humans this is time consuming but computers have all night to work on the problem.

    We had one like this a few months ago where an accountant was short some amount. He thought it was three of the 100 transactions that were missed. I took three of the numbers at random and added them to see if it was his missing total. I found two or three possibilities from the 100 numbers by letting the computer guess.

    Look at my attached for my approach. It takes about a second to find the answer in my problem.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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