+ Reply to Thread
Results 1 to 6 of 6

Random List Selection w/No Duplicates

  1. #1
    Registered User
    Join Date
    06-25-2007
    Posts
    20

    Random List Selection w/No Duplicates

    I need to fill 5 cells with random selections from a named range (rgnItems) without any of the 5 cells containing duplicate values from the others.

    Is this possible with an Excel function?

    Right now I have a formula in each of the 5 cells that randomly selects a value from rgnItems, but of course I am getting duplicates sometimes across my 5 cells.
    Last edited by VBA Noob; 12-10-2007 at 02:24 PM.

  2. #2
    Forum Contributor
    Join Date
    10-14-2004
    Location
    San Diego, CA
    Posts
    213
    Hello RDSProgrammer:

    In cell A1 enter the RAND() function and copy down as far as needed, column B is your list of values. Paste this formula in cell D1 and copy down to row 5.

    Please Login or Register  to view this content.

    Matt

  3. #3
    Registered User
    Join Date
    06-25-2007
    Posts
    20

    Smile

    That worked--but, I have a question regarding this technique.

    It seems as though I need to include a rand() value in a cell for each cell in rgnItems. However, our users will be adding entries to rgnItems themselves.

    Is there a way so that the users won't have to also add the rand() function to the cell in the column next to the entry that they add? I don't think that they will understand or reliably do this. Also, we can't use VBA for any of this in our situation.
    Last edited by RDSProgrammer; 12-10-2007 at 03:34 PM.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Create an out-of-the-way range, starting in, say, Z1. It can be on the same sheet (and you can hide it) or a different sheet. Then in Z1 (or wherever it starts), enter and copy down =RAND() for enough cells to always exceed the rows in rgnItems.

    Then define rgnRand Refers to: =OFFSET($Z$1, 0, 0, ROWS(rgnItems))

    Then use this adaptation of Flintstone's formula in the same rows as rgnItems:

    =INDEX(rgnItems, MATCH(SMALL(rgnRand, ROW() - ROW(rgnItems) + 1), rgnRand, 0 ))
    Last edited by shg; 12-10-2007 at 04:24 PM.

  5. #5
    Forum Contributor
    Join Date
    10-14-2004
    Location
    San Diego, CA
    Posts
    213
    Replace the RAND() functions with this formula, should do it.

    Please Login or Register  to view this content.

    Matt

  6. #6
    Registered User
    Join Date
    06-25-2007
    Posts
    20

    Smile

    That did the trick.

    I used an IF formula around the rand() function and everything works like a charm.

    Thanks to all.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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