+ Reply to Thread
Results 1 to 7 of 7

Hey, every genius, How to avoid duplicate items in random selection from data?

  1. #1
    Registered User
    Join Date
    03-21-2013
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    6

    Hey, every genius, How to avoid duplicate items in random selection from data?

    Hey, every genius, please help me~
    Range("_Data") is my data, I need to select randomly from it without duplicated items.
    But my syntax seems doesn't work, how can I do it?
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 03-23-2013 at 02:34 PM. Reason: Added Code Tags

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

    Re: Hey, every genius, How to avoid duplicate items in random selection from data?

    Assuming "_Data" has duplicates in the range.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-21-2013
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Hey, every genius, How to avoid duplicate items in random selection from data?

    Thanks very much, so normally we must do it by using "Scripting.Dictionary", right?
    Could we just use simple For Next or Do Loop to do it?

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

    Re: Hey, every genius, How to avoid duplicate items in random selection from data?

    It's fully depends on your data set and what you want.

    Don't want to do a guess job.

  5. #5
    Registered User
    Join Date
    03-21-2013
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Hey, every genius, How to avoid duplicate items in random selection from data?

    OK, I got it, sorry for such a newbird question.
    Actually In my data [_Data], there is no duplicate items, I just want that no duplicate items in my random selection. Because if I only use Application.WorksheetFunction.RandBetween(1, datarng.Rows.Count), it's happens sometimes there are duplicate items in my random selection.

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

    Re: Hey, every genius, How to avoid duplicate items in random selection from data?

    If not dups, this should do.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-21-2013
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Hey, every genius, How to avoid duplicate items in random selection from data?

    Ok, thanks very much again, it seems more complicated if we don't use "Scripting.Dictionary",
    so, It's better use to "Scripting.Dictionary", no matter whether there is duplicate items in data range, we can randomly select items without duplicates.

+ 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