Generate random number from 1-100 inclusive?

R

Ricter

= Round(Rnd() * 100, 0)

The above code is generating random numbers from 0-100. How can I alter it
to generate only 1-100?
 
K

KARL DEWEY

Try multiple use of the function like this --
= IIf(Round(Rnd()*100,0)=0,Round(Rnd()*100,0),Round(Rnd()*100,0))

The odds of both instances comming up zero at the same time is kinda high.
 
R

Ricter

THAT was the trick, thank you. I used to know this, back in the '70s,
programming games in BASIC, lol.
 

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