+ Reply to Thread
Results 1 to 6 of 6

Randomly selected numbers

  1. #1
    Keith Robinson
    Guest

    Randomly selected numbers

    Hi
    How can I randomly select six different numbers at any one time i.e lottery
    numbers. I have tried using the formula
    =INT(RAND()*49)+1, which works OK but I get repeated numbers, can anyone
    help?
    Keith




  2. #2
    Jim Cone
    Guest

    Re: Randomly selected numbers

    Keith,

    Here is what I use for the California lottery to
    pick 5 non duplicate numbers from 47 possible...

    '-------------------------------------------
    Dim i As Long
    Dim j As Long
    Dim ArrTwo(1 To 47) As Long
    Dim ArrOne(1 To 5, 1 To 1) As Long

    Do While j < 6
    Randomize (Right(Timer, 2) * j)
    'Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
    i = Int(Rnd * 47 + 1)
    If ArrTwo(i) <> 99 Then
    ArrOne(j, 1) = i
    ArrTwo(i) = 99
    j = j + 1
    End If
    Loop
    '-------------------------------------------

    Regards,
    Jim Cone
    San Francisco, USA


    "Keith Robinson" <[email protected]> wrote in
    message news:[email protected]...
    > Hi
    > How can I randomly select six different numbers at any one time i.e lottery
    > numbers. I have tried using the formula
    > =INT(RAND()*49)+1, which works OK but I get repeated numbers, can anyone
    > help?
    > Keith
    >
    >
    >


  3. #3
    Guest

    Re: Randomly selected numbers

    Hi

    The usual way to do this is to fill down 49 cells with the numbers 1 - 49
    and then in the next column fill down
    =RAND()
    and then sort on the second column. You can then select the top 6 numbers.
    Each time you sort on the column, the RAND will refresh and give you a
    different list.

    --
    Andy.


    "Keith Robinson" <[email protected]> wrote in message
    news:[email protected]...
    > Hi
    > How can I randomly select six different numbers at any one time i.e
    > lottery
    > numbers. I have tried using the formula
    > =INT(RAND()*49)+1, which works OK but I get repeated numbers, can anyone
    > help?
    > Keith
    >
    >
    >




  4. #4
    RagDyeR
    Guest

    Re: Randomly selected numbers

    Since you say this is for a lottery, I guess you'll be using it quite often.

    This procedure will allow you to display a new set of numbers each time you
    hit the <F9> key.

    First, you have to enter the RAND() function in a column, and then refer to
    that column with a formula.

    Say you use Column Z.
    Enter
    =RAND()
    in Z1, and copy down to Z49.

    Then, place this formula anywhere, and copy it down as many rows as you wish
    to display your random numbers:

    =INDEX(ROW(A1:A49),RANK(Z1,Z1:Z49),Z1:Z49)

    Now, every time you hit the <F9> (calculate) key, you'll get a new random
    display.

    --

    HTH,

    RD
    ==============================================
    Please keep all correspondence within the Group, so all may benefit!
    ==============================================


    "Keith Robinson" <[email protected]> wrote in message
    news:[email protected]...
    Hi
    How can I randomly select six different numbers at any one time i.e lottery
    numbers. I have tried using the formula
    =INT(RAND()*49)+1, which works OK but I get repeated numbers, can anyone
    help?
    Keith





  5. #5
    RagDyeR
    Guest

    Re: Randomly selected numbers

    It will really work better if all the numbers are included when you copy
    down the formula.

    Forgot to anchor the references with absolutes.

    Use this:

    =INDEX(ROW($A$1:$A$49),RANK(Z1,$Z$1:$Z$49),$Z$1:$Z$49)
    --

    Regards,

    RD
    --------------------------------------------------------------------
    Please keep all correspondence within the Group, so all may benefit !
    --------------------------------------------------------------------


    "RagDyeR" <[email protected]> wrote in message
    news:[email protected]...
    Since you say this is for a lottery, I guess you'll be using it quite often.

    This procedure will allow you to display a new set of numbers each time you
    hit the <F9> key.

    First, you have to enter the RAND() function in a column, and then refer to
    that column with a formula.

    Say you use Column Z.
    Enter
    =RAND()
    in Z1, and copy down to Z49.

    Then, place this formula anywhere, and copy it down as many rows as you wish
    to display your random numbers:

    =INDEX(ROW(A1:A49),RANK(Z1,Z1:Z49),Z1:Z49)

    Now, every time you hit the <F9> (calculate) key, you'll get a new random
    display.

    --

    HTH,

    RD
    ==============================================
    Please keep all correspondence within the Group, so all may benefit!
    ==============================================


    "Keith Robinson" <[email protected]> wrote in message
    news:[email protected]...
    Hi
    How can I randomly select six different numbers at any one time i.e lottery
    numbers. I have tried using the formula
    =INT(RAND()*49)+1, which works OK but I get repeated numbers, can anyone
    help?
    Keith






  6. #6
    JE McGimpsey
    Guest

    Re: Randomly selected numbers

    Take a look here:

    http://www.mcgimpsey.com/excel/randint.html

    Usage:

    Select 6 cells and array-enter:

    =RandInt(1,49)



    In article <[email protected]>,
    "Keith Robinson" <[email protected]> wrote:

    > How can I randomly select six different numbers at any one time i.e lottery
    > numbers. I have tried using the formula
    > =INT(RAND()*49)+1, which works OK but I get repeated numbers, can anyone
    > help?


+ 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