How to generate RANDOM number in Excel 2013

Excel provides excellent functions to generate random numbers. RANDBETWEEN and RAND are two primary functions used to generate random numbers.
Using RANDBETWEEN Function:
This function returns random whole number between the given range.
Syntax:        =RANDBETWEEN(lower end of range, higher end of range)  OR
                    =RANDBETWEEN(bottom, top)
For example, to obtain a random number between 25 and 150 we enter as below:
=RANDBETWEEN(25, 150)

Using RAND Function:
This function returns a random decimal number between 0 and 1. Hence, (0,1) is the default range for the function.
Syntax:          =RAND()
To generate a random real number between a and b, you can use following formula:
=RAND()*(b-a)+a
For example, to generate real number between 25 and 150, use the formula below:
=RAND()*125+25     {the first part will give number between 0 to 125 which will then get added to 25}

IMPORTANT NOTES:
  • The number generated by these functions will change each time we refresh the sheet or on pressing F9 button. To use these functions effectively, it should be combined with other functions like CHOOSE.
  • If you want to use these functions to generate a random number but don't want the numbers to change every time the cell is calculated, you can enter =RAND()  or =RANDBETWEEN(a,b) in the formula bar, and then press F9 to change the formula to a permanent random number.

No comments:

Post a Comment