View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Martin Brown Martin Brown is offline
external usenet poster
 
Posts: 230
Default RAND() function error? ##

On 13/03/2012 11:42, JAgger1 wrote:
I have a set of numbers in cell A1:J1

I use =INDEX($A1:$J1,ROUND(RAND()*COUNTA($A1:$J1),0)) in cell L1 to
N1 to get 3 random numbers from my set of numbers. Sometimes I end up
with ## instead of a random number in one of the cells? Anyone know
why? Thanks


There is a chance that ROUND(RAND()*COUNTA()) will be <0.5

And so rounds to 0 which is an invalid index

--
Regards,
Martin Brown