+ Reply to Thread
Results 1 to 10 of 10

Random winner list with no duplicates

  1. #1
    Registered User
    Join Date
    09-21-2021
    Location
    Bucharest, Romania
    MS-Off Ver
    365
    Posts
    19

    Random winner list with no duplicates

    Hello, guys,

    I've been trying to put together a small tool that helps me select a list of winners from a total pool of participants, without having duplicates in the list. Based on inputs from fellow ExcelForum members I've got something going but it still has some kinks, in essence it selects random winners, puts them to where I need them do be in the output but there are still duplicates.

    As a summary, I put winner data on sheets 2 & 3 and use the top 2 buttons from sheet 1 to populate the list starting from Sheet1:A1 -> F(as many entries as there are from the rest of the sheets). For this I pull in first name, last name, phone number, a receipt number (a purchase they made) plus an identifier I put in to be able to quickly find that particular entry on the 2nd and 3rd sheets.

    The large button then starts the PickNamesAtRandom() function which I had help with from a fellow user, it has a statement for duplicates but it doesnt seem to do the trick.
    In the O9 cell i put in how many winners I want it to pick and after calling the function it starts populating results in the N12 - R(how many entries I need) table.

    I've set up conditional formating to check for duplicates (it should do this based on the phone numbers, judging that I have different rows of information I thought it to be the best identifier of a valid entry) and even if I ask it to provide 10 winners from 100 total it still has instances where it gives duplicates.

    Any help would be much appreciated. Thank you,

    RANDOM WINNER PICKER.xlsm

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Random winner list with no duplicates

    The names can be generated like this with a formula:

    =LET(d,LAMBDA(x,p,LET(g,SORTBY(p,RANDARRAY(ROWS(p))),IF(AND(p<>g),g,x(x,p)))),TAKE(d(d,B2:B95),O9))
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    09-21-2021
    Location
    Bucharest, Romania
    MS-Off Ver
    365
    Posts
    19

    Re: Random winner list with no duplicates

    Hello, thank you, is there any way to have this as a static result and not have it recalculate every time I make a change to the sheet? What would be awesome is to have it integrated in the scrip so that it triggers only on pressing the button and have the results unchanged even if I modify something else on the sheet. Thank you

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Random winner list with no duplicates

    You'll need to wait for a VBA expert if you need this to work in that way.

  5. #5
    Registered User
    Join Date
    09-21-2021
    Location
    Bucharest, Romania
    MS-Off Ver
    365
    Posts
    19

    Re: Random winner list with no duplicates

    Thank you, I'll wait for a response from a VBA expert, hope someone can help.

  6. #6
    Registered User
    Join Date
    09-21-2021
    Location
    Bucharest, Romania
    MS-Off Ver
    365
    Posts
    19

    Re: Random winner list with no duplicates

    Guess there are no VBA experts around?

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Random winner list with no duplicates

    There are plenty. Making comments like that won't encourage them to help you, though.

    Be patient, please: I am sure someone will respond in due course.

    Approx. 140 views of the thread so far, so plenty of people are looking, and that will include VBA experts.

  8. #8
    Forum Contributor
    Join Date
    01-06-2015
    Location
    Huntsville, AL
    MS-Off Ver
    Office 365
    Posts
    185

    Re: Random winner list with no duplicates

    Aleeko, I used the formula provided by AliGW and turned off the auto refresh. To do this you click on Formulas\Calculate Options\ and toggle to Manual. You can click F9 to refresh or click the button you created. Note that any formula on the sheet will not update until clicking F9.
    Attached Files Attached Files

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: Random winner list with no duplicates

    Some variations on a theme, all based on Ali's original formula.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


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

    Re: Random winner list with no duplicates

    vba, version free.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by jindon; 03-08-2024 at 11:45 PM. Reason: typo

+ 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. Selecting Random Winner with Weights
    By pchelpwithexcel in forum Excel General
    Replies: 2
    Last Post: 07-31-2017, 02:22 PM
  2. Generate random winner based on weighted score
    By SimonFinch in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-09-2014, 05:33 PM
  3. Excel 2007 : Semi-Random list, no duplicates.
    By Masker in forum Excel General
    Replies: 4
    Last Post: 05-20-2012, 04:44 PM
  4. Random from list...without duplicates
    By HuskerBronco in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-23-2010, 08:17 AM
  5. Random List Selection w/No Duplicates
    By jakornelis in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-13-2007, 05:53 AM
  6. Random List Selection w/No Duplicates
    By RDSProgrammer in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-10-2007, 05:06 PM
  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