Unformatted text preview: If you want to “Flip a coin” in Excel, you can use the random formula combined with an “IF” function. In Excel, the IF function is: IF(statement evaluation, if true, if false). For example: IF(A3=1,”YES”,”NO”) would evaluate the contents of cell A3, If A3=1, then the cell containing the IF function would be equal to “YES”. For example, let’s say that we wanted to do a coin flip to determine if we should go left or right. To do a coin flip, we want a random number between .1 and 1. If the number is >0.5, we would go left; otherwise we would go right. You would enter in Excel: =IF(((RAND()*0.9)+0.1)>0.5,”Left”,”Right”) where: (RAND()*0.9)+0.1) will give a random number between 0.1 and 1.0 and the expression ((RAND()*0.9)+0.1)>0.5) will test to see if the random number is greater than 0.5 (See the formula in D24)...
View Full Document
This note was uploaded on 09/08/2010 for the course BIOL 160 at San Jose State.