Results 1 to 5 of 5

Combination of Numbers that equal a certain Sum

Threaded View

  1. #1
    Registered User
    Join Date
    08-25-2012
    Location
    LA, USA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Combination of Numbers that equal a certain Sum

    Hi everyone, I have an interesting problem which I still can't find a solution to even in other forums. Hope someone can help. Anyway, I'd like to generate a list that exhausts all possible combinations for a given sum with a given number of columns. For example, I would like to know all the possible combinations by which I can arrive at 50 using 7 columns.

    1st combination
    Col 1: 49
    Col 2: 1

    2nd combination
    Col 1: 49
    Col 2: 0
    Col 3: 1

    3rd combination
    Col 1: 49
    Col 2: 0
    Col 3: 0
    Col 4: 1

    (...until col 7)

    I'd also like to have:
    Col 1: 48
    Col 2: 1
    Col 3: 1
    Col 4: 0
    col 5: 0
    col 6: 0
    col 7: 0

    Col 1: 48
    Col 2: 2
    Col 3: 0
    Col 4: 0
    col 5: 0
    col 6: 0
    col 7: 0

    and so on.... (Hopefully my example is clear cause im having problems pasting a table here)

    I do hope that if anyone comes up with a code, it will be generic (i.e. not just for sum of 50 or column of 7). I actually wish to use this even for sum of 100. Thanks for the help, it will be greatly appreciated
    Last edited by darkwinged; 08-25-2012 at 12:46 AM.

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