Random Selection based on Difficulty
Let's say you make *3 lists*, and label them "Hard", "Medium" and "Easy".
Let's put them in an out-of-the-way location on your WS, say columns X, Y,
and Z.
Label them as:
X1= Hard
Y1 = Medium
Z1 = Easy
Lets say you have 4 Hard dishes, entered in X2 to X5,
And 9 Medium dishes, entered in Y2 to Y10,
And finally 6 Easy dishes, from Z2 to Z7.
To keep the formulas a little shorter, lets name each range appropriately.
Select X2 to X5,
Click in the "Name Box" (left of the formula bar),
Type in "hard" (no quotes), and hit <Enter.
Do the same for the other 2 ranges, naming them, of course, medium and easy.
Now, in W1 enter this formula:
=Rand()
And drag down to copy as many rows as the maximum number of dishes, which in
this case is 9.
It really doesn't matter if you copy to *more* rows then necessary, just
*don't* copy to *less*!
NOW ... in A1, B1, and C1, again enter:
A1= Hard
B1 = Medium
C1 = Easy
Enter this formula in A2:
=INDEX(hard,RANK(W1,W1:INDEX(W:W,COUNTA(hard))))
Enter this in B2:
=INDEX(medium,RANK(W1,W1:INDEX(W:W,COUNTA(medium)) ))
And finally, enter this in C2:
=INDEX(easy,RANK(W1,W1:INDEX(W:W,COUNTA(easy))))
Now, every time you hit <F9, you'll get a random selection from each of
your lists in the appropriate column.
--
HTH,
RD
================================================== ===
Please keep all correspondence within the Group, so all may benefit!
================================================== ===
wrote in message
ups.com...
So, I have been playing around with =rand() and thought it would be
fun to create a menu for us for dinner since neither my wife nor I can
decide what to eat.
What I would like to do is have a list of items we can make:
A1:A25 items like pancakes (yes we eat them for dinner sometimes)
spagehtti, Enchiladas, Tacos, etc
Then in B1:B25 rate each easy, medium or hard
finally in a cell (it does not matter which one) have a pick list of
Easy, Medium, or Hard then have it randomly generate a selection from
the list based on difficulty.
Any ideas?
|