+ Reply to Thread
Results 1 to 5 of 5

Show all combinations of 'n' numbers with condition(s)?

  1. #1
    Registered User
    Join Date
    09-08-2014
    Location
    New York
    MS-Off Ver
    2010
    Posts
    12

    Show all combinations of 'n' numbers with condition(s)?

    Hello, I have a various difficulties within this excel problem.

    counting combinations.xlsx


    I must calculate all combinations of 7 numbers that give sum of 100. Numbers must be in interval from 1 to 39.
    First condition is that sum of numbers must be changeable (i mentioned before sum of 100 to be simpler so I typed number 100 in the document). The sum can be also 150 or 88 for example, depending what number is entered in cell K2.

    Second condition is that every combination must be unique (no such things like 7,8,9,10,16,20,30 and 30,20,16,10,9,8,7 and 7,8,10,9,3,20,16). This is example how results shouldn't be because all 3 combinations have same numbers only with different position/order). Only one combination of same numbers is possible and numbers must be ordered from smaller to larger numbers).

    Is this possible to do, what is best option: functions or maybe some macro?

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

    Re: Show all combinations of 'n' numbers with condition(s)?

    I think this sort of thing is usually easier using a symbolic language like VBA or C than using spreadsheet formulas. You can then use some relatively simple loops or even recursive algorithms to obtain your result.

    This looks like basically the same kind of problem discussed here: http://www.excelforum.com/excel-gene...-of-100-a.html I'd suggest you start by reviewing this discussion and adapt it to your specific requirements.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Show all combinations of 'n' numbers with condition(s)?

    In a two-minute search, http://saliu.com/forum/lottery-sums.html
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Show all combinations of 'n' numbers with condition(s)?

    ....................

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Show all combinations of 'n' numbers with condition(s)?

    One way:

    Please Login or Register  to view this content.
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    1
    18
    17
    15
    14
    13
    12
    11
    2
    18
    17
    16
    14
    13
    12
    10
    3
    18
    17
    16
    15
    13
    11
    10
    4
    18
    17
    16
    15
    13
    12
    9
    5
    18
    17
    16
    15
    14
    11
    9
    6
    18
    17
    16
    15
    14
    12
    8
    7
    18
    17
    16
    15
    14
    13
    7
    8
    19
    16
    15
    14
    13
    12
    11
    9
    19
    17
    15
    14
    13
    12
    10
    10
    19
    17
    16
    14
    13
    11
    10
    11
    19
    17
    16
    14
    13
    12
    9
    12
    80124
    39
    38
    10
    5
    4
    3
    1
    80125
    39
    38
    10
    6
    4
    2
    1
    80126
    39
    38
    10
    7
    3
    2
    1
    80127
    39
    38
    11
    5
    4
    2
    1
    80128
    39
    38
    11
    6
    3
    2
    1
    80129
    39
    38
    12
    5
    3
    2
    1
    80130
    39
    38
    13
    4
    3
    2
    1

+ 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. please help!!ALL COMBINATIONS REQUIRED FOR 5-DIGIT NUMBERs using numbers 0-9
    By natasha mirembe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-08-2014, 01:43 PM
  2. Formula (or macro?) to show all number combinations
    By jhill in forum Excel General
    Replies: 6
    Last Post: 05-24-2013, 11:04 AM
  3. Replies: 1
    Last Post: 04-15-2012, 09:23 AM
  4. Editing code to show common four-word combinations in a column
    By Glayva in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-07-2011, 09:06 AM
  5. Show possible colour combinations.
    By Bella81 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 02-26-2011, 10:30 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