ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Random Selection based on Difficulty (https://www.excelbanter.com/excel-discussion-misc-queries/142263-random-selection-based-difficulty.html)

[email protected]

Random Selection based on Difficulty
 
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?


JE McGimpsey

Random Selection based on Difficulty
 
Perhaps a different layout:

http://www.contextures.com/xlDataVal02.html

In article . com,
" wrote:

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?


RagDyeR

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?



[email protected]

Random Selection based on Difficulty
 
RagDyeR -

Thank you very much go it to work in Excel - however when I attempt to
put it in googlespreadsheets I get the following error:

#NAME? Unknown range name D1


D=W in your example

Anyway - thank you very much for the help!!



RagDyeR

Random Selection based on Difficulty
 
Sorry!
Don't know anything about Google spreadsheets to offer any advice.

Appreciate your feed-back.
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
wrote in message
oups.com...
RagDyeR -

Thank you very much go it to work in Excel - however when I attempt to
put it in googlespreadsheets I get the following error:

#NAME? Unknown range name D1


D=W in your example

Anyway - thank you very much for the help!!





All times are GMT +1. The time now is 07:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com