Using index, randbetween to generate random numbers

Microsoft Microsoft excel 2007 full vers...
August 3, 2017 at 15:21:27
Specs: Windows 7
Hi guys, thought I had the right code for this but turns out it creates random number from numbers it should not be using.

Sheet 1 is used and it works like I need.

Sheet 2
Column A - list of numbers 1 - 42 starting on row 3.
Column D - =COUNTIF(Sheet1!J3,">60") This works and if the number is >60 it puts a 1 in column D
Column C - =IF(D3,"1")*(Sheet1!A3). If column D is 1 on that row, it just takes the same number from Shee1!A3 and puts it here in Column C.

Column E - the problem. Currently use code;
=INDEX($C$3:$C$44,RANDBETWEEN(1,ROWS($A$3:$A$44 )),1)

It works but also generates random numbers from Column C that have a 0? When Column D,R3 etc is a 1, I want it to generate a random number in Column E3, but using ONLY the numbers 1-42 that has a 1 in Column D.

I have tried using =INDEX($A$3:$A$44,RANDBETWEEN(1,ROWS($A$3:$A$44 )),1) but kinda get the same results.



See More: Using index, randbetween to generate random numbers

Reply ↓  Report •
Related Solutions


Ask Question