All possible combinations

Solved
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

  • Votes
  • Date
  • Descending date
  1. 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
    1. 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.
    2. Hello,

      Thank you.

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

      The link is no longer displayable.

      Best regards.

      Zizou