All possible combinations

Solved
Proferic06 Posted messages 18 Status Member -  
zorro$01 Posted messages 3 Status Member -
Hello everyone,

how to create in Excel all possible combinations of the EuroMillions without the stars,
that is to say:
all possible combinations of 5 numbers from 1 to 50.

Example: 1.2.3.4.5/ 1.2.3.4.6/ 1.2.3.4.7.... etc
That's about 2 million.

Thank you all.

10 answers

  1. via55 Posted messages 14393 Registration date   Status Member Last intervention   2 759
     
    Hello

    The macro for combinations of 5 digits
    Sub combi() y = 1 For a = 1 To 46 For b = a + 1 To 47 For c = b + 1 To 48 For d = c + 1 To 49 For e = d + 1 To 50 comb = a & " " & b & " " & c & " " & d & " " & e x = x + 1 If x = 1000000 Then x = 1: y = y+1 Cells(x, y) = comb Next Next Next Next Next End Sub 


    In 3 columns because one is not enough 2,118,760 combinations

    Given the number of iterations, the macro takes a bit of time to execute

    Best regards
    Via

    --
    "Imagination is more important than knowledge." A. Einstein
    3
    1. Proferic06 Posted messages 18 Status Member
       
      Thank you already for your responses, Via55 and Zoul67!!
      However, I don't know how to do it...
      Could someone send it to me by email please?
      Email address removed Moderation CCM
      Thank you in advance.
      0
      1. Amel_2846 Posted messages 5 Status Member > Proferic06 Posted messages 18 Status Member
         

        Could I also have the table by email?

        0
    2. zorro$01 Posted messages 3 Status Member 1
       

      Hello,

      Thank you.

      Could you please send me the table by email: ***@***

      The link is no longer displayable.

      Best regards.

      Zizou

      0