View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
bpeltzer bpeltzer is offline
external usenet poster
 
Posts: 180
Default Need to generate random values from a list

=OFFSET($A$1,INT(RAND()*COUNTA(A:A)),0) will generate a random entry from the
list. The logic is that counta(a:a) returns the number of non-blanks from
column A. Multiply that by int(rand()*counta(a:a)) returns an integer =0
and < the number of non-blanks. The offset function goes down that many rows
from cell A1. (I've assumed the entries in column A begin in row 1 and are
continuous).
Note that the rand() function, and therefore the formula, will get updated
each time the sheet is recalculated. If you want to lock down a set of
random entries, highlight the completed column, edit copy, then edit
paste special, select values and click ok.

"Sumeet Benawra" wrote:

Hi

I want to be able to create a random values from a given list of values.

e.g. In column A, there are these values:
aaaa
bbbb
cccc
dddd
eeee
ffff

In another column, I want to randomly populate each cell with a value from
column A.

How can I do this?

Thanks