Using Excel to generate a random number

Office365 / SharePoint Blog

o365-excelComputers are great at randomization, and if I need to randomly select something, I use Excel to help. Excel has a very handy formula called RANDBETWEEN.

The way to use it: type

=RANDBETWEEN(bottom, top)

bottom
The smallest integer value that the function will return.

top
The largest integer value that the function will return.

NOTE: If bottom is a greater than top, the RANDBETWEEN function will return #NUM! error.

You can compare 2 cells using

=RANDBETWEEN(cell1, cell2)
e.g. =RANDBETWEEN(B2, B3)
Result: a random number between the number in B2 and the number in B3

Or by using actual numbers, like
=RANDBETWEEN(1,22)
Result: a random number (between 1 and 22)

=RANDBETWEEN(100,200)
Result: random number   (between 100 and 200)

=RANDBETWEEN(200,100)
Result: #NUM!           (because bottom is greater than top)

And yes, it will return the lowest number as well as the largest number in the range.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s