+ Reply to Thread
Results 1 to 6 of 6

Using INDEX/RAND to fill cells with no duplicate values

  1. #1
    Forum Contributor
    Join Date
    06-18-2008
    Posts
    123

    Using INDEX/RAND to fill cells with no duplicate values

    Hi all.

    I’m hoping someone can help me with a problem I’m having.

    I have a sheet with a list of staff, and I want to randomly assign them duties. Using the following formula it’s easy enough to select staff for a certain task:

    Please Login or Register  to view this content.
    However, I want to make sure the person isn’t chosen more than once. So for example, if someone is picked for a certain duty, I don’t want the formula picking that person again and assigning them a second or third duty. I’ve attached an example sheet to explain it a bit better!

    Thanks in advance guys,

    Tony.
    Attached Files Attached Files

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Using INDEX/RAND to fill cells with no duplicate values

    Both Rand() or RandBetween() approach will produce duplicate


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Contributor
    Join Date
    06-18-2008
    Posts
    123

    Re: Using INDEX/RAND to fill cells with no duplicate values

    Thanks for the reply. Is there a way around it with VBA perhaps?

  4. #4
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520

    Re: Using INDEX/RAND to fill cells with no duplicate values

    One formulas play to deliver it ....
    a. Set up a formulated area to "clear" duplicates (if any) from the names listed under Task 2 and 3
    depending on the possible names assigned in D5 and E5

    For Task 2
    In M6: =IF(K6=D$5,"",ROWS($1:1))
    In N6: =IF(ROWS($1:1)>COUNT($M$6:$M$9),"",INDEX($K$6:$K$9,SMALL($M$6:$M$9,ROWS($1:1))))
    Copy M6:N6 down to N9

    For Task 3
    In O6: =IF(OR(L6=D$5,L6=E$5),"",ROWS($1:1))
    In P6: =IF(ROWS($1:1)>COUNT($O$6:$O$10),"",INDEX($L$6:$L$10,SMALL($O$6:$O$10,ROWS($1:1))))
    Copy O6:P6 down to P10

    b. Now you can use these to randomize it for the expected results
    In D5: =INDEX($J$6:$J$12,RANDBETWEEN(1,COUNTA($J$6:$J$12)))
    In E5: =INDEX($N$6:$N$9,RANDBETWEEN(1,COUNT($M$6:$M$9)))
    In F5: =INDEX($P$6:$P$10,RANDBETWEEN(1,COUNT($O$6:$O$10)))
    ----------------------------------
    Success? Wave it, click on the little star at the bottom left of my responses
    Last edited by Max, Singapore; 12-31-2013 at 11:30 PM.
    Max
    Singapore

  5. #5
    Forum Contributor
    Join Date
    06-18-2008
    Posts
    123

    Re: Using INDEX/RAND to fill cells with no duplicate values

    Max that's brilliant. Works perfectly, thanks a lot.

  6. #6
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520

    Re: Using INDEX/RAND to fill cells with no duplicate values

    welcome, glad to hear

+ 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. index match with duplicate values - how to get latest value
    By helpme10 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-29-2013, 02:13 PM
  2. [SOLVED] Index and match functions for duplicate values
    By JBERK in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 10-23-2012, 10:48 AM
  3. Index/Match where data has duplicate values
    By ragatha in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-06-2012, 12:09 PM
  4. Remove Duplicate Values in an Index Return?
    By phatmo111 in forum Excel General
    Replies: 2
    Last Post: 03-29-2011, 12:54 PM
  5. Excel, Match/Index when duplicate values?
    By Fizziii in forum Excel General
    Replies: 0
    Last Post: 01-18-2011, 02:12 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