+ Reply to Thread
Results 1 to 5 of 5

Lottery numbers generator without history numbers

  1. #1
    Registered User
    Join Date
    11-19-2019
    Location
    Tatabánya, Hungary
    MS-Off Ver
    2019
    Posts
    30

    Lottery numbers generator without history numbers

    Hi everybody

    I turn to you because I have a question.
    The following document lists the extracted numbers and a generated list.
    I ran into drawing lots of numbers that had already been played.
    How could the number strings that have already been drawn be filtered out in the generator?

    Thanks for the help.

    Wlad
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try this ‼


    According to your attachment as a VBA beginner starter using some Excel basics :

    PHP Code: 
    Sub Demo1()
        
    Dim VWXP%, R%, YJ$, S$(1 To 101), L%, Z(1 To 101)
            
    = Array([COLUMN(A:G)], [COLUMN(H:N)], [COLUMN(O:U)], [COLUMN(V:AB)], [COLUMN(AC:AI)])
            
    = [COLUMN(A:AI)]
            
    Munka1.[C3:C103&"-"&D3:D103&"-"&E3:E103&"-"&F3:F103&"-"&G3:G103&"-"&H3:H103&"-"&I3:I103]
            
    Randomize
        
    Do
            For 
    35 To 8 Step -1
                R 
    Fix(Rnd P) + 1:  W(R):  W(R) = W(P):  W(P) = Y
            Next
            
    For Each Y In V
                    Y 
    Application.Small(Application.Index(W, , Y), V(0))
                    
    Join(Y"-")
                If 
    IsError(Application.Match(JX0)) Then
                    
    If IsError(Application.Match(JS0)) Then
                        L 
    1:  S(L) = J:  Z(L) = Y
                        
    If 101 Then Munka1.[L3:R103] = Application.Index(Z, [ROW(1:101)], V(0)): Exit Sub
                    End 
    If
                
    End If
            
    Next
        Loop
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 07-26-2020 at 05:01 PM. Reason: revamped for more Excel basics …

  3. #3
    Registered User
    Join Date
    11-19-2019
    Location
    Tatabánya, Hungary
    MS-Off Ver
    2019
    Posts
    30

    Re: Lottery numbers generator without history numbers

    Hi Marc L

    Thank you very much for your solution.

    But I still want to ask you to enlighten me please as I don’t understand much about the vba.
    I mean:
    You have created an array (v) in which you have added columns: (a: i, h: n, o: u, v: ab, ac: ai) that do not even contain data. How and why?
    Or (w) is all of the above, but why?
    I mean (x).
    Why does (p) count to 35-8?
    (R) also causes headaches.

    In any case, thank you for your solution, if you had a book or a link to a solution to this case, from which I can understand why and how it is here, I would thank you.

    All I guessed was that you had to work with an array,
    but there would be nothing that would help my studies as well.

    One where the generation of seven numbers can be handled separately?
    I also put together the original by learning a lot from it. And for me, rewriting is also easier for another type if I handle it separately.

    If you could help me with that, I would also like to thank you.

    Hello Wlad

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Lottery numbers generator without history numbers


    Thanks for the rep' !

    Variant variable V does not contains columns but a numbers array as you can check yourself
    in debugging mode in the VBE Locals window - the best way to learn what the procedure does - like for example
    V(0) is equal to {1,2,3,4,5,6,7} and that's the same for variant variable W which contains an array from 1 to 35 …

    So the For P = 35 to 8 … shuffles the W array for 5 series of 7 numbers thus avoiding any duplicate number
    and variable R is just a random number …

  5. #5
    Registered User
    Join Date
    11-19-2019
    Location
    Tatabánya, Hungary
    MS-Off Ver
    2019
    Posts
    30

    Re: Lottery numbers generator without history numbers

    Thank you Marc

    I will try to interpret and use the code you provide.

    by

+ 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. quads for lottery numbers
    By dragon66 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-14-2014, 11:50 AM
  2. Lottery Numbers Matching
    By west7711 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-20-2013, 02:13 PM
  3. Check repeated draw numbers on Florida lottery History > 2000 rows :(
    By miariver in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 05-28-2013, 07:35 PM
  4. [SOLVED] creating lottery numbers
    By gencoglu27 in forum Excel General
    Replies: 5
    Last Post: 10-03-2011, 03:30 AM
  5. Excel 2007 : Lottery Numbers
    By mulligbo in forum Excel General
    Replies: 6
    Last Post: 08-30-2010, 09:41 PM
  6. Lottery Numbers
    By MyLawd in forum Excel General
    Replies: 7
    Last Post: 09-12-2008, 10:20 AM
  7. Lottery numbers
    By Donald in forum Excel General
    Replies: 6
    Last Post: 11-29-2006, 08:55 PM
  8. [SOLVED] Bingo Lottery Winning Numbers
    By Nomis-MCSE in forum Excel General
    Replies: 1
    Last Post: 01-13-2006, 03:25 PM

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