# listing all possible combinations from a list of names

#### BrennanB

##### New Member
We are not proficient at Macros and wanted to see if there is a formula for one row or column of 12 names that we can extract every combination of 3 unique names
I know this may be a simple task for many but we cannot figure out how to extract all possible combinations of 3 names given 12 names
thank you for any insight you can provide

### Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi,

Put your names in column A and try this code, there are 220 combinations of 3 from 12 and this will put them in column B

EDIT...I should have added, there may be a formula but I can't imagine what form it might take.

Code:
``````Sub combinations()
Dim Last As Long, i As Long, j As Long
Dim k As Long, L As Long
Last = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To Last - 2
For j = i + 1 To Last - 1
For k = j + 1 To Last
Cells(L + 1, 2) = Cells(i, 1) & ", " & Cells(j, 1) & ", " & Cells(k, 1)
L = L + 1
Next
Next
Next
End Sub``````

Last edited:
Hi,

Put your names in column A and try this code, there are 220 combinations of 3 from 12 and this will put them in column B

EDIT...I should have added, there may be a formula but I can't imagine what form it might take.

Code:
``````Sub combinations()
Dim Last As Long, i As Long, j As Long
Dim k As Long, L As Long
Last = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To Last - 2
For j = i + 1 To Last - 1
For k = j + 1 To Last
Cells(L + 1, 2) = Cells(i, 1) & ", " & Cells(j, 1) & ", " & Cells(k, 1)
L = L + 1
Next
Next
Next
End Sub``````

This worked perfectly ! Thank you !!!!!

Replies
8
Views
189
Replies
8
Views
238
Replies
14
Views
1K
Replies
2
Views
268
Replies
0
Views
357

1,207,173
Messages
6,076,923
Members
446,242
Latest member
JECYN

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back