triadic combinations of words

J

jayock02

I am doing my masters thesis and have had difficulty with the following
I have computed the number of combinations of three words whe
specifying via the combin formula (10 words, 3 words or number
representing the words in each, giving the number of combinations 120)
But how can I get the actual triads of the combinations to display....
need to display all the 120 combinations instead of just getting th
number of them. Any help? :
 
G

Guest

Nested loops work well for this type of stuff. Copy and paste the macro
below into a code module, replace the array1 = Array("Zero", "One",.......

for whatever your 10 words are and run the macro on an empty excel
worksheet.



Option Base 1

Sub test()
Dim Array1()
Dim i As Integer
Dim t As Integer
Dim z As Integer
Dim count As Integer

Array1 = Array("Zero", "One", "Two", "Three", "Four", _
"Five", "Six", "Seven", "Eight", "Nine")
count = 0

For i = LBound(Array1) To UBound(Array1) - 2
For t = i + 1 To UBound(Array1) - 1
For z = t + 1 To UBound(Array1)
count = count + 1
Cells(count, 1).Value = Array1(i) & ", " _
& Array1(t) & ", " & Array1(z)
Next z
Next t
Next i

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top