+ Reply to Thread
Results 1 to 4 of 4

Macro to scan through groups of combinations for numbers not in the group

  1. #1
    Registered User
    Join Date
    05-15-2008
    Location
    Malaysia
    MS-Off Ver
    MS 2007
    Posts
    12

    Macro to scan through groups of combinations for numbers not in the group

    Hi All,

    I am not sure if this is feasible. I am trying to find a group of 20 to 30 combinations in a group of 50 combinations that doesn't consist of 6 to 10 of the numbers in 1 to 52.

    I.E. below I have 50 combinations of numbers 1 to 52...

    5 8 15 26 36 47
    14 24 25 35 43 48
    7 19 29 32 35 45
    17 19 20 32 39 41
    1 2 27 31 32 39
    16 18 20 26 28 29
    28 32 33 40 49 51
    14 20 26 27 28 39
    2 8 39 44 49 50
    6 25 26 35 39 50
    16 19 20 25 43 52
    2 3 32 34 39 47
    11 17 25 26 35 49
    14 17 32 38 46 49
    1 5 12 14 27 30
    5 12 22 26 31 47
    2 8 18 38 39 46
    6 7 18 30 47 50
    15 20 23 30 44 50
    1 7 11 34 48 52
    13 14 30 31 38 47
    2 3 19 29 32 47
    3 7 21 35 42 50
    4 8 18 33 49 50
    5 6 7 9 12 19
    9 16 17 33 34 36
    13 15 20 27 46 49
    8 10 12 34 40 48
    11 19 21 34 39 47
    18 25 29 35 38 51
    1 4 5 17 27 38
    4 18 19 24 31 32
    4 15 19 23 24 25
    9 23 25 34 37 51
    9 20 24 36 44 46
    10 23 30 43 47 52
    5 6 15 16 39 44
    3 4 7 9 25 44
    4 5 7 26 33 45
    5 18 19 30 40 50
    2 5 24 33 37 39
    3 6 13 14 17 35
    12 19 24 28 30 39
    18 35 36 39 45 47
    7 10 22 31 36 37
    5 12 15 35 38 50
    11 20 24 35 39 49
    5 7 10 15 36 37
    13 21 31 38 39 40
    8 18 21 25 40 45

    For the above of 50 combinations, I would like a macro to scan through all possible combinations of 20 to 30 combinations to look for a group of combinations that is missing 6 or 7 or 8 or 9 or 10 numbers in 1 to 52.

    So its like the marco will prompt me asking how many combinations I want to scan through that 50 combinations. Maybe I enter 25 and it will look through all possible combinations of 25 in the 50 combinations for a group of combination that is missing 6 or 7 or 8 or 9 or 10 numbers in 1 to 52.

    For the above case, I know excel would have to look through 126410606437752 groups of 25 combinations to look for 1 group of combination that has 6 or 7 or 8 or 9 or 10 missing numbers in 1 to 52, so I was wondering is it possible.

    Thanks in advance for the help/advise.

    Flex

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Macro to scan through groups of combinations for numbers not in the group

    Are you after a single combination that satisfies your criterea or all combinations? It looks like the latter will lead to some very big numbers.
    Martin

  3. #3
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Macro to scan through groups of combinations for numbers not in the group

    It is unclear to me what you need. Where are the numbers stored and how?

    =COMBIN(52,6)= 20,358,520 combinations. Obviously, not even excel2007 can handle that many rows. One typically puts each number into a cell. So, 52x6 would have 6 columns and 20,358,520 rows if that were possible.

    I have stored these kinds of numbers in a text file but one can store them in other file formats like MDB. If you had your combinations in an MDB table, it might make your query a bit easier and faster.

  4. #4
    Registered User
    Join Date
    05-15-2008
    Location
    Malaysia
    MS-Off Ver
    MS 2007
    Posts
    12

    Re: Macro to scan through groups of combinations for numbers not in the group

    Thanks for the replies, Mrice and Kenneth Hobson.

    I am after a single group of say 26 combinations out of 50 combinations that satisfy the criteria of missing 6 or 7 or 8 or 9 or 10 numbers in the range of 1 to 52.

    I.E. The 26 combinations below do not have the numbers 2 15 21 22 23 37 42 47

    14 24 25 35 43 48
    7 19 29 32 35 45
    17 19 20 32 39 41
    16 18 20 26 28 29
    28 32 33 40 49 51
    14 20 26 27 28 39
    6 25 26 35 39 50
    16 19 20 25 43 52
    11 17 25 26 35 49
    14 17 32 38 46 49
    1 5 12 14 27 30
    1 7 11 34 48 52
    4 8 18 33 49 50
    5 6 7 9 12 19
    9 16 17 33 34 36
    8 10 12 34 40 48
    18 25 29 35 38 51
    1 4 5 17 27 38
    4 18 19 24 31 32
    9 20 24 36 44 46
    3 4 7 9 25 44
    4 5 7 26 33 45
    5 18 19 30 40 50
    3 6 13 14 17 35
    12 19 24 28 30 39
    11 20 24 35 39 49

    What I want is for the macro to turn out the group of combinations that does not have the 6 or 7 or 8 or 9 or 10 numbers. Or rather what I want are the missing numbers in that group of combinations

    So it's like the macro can prompt me for the number of combinations I want to search through the 50 combinations and say I enter 25 and it will search for a particular group of 25 combinations that does not have 6 or 7 or 8 or 9 or 10 numbers in the range of 1 to 52.

    I know excel would have to search through 126410606437752 groups of 25 combinations in 50 combinations to find that one group that does not have 6 or 7 or 8 or 9 or 10 numbers which I doubt excel is able to handle but just thought I ask anyway.

    Thanks again for the help.

+ 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