View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Edwin Tam (MS MVP) Edwin Tam (MS MVP) is offline
external usenet poster
 
Posts: 48
Default Excel random sorting query

In fact, you don't need programming to achieve your task. Let's try to see how to solve it using Excel's built-in worksheet functions.

For example, you got your list of 12 numbers in column A, in the range A1:A12.
Now, create your first list of 6 "randomly picked" numbers in column C, in the range C1 to C6.

In cell C1, type the following formula:
=INDEX(A$1:A$12,INT(INT((12 * RAND()) + 1)))

Then use the mouse the drag the formula down, up to cell C6.
If you want 25 columns of such "randomly picked" numbers, with C1:C6 selected, use the mouse to drag the cells across to fill 25 columns to the right.

Now, a final step, if you want to "fix" the content of the cells (the values of the cells change every time the worksheet recalculates), with the 25 columns selected, from the "Edit" menu, choose COPY, then choose "Paste Special", paste only the Values.

It should be quite fast to complete the above steps. But if you insist to do it in a VBA way, let me know.


----- fingers wrote: -----

I am trying to generate 'x' discrete lists of 6 numbers. The 25 lists
must come from a selected list of 12 of numbers. ie
12 numbers = Excel takes 6 random numbers from the list to create 'x'
number of lists.
Can anyone suggest a way of doing this?
Thanks