Forum Discussion
tpmcmahon
Apr 22, 2019Copper Contributor
Problem with INDEX and RANDBETWEEN
I am trying to sample randomly from a column of numbers using a combination of the INDEX and RANDBETWEEN functions. The formula was "=INDEX($C$15:$C$213,RANDBETWEEN(15,213)" - this was failing on a r...
SergeiBaklan
Apr 22, 2019Diamond Contributor
tpmcmahon , thats correct behaviour. You have 199 cells in you range starting from C15. Thus INDEX(C15:C213,1) returns C15; INDEX(C15:C213,199) returns C213 and INDEX(C15:C213,200) returns error since you out of range
- tpmcmahonApr 23, 2019Copper Contributor
Thanls, SergeiBaklan! I must of had a brain cramp today - I don't know why I kept trying to set to worksheet row number rather than array row number.
- SergeiBaklanApr 23, 2019Diamond Contributor
tpmcmahon , no problem, happens with all of us. Glad to help.