View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Bernd Bernd is offline
external usenet poster
 
Posts: 92
Default Duplicates in Rand Formula

Hello,

One step-by-step approach:
In a new worksheet enter into A2:
=LEFT(MRO!$C2,2)
and copy down to row 49400.

Select cells B2:C1000 (assuming that 999 exceeds your count of
different prefixes) and array-enter
=lfreq(A2:A49400)

Array-enter into D2:D31 (assuming that you have exactly 54 different
prefixes and that you want to get 30 random values)
=INDEX(B1:B55,uniqrandint(55))
and copy down to row 55.

Enter into E2
=INT(RAND()*MATCH(D2,$B$2:$C$31,2,FALSE)+1)
and copy down to E31

Finally enter into F2
=INDEX(MRO!$C$2:$C$49400,MATCH(D2,$B$2:$B$49400,FA LSE)+E2-1)
and copy down to F31

My UDF's lfreq and uniqrandint you find at www.sulprobil.com.

If you need help to identify the count of different prefixes
automatically let me know.

HTH,
Bernd