Random numbers

  • Thread starter Thread starter ed
  • Start date Start date
E

ed

is there any way of only generating whole numbers within a
certain range with the rnd function
 
Ed,

Install the Analysis Toolpack add-in
Tools -> Add-ins and check off the "Analysis Toolpack".
You might need your install discs depending on your installation.

Once complete you can use the RANDBETWEEN worksheet
function, which does exactly what your asking for.

Dan E
 
=Trunc(rand()*100+1)
drag fill down for as many cells as you need numbers.

will generate whole numbers (not unique) between 1 and 100 inclusive.
 
-----Original Message-----
is there any way of only generating whole numbers within a
certain range with the rnd function
.
Let's say the range is 5 to 20

the formula would be
=round(5+(rand()*15),0)
copied over the range required.
 
This formula will generate whole numbers between 5 and 20 inclusive, but
both 5 and 20 have half the probability of occurring as the numbers 6 to 19
inclusive.

=Trunc(rand()*15+5)

will fix this.
 
Back
Top