Multiple Conditions for "=IF"

Ilerie

New Member
Joined
Feb 21, 2011
Messages
7
Hi, I'm trying to simulate a game in which one randomly pulls marbles from a jar.
In my first round, the jar contains 4 black marbles and 6 white marbles.
To simulate the game's outcome I used this function:
=IF(RANDBETWEEN(0,9)<4,"Black","White")
Now, in the second round I have a jar containing 1 yellow marble, 5 red marbles and 7 green ones. How can I format "=IF" for me to have Excel display "Yellow" 1/13 times, "Red" 5/13 and "Green" 6/13 like:

=IF(RANDBETWEEN(0,12)=0,"Yellow",0<RANDBETWEEN(0,12)<6,"Red",RANDBETWEEN(0,12)<5,"Green"

This function doesn't work.

Thanks,
Ilerie
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,223,911
Messages
6,175,334
Members
452,636
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top