Sponsored Link

Sponsored Link

Friday, May 15, 2009

Rand and Randbetween function to generate random numbers

Rand and Randbetween is used to generate random numbers. It is very useful for people like me who post on blog. This help me in generating random data which I use in post on blog. Randbetween is available in MS Excel 2007 while RAND function is available in MS Excel 2007/2003/XP/2000. Randbetween function has an edge over Rand function as it can generate numbers between lower bound and upper bound and gives user a control to over generation of random numbers.

Rand() Function

Syntax: Rand()

RAND() function does not require any special formatting. However it returns number in decimal or in others words it returns you number between 0 to 1. Take a look at the image below with example of RAND() function.

Click on image  to view enlarge


Randbetween() function

Syntax: RANDBETWEEN(LOWER, UPPER)  is syntax for RANDBETWEEN() function in MS Excel 2007.

Like Rand() function, Randbetween() function does not require any special formatting. Take a look at image below to view example of Randbetween() function.

Click on image  to view enlarge


 Example: The example exhibits how to use RAND() function to generate numbers between fix range.

Click on image  to view enlarge


Mentioned below is RAND() function along with INT function and is equivalent to RANDBETWEEN function of Excel 2007. 

Formula: INT(RAND()*(b-a)+a)

here a= 100 and b=200


(200-100) returns 100 which when multiplied with RAND() return two digit number. Also, here it is treated as upper bound and lower bond. In other words, this function will return numbers between 100 and 200. You can try with different numbers.

RAND()*(200-100)+100 adds to 3 digit number which is greater than 100 but less than 200. Also, some decimal.

INT functions round off to lowest integral value.

If you are still in doubt using RAND() and RANDBETWEEN() function. I have kept the file with example for download

Random Number Example download

To receive more updates on MS Excel help. You can subsribe via email.

We assure you knowledge, not SPAM!


Post a Comment