+ Reply to Thread
Results 1 to 9 of 9

Random Numbers With No Duplicates

  1. #1
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    Random Numbers With No Duplicates

    I want to set up a column of numbers that will be random without any repeating numbers.

    Example: If I set up for 1,000 rows, I would like the random numbers to be 1 to 1,000, but the catch would be to have no duplicates in the column.

    It has been several years since I worked with Excel and I am sure this can be done with a macro, but I am not sure how to go about it right now.
    Last edited by DCSwearingen; 01-30-2010 at 02:38 PM.
    Thanks!
    Dennis

    I am using Windows 7 and Office 2007, all of my posts are based on this.

  2. #2
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Random Numbers With No Duplicates

    Would it be fair to say you want specified (not random) numbers in a random order?

    If not, perhaps you could upload an example, showing what you're looking for, if so:
    You could put the numbers 1 to 1000 in a column, then =rand() copied down alongside, then select the top rand() and click sort. Every sort will recalculate the rand()s and reorder the 1-1000

    hth

  3. #3
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    Re: Random Numbers With No Duplicates

    Quote Originally Posted by Cheeky Charlie View Post
    Would it be fair to say you want specified (not random) numbers in a random order?

    If not, perhaps you could upload an example, showing what you're looking for, if so:
    You could put the numbers 1 to 1000 in a column, then =rand() copied down alongside, then select the top rand() and click sort. Every sort will recalculate the rand()s and reorder the 1-1000

    hth
    You phrased it much better that I did.

    I want a list of specified numbers to be in a random order.

    Thank you for helping me to clarify.

  4. #4
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    Re: Random Numbers With No Duplicates

    Dennis, just as an aside, I noticed that your signature says you're using Excel XP Professional, but that's not really a version of Excel. It's probably either 2003 or 2007. I would recommend updating your profile to show which. As you've probably already found out, though, Charlie's solution works on either.

  5. #5
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    Re: Random Numbers With No Duplicates

    The solution I used was to put my numbers in Column A, put a Rand() function in Col B, and then put a rank function in Col C.

    Col B Formula:
    Please Login or Register  to view this content.
    Col C Formula
    Please Login or Register  to view this content.
    And then copy formulas cells B1 & C1 down as far as cells in Col A have a value.

    This works fine if the list of numbers is from 1 to n...

  6. #6
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Random Numbers With No Duplicates

    What an interesting variation, whatever flicks your switches, but if you just had two columns as I described, you could specify non-consecutive-integer values in column a and still randomly order them - a more generic solution (with fewer formulae)

    CC

  7. #7
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    Re: Random Numbers With No Duplicates

    Quote Originally Posted by Cheeky Charlie View Post
    What an interesting variation, whatever flicks your switches, but if you just had two columns as I described, you could specify non-consecutive-integer values in column a and still randomly order them - a more generic solution (with fewer formulae)
    CC
    I already discoverd that if I later decided to have more, or non-sequential numbers, I would need to use your solution.

    Thanks for the help.

  8. #8
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Random Numbers With No Duplicates

    0.1, 0.2, 0.3, 0.4
    =
    sequential
    =/=
    consecutive integers
    ?

  9. #9
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Random Numbers With No Duplicates

    They need not be numbers at all. It can be a list of cities, people, towns with only one vowel, ...

    It's just a way to randomly order things, Dennis.
    Entia non sunt multiplicanda sine necessitate

+ 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