# Solved – with Excel, generate 0 with n% probability OR generate 1 with (1-n)% probability

(first of all I simplified my question)

Depending on the input info below, I want to create proper excel function in output part.

What I require verbally in output part under "status (0 or 1) column" is

Depending on the value of "accumulated age", generate 0 (zero) with corresponding probability in input part, else generate 1 (one) with (1-corresponding) probability.

For example, for the time being, since value under accumulated age is 1 (one), 0 (zero) should be generated with 5% probability OR 1 should be generated with 95% probability.

I checked up on excel statistic functions, I searched in google but I couldn't find my answer.

input info

`accumulated      Prob. of Status = 0 age  1                       5% 2                       12% 3                       22% 4                       25% 5                       28% 6                       7% 6+                      1% `

output part

`accumulated age         status (0 or 1)        1                       ?   `

regards

Contents

You can make Excel draw a number from a standard uniform distribution and return a 1 when that value if less than the probability you are lookig for and 0 otherwise. The exact commands depend on the language used by Excel. In the German version it is: `=WENN(ZUFALLSZAHL() <A1;1;0)`