Random numbers from several ranges

C

ChrisSafety

How can I set up one formula to randomly give me a number from multiple
ranges? For example, I have 2 ranges. One is 105 though 128 and the other is
244 through 286. I need to randomly select one number from either range. I
have tried the =RANDBETWEEN function, but I can't get it to work for multiple
ranges. Please help! Thank You
Chris
 
J

John C

You could set up multiple randbetween statements with an IF statement.

If each range is weighted equally:

=IF(RANDBETWEEN(1,2)=1,RANDBETWEEN(105,128),RANDBETWEEN(244,286))

If each possibility in each range is weighted equally:

=IF(RANDBETWEEN(1,67)<25,RANDBETWEEN(105,128),RANDBETWEEN(244,286))
 
C

ChrisSafety

Thank you so much! It worked perfectly!

John C said:
You could set up multiple randbetween statements with an IF statement.

If each range is weighted equally:

=IF(RANDBETWEEN(1,2)=1,RANDBETWEEN(105,128),RANDBETWEEN(244,286))

If each possibility in each range is weighted equally:

=IF(RANDBETWEEN(1,67)<25,RANDBETWEEN(105,128),RANDBETWEEN(244,286))
 

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

Top