+ Reply to Thread
Results 1 to 12 of 12

Randbetween - not to repeat or duplicate

  1. #1
    Forum Contributor
    Join Date
    02-18-2013
    Location
    canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Randbetween - not to repeat or duplicate

    a1=RANDBETWEEN(1,3)
    a2=IF(A1=1,RANDBETWEEN(2,3),IF(A1=3,RANDBETWEEN(1,2),CHOOSE(RANDBETWEEN(1,2),1,3)))
    a3=6-SUM(A1:A2)

    the formula above will create random numbers between 1 and 3 but the numbers will not repeat. I would like to increase the numbers into 7 random numbers (from 1 to 7) but no repeating. Please help. Thank you.

    example:
    a1 = 3
    a2 = 1
    a3 = 5
    a4 = 2
    a5 = 4
    a6 = 7
    a7 = 6

    if I click on refresh, numbers will change randomly but not repeating.

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Randbetween - not to repeat or duplicate

    Try like this

    Fill A1:A7 with =RAND()
    Then in B1 and filled down to B7 put
    =RANK(A1,A$1:A$7)

  3. #3
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Randbetween - not to repeat or duplicate

    In cells A1 insert this formula, and drag down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In cells B1 insert this formula, and drag down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    You will have a unique list of 7 numbers in column B.
    Please click the * icon below if I have helped.

  4. #4
    Forum Contributor
    Join Date
    02-18-2013
    Location
    canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Re: Randbetween - not to repeat or duplicate

    Jonmo1 - IT WORKS PERFECTLY!!!!! i understand the RAND part but can you please explained the RANK and why it is not repeating (if possible in plain english). Thank you

  5. #5
    Forum Contributor
    Join Date
    02-18-2013
    Location
    canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Re: Randbetween - not to repeat or duplicate

    does RANK only work in ROW because I tried to do it in COLUMN and it does not work?

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Randbetween - not to repeat or duplicate

    Rank simply ranking the 7 results of each Rand.
    and Rand is EXTREMELY unlikely to produce a duplicate...and I mean EXTREMELY.
    So if all 7 rand's are different numbers, then they have a rank, one is the largest #, another is the 2nd largest..etc..

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Randbetween - not to repeat or duplicate

    The example posted IS working on a Column...
    A1:A7 = column
    A1:G1 = row..


    Now, if you wanted it to work accross a row, just adjust the refereces, and put th $ next to column letters instead of Row#s.

  8. #8
    Registered User
    Join Date
    10-28-2013
    Location
    NY NY
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Randbetween - not to repeat or duplicate

    I have 126 individuals that I must randomly rank.
    I out them into a spread sheet and tried everything to rank them randomly without duplicates from 1-126.
    Nothing is working. Help:

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Randbetween - not to repeat or duplicate

    Jasonjroberts,

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  10. #10
    Forum Contributor
    Join Date
    07-02-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    197

    Re: Randbetween - not to repeat or duplicate

    Quote Originally Posted by Jasonjroberts View Post
    I have 126 individuals that I must randomly rank.
    I out them into a spread sheet and tried everything to rank them randomly without duplicates from 1-126.
    Nothing is working. Help
    Hi, Jasonjroberts
    Here is a formula I found in the book "Excel Gurus Gone Wild" and was originally created by the alias PGC01.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    11-11-2014
    Location
    Switzerland
    MS-Off Ver
    2013
    Posts
    1

    Re: Randbetween - not to repeat or duplicate

    To all who provided an answer.... GREAT, you solved my problems too
    Edwin

  12. #12
    Registered User
    Join Date
    06-24-2013
    Location
    Camas, Washington
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Randbetween - not to repeat or duplicate

    One thing, your list does random order, however, the last value on the list is always the largest number. If the highest number is 7 then 7 is last on the list. If 125 is the highest number then 125 is the last on the list. I have tried this across multiple columns and get this result every time.

    Anyway to change that?

+ 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