Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Randomized Paired Comparison Array

I would generate an array of combinations, then randomly select from that
array, removing each pair that I process.

For generating pairs, you could modify this code from John Warren to return
an array of pairs of indexes into your array.

'
' Posted by John Warren, Excel-L
' March 27, 2001

Sub Combinations()
Dim n As Integer, m As Integer
numcomb = 0
n = InputBox("Number of items?", "Combinations")
m = InputBox("Taken how many at a time?", "Combinations")
Comb2 n, m, 1, "'"
End Sub

'Generate combinations of integers k..n taken m at a time, recursively
Sub Comb2(ByVal n As Integer, ByVal m As Integer, _
ByVal k As Integer, ByVal s As String)
If m n - k + 1 Then Exit Sub
If m = 0 Then
ActiveCell = s
ActiveCell.Offset(1, 0).Select
Exit Sub
End If
Comb2 n, m - 1, k + 1, s & k & " "
Comb2 n, m, k + 1, s
End Sub

--
Regards,
Tom Ogilvy



"John Michl" wrote in message
oups.com...
I'd like to create a process that would allow the user to pair up every
possible combination of two items in an array and make a comparison of
the two (let's just say they pick the one they like better. I assume I
could use nested For-Next loops to do the work something but I'd like
input on three things:
1) Avoid repeating combinations, for instance: Compare A to B and later
B to A
2) Avoid comparisons to self: Compare A to A
3) Randomize comparisons. If using For-Next, it would first compare A
to all other options, then B to all other, then C, etc. How could I
skip around but be sure that All possible combinations are asked but
not repeated?

Thanks for the advice.

- John



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


Similar Threads
Thread Thread Starter Forum Replies Last Post
t-test for paired means agarcia Charts and Charting in Excel 1 November 6th 08 12:13 AM
Randomized Functions Kleverton Silva Excel Discussion (Misc queries) 7 November 16th 05 06:49 PM
paired bar chart abj2 Excel Discussion (Misc queries) 2 June 2nd 05 07:58 PM
Haw to Randomized available data Adda Excel Worksheet Functions 2 April 10th 05 09:57 PM
Populating a select group of cells with randomized names... Kevin Lyons Excel Programming 1 February 10th 05 01:15 PM


All times are GMT +1. The time now is 09:25 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"