![]() |
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! |
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! |
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? |
All times are GMT +1. The time now is 04:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com