VBA - random number between two numbers

Looking for a function or whatever that will give a random number between two numbers.

So, for example, if i enter, a 1 and a 10, it would return a random number between 1 and 10.
patriotpacerAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
zorvek (Kevin Jones)Connect With a Mentor ConsultantCommented:
Use this formula:

=INT(RAND()*(Max-Min+1)+Min)

Kevin
0
 
NorieVBA ExpertCommented:
There's also RANDBETWEEN.
0
 
zorvek (Kevin Jones)ConsultantCommented:
RANDBETWEEN requires the Analysis ToolPak Add-In in Excel 2003 and earlier which is not always desired.

Kevin
0
 
NorieVBA ExpertCommented:
Kevin

You're right, guess I'm kind of used to most people having Excel 2007 or later.
0
 
zorvek (Kevin Jones)ConsultantCommented:
We're getting there but there are still some old installations.

Kevin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.