ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   All possible Alpha character combonations (https://www.excelbanter.com/excel-programming/373580-all-possible-alpha-character-combonations.html)

[email protected]

All possible Alpha character combonations
 
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????


Tim Williams

All possible Alpha character combonations
 
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


wrote in message
oups.com...
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????




[email protected]

All possible Alpha character combonations
 

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



Tim Williams wrote:
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


wrote in message
oups.com...
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????



Tom Ogilvy

All possible Alpha character combonations
 
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

--
Regards,
Tom Ogilvy



wrote in message
oups.com...

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



Tim Williams wrote:
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


wrote in message
oups.com...
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????





[email protected]

All possible Alpha character combonations
 
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!!!!!!!!


Tom Ogilvy wrote:
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

--
Regards,
Tom Ogilvy



wrote in message
oups.com...

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



Tim Williams wrote:
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


wrote in message
oups.com...
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????





All times are GMT +1. The time now is 01:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com