+ Reply to Thread
Results 1 to 10 of 10

Random draw from column with different values

  1. #1
    Registered User
    Join Date
    07-07-2021
    Location
    Melbourne Australia
    MS-Off Ver
    Excel for Mac v16.5
    Posts
    3

    Talking Random draw from column with different values

    Hello, I appreciate if anyone could steer me in the right direction. This may have been asked previously so I am interested to better understand the terminology or functions required to solve.

    I have a list of entries into a competition with a summary of the number of entries of each participant in a separate column. I then seek to randomly choose (x) winners from the list considering the total number. A winner can only be selected from the list once. In the example I have attached Sam, Fiona and Barbara maybe chosen at random with weight of their selection determined by the numbers of their entries.

    I appreciate your time
    Chris (theRoof)
    Attached Files Attached Files

  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,780

    Re: Random draw from column with different values

    Welcome to the forum.

    If you wish the draw to be based on weightings, then it cannot be entirely random. Can you elaborate?
    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
    07-07-2021
    Location
    Melbourne Australia
    MS-Off Ver
    Excel for Mac v16.5
    Posts
    3

    Re: Random draw from column with different values

    Thank you.
    I possible have the terminology incorrect. I have updated my example to show how I currently solve this problem, this is a very manual process and very interested in learning how code or a script my solve.

    In my example there are 8 Names with a varied number of entries from 112 to 542.
    I would like to randomly select a winner based on a value from 1 to 2658. (entries)
    If the randomly selected value was 1643 the winner would be Barbara as she has the entry values between 1428 and 1660.
    I appreciate your time, thank you.

    Chris (theRoof)
    Attached Files Attached Files

  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,780

    Re: Random draw from column with different values

    So only one random number will be generated and that number will determine the winner? In the opening post you said winners, so I’m still somewhat unsure - is it one or more?

  5. #5
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2016 & H&B2021
    Posts
    3,057

    Re: Random draw from column with different values

    Random number in C11=RANDBETWEEN(C2,C9)
    Winner =INDEX(A2:A9,MATCH(LOOKUP(C11,C2:C9),C2:C9,0)+IF(ISNUMBER(MATCH(C11,C2:C9,0)),0,1))

  6. #6
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,908

    Re: Random draw from column with different values

    Try this:

    =INDEX(A2:A9,MATCH(RANDBETWEEN(1,SUM(B2:B9))-1,SUMIF(OFFSET(B1,0,0,ROW(B1:B8),1),">=0")))

    Enter with Ctrl+Shift+Enter.

  7. #7
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2016 & H&B2021
    Posts
    3,057

    Re: Random draw from column with different values

    Quote Originally Posted by josephteh View Post
    random number in c11=randbetween(c2,c9)
    winner =index(a2:a9,match(lookup(c11,c2:c9),c2:c9,0)+if(isnumber(match(c11,c2:c9,0)),0,1))
    Formula for C11 should be =RANDBETWEEN(1,C9)

  8. #8
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,408

    Re: Random draw from column with different values

    Array formula

    HTML Code: 

  9. #9
    Registered User
    Join Date
    07-07-2021
    Location
    Melbourne Australia
    MS-Off Ver
    Excel for Mac v16.5
    Posts
    3

    Re: Random draw from column with different values

    Excellent, thank you so very much for your time.

  10. #10
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,408

    Re: Random draw from column with different values

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'

+ 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. [SOLVED] Auto Random for 5 seconds when pressing button draw
    By chaiyya345 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-15-2020, 10:46 PM
  2. Random Draw with constraints
    By Michael_B in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-22-2013, 07:32 PM
  3. Random Pairing for an NFL 51 Draw
    By sln2118 in forum Excel General
    Replies: 1
    Last Post: 08-10-2013, 09:22 PM
  4. Is there a Formula for Random Draw
    By RodeoBrat in forum Excel General
    Replies: 2
    Last Post: 08-02-2011, 07:58 AM
  5. Random Draw Question
    By Chadk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-07-2007, 05:50 AM
  6. Random Winner Draw Formula Help
    By koba in forum Excel General
    Replies: 1
    Last Post: 09-18-2006, 11:50 PM
  7. draw random from normal distribution
    By gatosonreyendo in forum Excel General
    Replies: 3
    Last Post: 12-12-2005, 12:10 AM

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