View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Need possible combinations of 7 unique characters.

Hi,

As a first stab at it try this. Right click your sheet tab, view code and
paste this in and run it


Sub serviant()
x = 1
lastrowA = Cells(Cells.Rows.Count, "A").End(xlUp).Row
LastrowB = Cells(Cells.Rows.Count, "B").End(xlUp).Row
Set myrangeA = Range("A1:A" & lastrowA)
Set myrangeB = Range("B1:B" & LastrowB)
For Each c In myrangeA
For Each d In myrangeB
If c.Value < d.Value Then
Cells(x, 3).Value = c
Cells(x, 4).Value = d
x = x + 1
End If
Next
Next
End Sub

Mike

"scottgorilla" wrote:

Ok I have seven unique text items in two columns and need a formula that will
give me all the possible combinations in a list. The columns are as follows.

Column 1
KEY
KNOB
2KEY
2KNOB
<blank

Column 2
KEY
KNOB
KK
2KK
2KEY
2KNOB
<blank

What I am looking for is a way to list in two columns the unique
combinations of Column1 & Column2 so I can insert a third column next to give
a value to be used in a VLOOKUP formula.

Thank You in advance