How to generate #'s that excludes certain numbers?

D

dojistar

Hi, I'd like to generate 4 different numbers from 1 to 50 but EXCLUDING
numbers 3 and 24. Your help is greatly appreciated!
 
V

vezerid

There are several ways. One way is to use two columns: In column K:K
(say starting from K2) you enter all the admissible numbers. Then, one
column before, type 0 in J2 and then in J3 type =J2+1/48 and copy all
the way to J49.

Then, to generate random numbers use:
=VLOOKUP(RAND(), $J$2:$K$49,2)
This will produce your numbers with equal probability.

Another, not so precise formula:
=IF(RAND()<2/48, 1+INT(RAND()*2), IF(RAND()<20/48, 4+INT(RAND()*20),
25+INT(RAND()*26)))

HTH
Kostis Vezerides
 
M

Max

.. I'd like to generate 4 different numbers from 1 to 50
but EXCLUDING numbers 3 and 24.

Another play to try ..

List the numbers 1 - 50 into A1:A48, skipping 3 and 24

Put in B1: =RAND()
Copy B1 down to B48

Put in C1: =INDEX(A:A,RANK(B1,$B$1:$B$48))
Copy C1 down to C4

C1:C4 will return what's required

Just press F9 to regenerate
 
Top