Saturday 10 October 2015

Random Numbers

Ms excel provides a very easy way in which you can generate random numbers. There are two formulas which can be used. 

1. RAND 

This formula generates a random number between 0 and 1. 



As you can see above, the formula is very easy to use. All you need to do is to select the formula and press enter, and it will give you a random number. 




It might not sound very useful, but if you consider that it can generate the random number to as many as 15 decimal places, it can help you in generating as many random numbers you want. To increase and decrease the decimal places, simply click on these two: 



2. RANDBETWEEN 

 This formula generates a random number between 2 specific numbers. 


=RANDBETWEEN(bottom,top) 

The above is what you get when you select the formula. 

So if you want a random number between 1 to 10, then you input the formula as: =RANDBETWEEN(1,10) 




Note that both the numbers are inclusive. 

Also you will only get whole numbers as shown in the example above. If there is a way to get it in decimals, I am yet to find out how. 

I find RANDBETWEEN much more useful than the RAND formula since if I want to select a particular random item from a numbered list than I just have to choose the bottom and top numbers and generate the random item, as opposed to using the RAND function and getting values that are way out of range. However, the RAND function becomes very useful when you want to sort a list randomly. If you don't yet know how, you can always experiment, but I will post a detailed example of this in the future. 

 One very important thing to note about these two formulas is that the values will keep on changing every time you make a change in the workbook or even if you just close it and open it again. So how do you make sure you that after you get your random value, you keep that value and have proof that you used random numbers to generate it and not just kept a number that came to your mind? Since I want to keep my posts small and simple, I will show you an example of how to do this after a couple of other posts which shows how to use some other excel features which you will need to know to accomplish the above. 

Posts you can expect in future (you are only able to see this because I have not posted them yet):
  •  Using the RAND function to randomly sort lists. 
  • Documenting that you have actually used the random numbers formula to pick out the random item.
 If you have any question or comment, just drop it below and I will get back to you as soon as I can.

No comments:

Post a Comment