+ Reply to Thread
Results 1 to 12 of 12

Generate Random Numbers Between 0-9

Hybrid View

  1. #1
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Generate Random Numbers Between 0-9

    Hi,

    Probably the easiest way is to list your numbers 0-9 in one column and alongside each of them in another column put the formula:

    =RANDBETWEEN(0,9)
    Now just sort the two columns using the random number as the key.

    You could achieve the same sort of thing with a macro if you didn't want to see the 'workings'

    HTH
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Generate Random Numbers Between 0-9

    I would use RAND rather than RANDBETWEEN in the sort key column.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Generate Random Numbers Between 0-9

    dreicer_Jarr,

    FYI

    Richard forget to mention you need to install the Analysis ToolPak add-in before you can use Randbewteen.

    Edit

    Unless you have xl07

    VBA Noob
    Last edited by VBA Noob; 02-01-2009 at 03:55 PM.
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,911

    Re: Generate Random Numbers Between 0-9

    I presume this is related to something called "The Superbowl", whatever that is.......

    This is one way to achieve what you want without helper cells.....

    In A1

    =INT(RAND()*10)

    in A2

    =SMALL(IF(ISNA(MATCH({0,1,2,3,4,5,6,7,8,9},A$1:A1,0)),{0,1,2,3,4,5,6,7,8,9}),INT(RAND()*(10-ROWS(A$2:A2))+1))

    confirmed with CTRL+SHIFT+ENTER and copied down to A10

  5. #5
    Registered User
    Join Date
    11-29-2012
    Location
    Arizona
    MS-Off Ver
    Excel 2011
    Posts
    3

    Re: Generate Random Numbers Between 0-9

    Quote Originally Posted by daddylonglegs View Post
    I presume this is related to something called "The Superbowl", whatever that is.......

    This is one way to achieve what you want without helper cells.....

    In A1

    =INT(RAND()*10)

    in A2

    =SMALL(IF(ISNA(MATCH({0,1,2,3,4,5,6,7,8,9},A$1:A1,0)),{0,1,2,3,4,5,6,7,8,9}),INT(RAND()*(10-ROWS(A$2:A2))+1))

    confirmed with CTRL+SHIFT+ENTER and copied down to A10
    I was able to use this formula for the rows going down the side, but when I tried to change it for the columns going across the top, numbers kept repeating. Any suggestions?

+ 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