#1   Report Post  
Posted to microsoft.public.excel.misc
RL RL is offline
external usenet poster
 
Posts: 22
Default HELP ME!

I was wondering if anyone knows how to create samples in excel. I have a
list of 6 numbers and I want to list all possible random samples of 3. Is
there a way to do it?? PLEASE HELP ME!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 751
Default HELP ME!

Hi,
Assume your 6 numbers are in cells A1:F1. The following macro,
starting from row 10, in columns A:C, will produce all the
combinations of 3:

Sub combos()
rnum = 10
For i = 1 To 6
For j = i + 1 To 6
For k = j + 1 To 6
If i < j And i < k And j < k Then
Cells(rnum, 1) = Cells(1, i)
Cells(rnum, 2) = Cells(1, j)
Cells(rnum, 3) = Cells(1, k)
rnum = rnum + 1
End If
Next k
Next j
Next i
End Sub

Write back if you need adjustments based on your original numbers'
locations.

HTH
Kostis Vezerides

On Mar 15, 8:22 pm, RL wrote:
I was wondering if anyone knows how to create samples in excel. I have a
list of 6 numbers and I want to list all possible random samples of 3. Is
there a way to do it?? PLEASE HELP ME!



  #3   Report Post  
Posted to microsoft.public.excel.misc
RL RL is offline
external usenet poster
 
Posts: 22
Default HELP ME!



"vezerid" wrote:

Hi,
Assume your 6 numbers are in cells A1:F1. The following macro,
starting from row 10, in columns A:C, will produce all the
combinations of 3:

Sub combos()
rnum = 10
For i = 1 To 6
For j = i + 1 To 6
For k = j + 1 To 6
If i < j And i < k And j < k Then
Cells(rnum, 1) = Cells(1, i)
Cells(rnum, 2) = Cells(1, j)
Cells(rnum, 3) = Cells(1, k)
rnum = rnum + 1
End If
Next k
Next j
Next i
End Sub

Write back if you need adjustments based on your original numbers'
locations.

HTH
Kostis Vezerides

On Mar 15, 8:22 pm, RL wrote:
I was wondering if anyone knows how to create samples in excel. I have a
list of 6 numbers and I want to list all possible random samples of 3. Is
there a way to do it?? PLEASE HELP ME!


I'm sorry I really don't understand this, is there any other easier way?
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"