All possible Alpha character combonations

T

trigo1

I am trying to render all the possible combonations of two sets of alpa
data.

For example

Price
MGP
Comfort
Style

would be compared to

Price
MGP
Comfort
Style

and thus there are 6 possible combonations

price, MGP
price, comfort
price, style
MGP,comfort
MGP, style
comfort,style


How could i do this in excel????
 
T

Tim Williams

Both sets are always the same?
Sets are of the same length or can they be different lengths?
Order of pairs doesn't matter ?

Perhaps you can define your requirements (or the context) a bit more
explicitly.

Tim
 
T

trigo1

For now I think both sets are always the same, thus the same length ,
and order of pairs doesn't matter.
 
T

Tom Ogilvy

Assume the two sets are in A1:A4 and B1:B4

Sub ABD()
Dim rw As Long, i As Long, j As Long
rw = 0
For i = 1 To 4
For j = i + 1 To 4
If StrComp(Cells(i, 1), Cells(j, 1), _
vbTextCompare) <> 0 Then
rw = rw + 1
Cells(rw, "C") = Cells(i, 1) & ", " & Cells(j, 2)
End If
Next
Next

End Sub
 
T

trigo1

WOW THAT EXAXTLY WHAT I NEEDED! Thank you so much! I thought i would
be able to munipulate the script to adjust it to diffrent cell ranges
in the sheet but i havent figured that out yet(vba rookie). Also how
could i change it to be flexible and compare anyehere from 1 to 10
items in each set, becasue the data inputed will vary from 1 to 10
items?? Thank you so much for your help!!!!!!!!
 

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