random number generation

  • Thread starter Thread starter nyn04
  • Start date Start date
N

nyn04

how would I generate a random number from a list of given numbers i
excel or better yet in vba, sy a I have a list of 1,2,3,4,5 and I wil
like it randomly pick a number

thnank
 
Hi!

You could use
=INT(RAND()*5)+1
or, if your version of Excel supports it,
=RANDBETWEEN(1,5)

Al
 
If you only want to generate a single number, or if you don't mind
duplicates, then the previous suggestions should work well. If you want
to randomly select more than one number with no duplicates, put 1:5 in
A1:A5, put =RAND() in B1:B5, then sort A1:B5 by B1:B5 and take however
many numbers you want starting from the resulting A1.

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top