+ Reply to Thread
Results 1 to 4 of 4

Random choice from a list without duplicates

  1. #1
    Registered User
    Join Date
    11-14-2010
    Location
    tel aviv, israel
    MS-Off Ver
    excel 2011
    Posts
    2

    Question Random choice from a list without duplicates

    i need help to create a formula that will randomly select from a preset list but take care not to create duplicates unless all the items in said list have appeared at least once.

    I am hoping that somebody can advise me so that I don't have to spend all the time figuring out the best way to do it myself.

    Any help would be very much appreciated

  2. #2
    Registered User
    Join Date
    11-14-2010
    Location
    tel aviv, israel
    MS-Off Ver
    excel 2011
    Posts
    2

    Re: Random choice from a list without duplicates

    This is my set of data that i need to work with:
    Ideally i would like to compose a short list of x(1-12) cells that are randomly selected from this data set, that do not repeat unless all options have previously appeared, and if possible (not necessary) for any item that has the same number in it, not to appear in adjacent cells.


    1 A1 B1 C1
    2 A2 B2 C2
    3 A3 B3 C3
    4 A4 B4 C4
    5 A5 B5 C5
    6 A6 B6 C6
    7 A7 B7 C7
    8 A8 B8 C8
    9 A9 B9 C9
    10 A10 B10
    11 A11 B11
    12 A12 B12
    13 A13 B13
    14 A14 B14
    15 A15 B15
    16 A16 B16
    17 A17 B17
    18 A18 B18
    19 A19 B19
    20 A20 B20
    21 A21 B21
    22 A22 B22
    23 A23 B23
    24 A24 B24
    25 A25 B25

  3. #3
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Random choice from a list without duplicates

    you can use the idea given in this webpage

    http://www.mrexcel.com/archive/Formulas/9254.html

    1.suppose A1 has entry"preset list"
    2. A2 to A14 has preset list of numbers of texts
    3. in B1 type some heading "randome1"
    4. highlight B2 t B14 and type
    =rand()
    and hit control+shift +enter
    5.C1 has some other heading "rndom2"
    6.in C2 type this formula
    =RANK(A2,$A$2:$A$14)
    copy C2 down upto C14
    7. in D1 enter "selected list"
    8.in D2 type the formula
    =INDEX($A$2:$A$14,C2,1)
    9. suppose you want a subset e.g. list of only nine items
    then copy D2 to D3 to D10
    10. As random function is volatile this list may change
    so highlight D2 to D10 hit control+C and
    select D2 click edit-pastespcial-values.(click ok)

    I am attaching sample file column D kept as it is without operating instruction no. 10 above.
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Random choice from a list without duplicates

    Quote Originally Posted by jbeaucaire View Post
    This can be done by macro or by formula. This page shows examples/techniques of both. (example files demonstrate each method)
    Randomization - macro or formula
    ===========

    Be sure to read through the Forum Rules so you can use and follow them effectively. For instance, cross-posting the same question on multiple forums requires you to provide LINKS to the other threads so possible answerers can see what's been done already on all sites.

    http://www.mrexcel.com/forum/showthread.php?t=508794
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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