# Excel – Random Numbers – and If statement

microsoft-excel-2007

In "A", rows 1-1000, I generate random numbers using RAND(). I want to pick numbers between say 1-100.

In "B" for 1000 rows I have =RAND()*(100-1)+1

In "C" for 1000 rows I use the numbers that I generated in "A", so =A1*(100-1)+1

The averages in B and C are the same, as expected.

I only want to use the values for 20% of the time, so for each of the 1000 rows:

For B, I use =IF(A1<0.2,B1,0)
For C, I use =IF(A1<0.2,C1,0)

If I do this, the averages for each of the two columns are vastly different.

Can anybody explain why?

Both approaches are using random numbers. The first approach uses two different random numbers (from column "A" and the one used in the "B" column calculation).