+ Reply to Thread
Results 1 to 4 of 4

Randomize lucky draw winner with prize and no duplicate

  1. #1
    Registered User
    Join Date
    03-29-2022
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    17

    Randomize lucky draw winner with prize and no duplicate

    Is there any macro to randomize the "Name" into "The Winner" column, without duplicate?
    I would like it to start from very bottom to the $10000.

    Maybe no need for the macro...
    Actually, the PIC will call out the "Name" physically by lucky draw paper box, then I have to manually input their "Name" into "The Winner" column.
    Any method to make thing easier here?

    Thank you!


    Lucky Draw.xlsm

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Randomize lucky draw winner with prize and no duplicate

    One way.
    Click "NEXT button to generate random winner
    "CLEAR" to start from beginning
    Column B should not be there, just for testing

    PHP Code: 
    Option Explicit
    Sub Lucky
    ()
    Dim lr&, i&, j&, k&, r&
    Dim win As Rangerngres(1 To 1501 To 1)
    Dim dic As Object
    Set dic 
    CreateObject("Scripting.Dictionary")
    Randomize
    lr 
    Cells(Rows.Count"A").End(xlUp).Row
    rng 
    Range("A2:A" lr).Value
    For lr To 2 Step -1
        
    If Cells(i"F") = "" Then
            Set win 
    Range(Cells(1"F"), Cells(lr 1"F"))
            For 
    1 To UBound(rng)
                If 
    Application.CountIf(winrng(j1)) = 0 Then
                    k 
    1res(k1) = rng(j1)
                
    End If
            
    Next
            
    Exit For
        
    End If
    Next
    If 0 Then Exit Sub
    Rnd() * 1
    Cells
    (i"F") = res(r1)
    End Sub
    Sub CLEAR
    ()
    Dim inf
    inf 
    MsgBox("All existing data will be cleared! Do you want to continue"vbYesNo)
    If 
    inf vbNo Then Exit Sub
    Range
    ("F2:F1000").ClearContents
    End Sub 
    Attached Files Attached Files
    Quang PT

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Randomize lucky draw winner with prize and no duplicate

    Your first request
    Is there any macro to randomize the "Name" into "The Winner" column, without duplicate?
    can be handled with the following :

    Please Login or Register  to view this content.
    In the above project you would pre-enter the contestant names in Col A. Click the PICK RANDOM button and the macro randomly selects one contestant and places a mark in Col C to note that name has already been chosen.
    The macro continues until all names have been selected. You can decide at any time to clear Col C by clicking the CLEAR RANGE button.

    Download file below : Random Pick 1 by 1.xlsm‎

    ####################################################################################

    Your second request
    Actually, the PIC will call out the "Name" physically by lucky draw paper box, then I have to manually input their "Name" into "The Winner" column.
    can be fulfilled with the following :


    Please Login or Register  to view this content.
    You can edit the macro code to check any column desired. For example, maybe you only desire to enter the participant names in Col A ... edit "Set myrange = Range("B1:B10")" to say "Set myrange = Range("A1:A10")".
    The range may also be extended as far down a column as you desire. For example you could cover the range "A1:A200" to include a possible 200 participants.

    Download file below : Duplicate Check and Highlight.xlsm
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,552

    Re: Randomize lucky draw winner with prize and no duplicate

    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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. Lucky draw - randomly select lucky winners
    By booneleong in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-22-2020, 06:33 PM
  2. [SOLVED] Lucky Draw with probability distribution
    By lkdwong in forum Excel General
    Replies: 2
    Last Post: 02-21-2017, 01:36 AM
  3. VBA for Lucky draw displaying numbers
    By Jan Van der Borght in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-30-2015, 10:27 AM
  4. Random name generator with no duplicates for company's lucky draw segment
    By nekolaypeng in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-09-2014, 05:39 AM
  5. Prize Draw with Macro
    By sacen in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-23-2014, 06:56 PM
  6. Create Lucky Draw game in Excel or PowerPoint
    By alibaba in forum Excel General
    Replies: 1
    Last Post: 10-23-2009, 01:16 AM
  7. Random Winner Draw Formula Help
    By koba in forum Excel General
    Replies: 1
    Last Post: 09-18-2006, 11:50 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