RANDBETWEEN(bottom, top)

Returns the random number between two specified numbers (inclusive).

bottomThe smallest integer that will be returned.
topThe largest integer that will be returned.

Remarks

* Both the values for "bottom" and "top" are inclusive.
* You can use the RAND function to return a random number >=0 and <1.
* In Excel 2003 this function was only available when you had the Analysis ToolPak add-in loaded.
* For the Microsoft documentation refer to support.office.com

 A
1=RANDBETWEEN(1,4) = 4
2=RANDBETWEEN(1,10) = 6
3=RANDBETWEEN(-10,10) = -1
4=RANDBETWEEN(1,40) = 5
5=ROUND(RAND()*(40-1)+1,0) = 22
6=RANDBETWEEN("some text",40) = #VALUE!
7=RANDBETWEEN(1,"some text") = #VALUE!

1 - This returns a random number between 1 and 4.
2 - This returns a random number between 1 and 10.
3 - This returns a random number between -10 and 10.
4 - This returns a random number between 1 and 40.
5 - This returns a random number between 1 and 40 by using the RAND function.

© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited Top