Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Mar 2004
    Location
    London, Gtr London, England
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Fake Data from Rand() (WinXP XL2002)

    in order to test a workbook which deals with students exam results, I want to create a column of many percent scores. Can Rand() be used to create a large number of 'fake' results, being two digit intergers (1 to 99)? Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Fake Data from Rand() (WinXP XL2002)

    You can use
    <code>
    =INT(99*RAND()+1)
    </code>
    Keep in mind that the values will be recalculated each time the sheet is recalculated, unless you turn off automatic recalculation, or replace the formulas with their values.

  3. #3
    3 Star Lounger
    Join Date
    Mar 2004
    Location
    London, Gtr London, England
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Fake Data from Rand() Thanks Hans

    Hans
    Thanks for a super-quick answer!

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Fake Data from Rand() (WinXP XL2002)

    If you have the analysis toolpack that comes with Excel installed, you can insert the formula below in a cell and copy it wherever it is needed:

    <code>
    =RANDBETWEEN(1,99)
    </code>

    If you don't want to install the analysis toolpack, you can use:

    <code>
    =INT(RAND()*(99-1)+1)
    </code>
    Legare Coleman

  5. #5
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: Fake Data from Rand() (WinXP XL2002)

    <img src=/S/hello.gif border=0 alt=hello width=25 height=29> Frank

    Sure!

    Try this and see if you like it:

    =(RAND()*(99-1)+1)/100. Make the cell format that you have this formula in as 0% and you should be up and running. tailor to your needs in terms of how many digits after the decimal point, or any errors that you may want to exclude.

    My question to you, why only 99 <img src=/S/duck.gif border=0 alt=duck width=23 height=23>? You do not give A+ <img src=/S/clever.gif border=0 alt=clever width=15 height=15>

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  6. #6
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Fake Data from Rand() (WinXP XL2002)

    One function you may want to look at: RANDBETWEEN(). With this, you can set a low number and a high number...1 and 99. You can then format the individual cells so the result appears the way you like.

    To use the function RAND, you could try this: <font color=blue> =ROUND(RAND()*100),0). </font color=blue>
    - Ricky

  7. #7
    3 Star Lounger
    Join Date
    Mar 2004
    Location
    London, Gtr London, England
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Fake Data from Rand() (WinXP XL2002)

    Thanks to Legare and Wassim as well - all workable methods.

    Wassim - This is dummy data for testing, in real life, a student with 100% would get an A++ because the next column contains =IF(R1>89,"A++",IF(R1>79,"A+", IF(R1>69,"A",IF(R1>59,"D","F")))) Where R1 is the range containing the percentage . It was in order to test this formula that I needed the dummy data, our students are marked in sets of usually five percent stages, so a poor student may get either 35% or 40% or 45% and be given a letter grade accordingly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •