RANDBETWEEN
What Does It Do ?
This function produces a random whole number between two specified numbers.
The random number will change each time the spreadsheet is recalculated or F9 is pressed.
Syntax
=RANDOMBETWEEN(LowLimit,HighLimit)
Formatting
No special formatting is needed.
Low | High | Random | |||
5 | 10 | 6 | =RANDBETWEEN(C4,D4) | ||
1 | 49 | 26 | =RANDBETWEEN(C5,D5) |
Example:
The following table shows how the =RANDBETWEEN() has been used to generate six numbers to use for the National Lottery. Note that the function does not check to ensure all numbers are unique, the same number could be generated twice or more.
Lottery Numbers | The Winning Ticket! | ||
1 | 49 | 40 | =RANDBETWEEN ($C$24,$D$24) |
34 | =RANDBETWEEN ($C$24,$D$24) | ||
Press function Key | 49 | =RANDBETWEEN ($C$24,$D$24) | |
F9 to recalculate. | 35 | =RANDBETWEEN ($C$24,$D$24) | |
8 | =RANDBETWEEN ($C$24,$D$24) | ||
8 | =RANDBETWEEN ($C$24,$D$24) | ||
32 | =RANDBETWEEN ($C$24,$D$24) |
Duplicates! Spin again |
{=IF(SUM(1/COUNTIF(E24:E30,E24:E30))<>7,”Duplicates! Spin again”,”All OK”)} This formula is used to determine whether all the numbers are different. It is entered as an array using Ctrl+Shift+Enter.