+ Reply to Thread
Results 1 to 3 of 3

Validating random numbers

  1. #1
    plsauditor
    Guest

    Validating random numbers

    I need to generate a list of 10 random numbers, between 3 and 78. These
    represent identification numbers of stores. However, some of those numbers
    are not valid (i.e., 13, 15, 20-49,55-57). I used "randbetween" to get the
    numbers between 3 and 78. I've tried various combinations of "IF" and "AND"
    to screen out the numbers I don't want. Anybody have a way to do this?

  2. #2
    Jason Morin
    Guest

    Re: Validating random numbers

    You could put all valid numbers in A1:A41 and use:

    =INDEX(A1:A41,RANDBETWEEN(1,41))

    Remember, RANDBETWEEN may return the same value more than
    once. To produce 10 *unique* random numbers within your
    given range is a little more complex.

    HTH
    Jason
    Atlanta, GA

    >-----Original Message-----
    >I need to generate a list of 10 random numbers, between

    3 and 78. These
    >represent identification numbers of stores. However,

    some of those numbers
    >are not valid (i.e., 13, 15, 20-49,55-57). I

    used "randbetween" to get the
    >numbers between 3 and 78. I've tried various

    combinations of "IF" and "AND"
    >to screen out the numbers I don't want. Anybody have a

    way to do this?
    >.
    >


  3. #3
    Max
    Guest

    Re: Validating random numbers

    Another option to try ..

    Assuming, as per Jason's response,
    the valid numbers are placed in A1:A41

    Put in B1: =RAND()
    Copy down to B41

    Put in C1:
    =INDEX(A:A,MATCH(SMALL(B:B,ROWS($A$1:A1)),B:B,0))

    Copy C1 down to C10

    This will return 10 random, non repeating numbers
    from the list in A1:A41

    (Or, just copy down to C41 to get the full lot randomly scrambled!)

    Tapping F9 will recalc and re-generate afresh

    Freeze the results elsewhere
    with a copy > paste special > values > OK
    --
    Rgds
    Max
    xl 97
    ---
    GMT+8, 1° 22' N 103° 45' E
    xdemechanik <at>yahoo<dot>com
    ----
    "plsauditor" <[email protected]> wrote in message
    news:[email protected]...
    > I need to generate a list of 10 random numbers, between 3 and 78. These
    > represent identification numbers of stores. However, some of those

    numbers
    > are not valid (i.e., 13, 15, 20-49,55-57). I used "randbetween" to get

    the
    > numbers between 3 and 78. I've tried various combinations of "IF" and

    "AND"
    > to screen out the numbers I don't want. Anybody have a way to do this?




+ 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