View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default generate a random number and use if function to generate new data

"Dogdoc1142" wrote:
I am trying to use the rand function to generate an interger
between 0-3.


=int(4*rand())

Depending on the result, I'm attempting to assign a text
value i.e. if rand()*3=1,"spades","clubs".


=index({"hearts","spades","diamonds","clubs"},1+in t(4*rand()))

Note: You do not really need int(...) in this context.
1+4*rand() will suffice.