## How to list all possible combinations from single column in Excel?

If you want to return all possible combinations from single column data to get the result as below screenshot shown, do you have any quick ways for dealing with this task in Excel?

**List all possible combinations from single column with formulas**

**List all possible combinations from single column with VBA code **

** List all possible combinations from single column with formulas**

The following array formulas can help you to achieve this job, please do step by step:

**1**. First, you should create two helper formula cells. In cell C1, please enter the below formula, and press **Ctrl + Shift + Enter** keys to get the result:

**=MAX(LEN(A2:A6))**

**Note**: In this formula,

**A2:A6**is the list of cells that you want to list their combinations.

**2**. In cell C2, enter the following formula, and press **Ctrl + Shift + Enter** keys together to get the second result, see screenshot:

**=CONCAT(A2:A6&REPT(" ",C2-LEN(A2:A6)))**

**Note**: In this formula,

**A2:A6**is the list of cells that you want to list their combinations,

**C2**is the cell contains the formula you created in step 1.

**3**. Then, copy and paste the following formula in cell D2, and press **Ctrl + Shift + Enter** keys together to get the first result, see screenshot:

**=IF(ROW()>2^(COUNTA(A$2:A$6)),"",TEXTJOIN(" + ",TRUE,IF(MID(TEXT(DEC2BIN(ROW()-1),REPT("0",COUNTA($A$2:$A$6))),ROW(INDIRECT("1:"&COUNTA($A$2:$A$6))),1)+0,TRIM(MID($C$3,(ROW(INDIRECT("1:"&COUNTA($A$2:$A$6)))-1)*$C$2+1,$C$2)),"")))**

**Note**: In this formula,

**A2:A6**is the list of cells that you want to list their combinations,

**C2**is the cell contains the formula you created in step 1,

**C3**is the cell with the formula you created in step 2, the

**+**character is the separator to separate the combinations, you can change them to you need.

**4**. And then, select this formula cell, and drag the fill handle down until blank cells appear. Now, you can see all combinations of the specified column data are displayed as below demo shown:

**Note**: This formula is only available in Office 2019, 365 and later version.

** List all possible combinations from single column with VBA code**

The above formulas are only available for newer Excel versions, if you have earlier Excel versions, the following VBA code can do you a favor.

**1**. Press **Alt+ F11** keys simultaneously to open the **Microsoft Visual Basic for Applications** window.

**2**. Then, click** Insert** > **Module**, copy and paste the below VBA code into the window.

**VBA code: List all possible combinations from single column**

```
Sub ConnectArr()
'Updateby ExtendOffice
Dim xDValue As Variant
Dim xOutRg As Range
Dim xDictionary As Object
Dim xF As Long
Dim xChar As String
xDValue = Range("A2:A6").Value 'the data range
Set xOutRg = Range("C1") 'output range
xChar = "," 'separator
For xF = 1 To UBound(xDValue)
Set xDictionary = CreateObject("Scripting.Dictionary")
xDictionary(0) = "Sets of " & xF
Call ConnectValue(xDValue, xDictionary, 0, xF, 0, "", xChar)
xOutRg.Offset(0, xF - 1).Resize(xDictionary.Count).Value = WorksheetFunction.Transpose(xDictionary.Items)
Set xDictionary = Nothing
Next
End Sub
Sub ConnectValue(ByRef pDValue, ByRef pDictionary, ByRef pLevel, ByVal pMaxLevel, ByVal pIndex, ByVal pValue, ByVal pChar)
Dim xF As Long
If pLevel = pMaxLevel Then
pDictionary(pDictionary.Count + 1) = pValue
Exit Sub
End If
For xF = pIndex + 1 To UBound(pDValue)
If pValue = "" Then
Call ConnectValue(pDValue, pDictionary, pLevel + 1, pMaxLevel, xF, pDValue(xF, 1), pChar)
Else
Call ConnectValue(pDValue, pDictionary, pLevel + 1, pMaxLevel, xF, pValue & pChar & pDValue(xF, 1), pChar)
End If
Next
End Sub
```

**Note**: In the above code:

**A2:A6**: is the list of data that you want to use;**C1**: is the output cell;**,**: the delimiter to separate the combinations.

**3**. And Then, press **F5** key to execute this code. All combinations from the single column are listed as below screenshot shown:

### Best Office Productivity Tools

**Supercharge Your Spreadsheets： Experience Efficiency Like Never Before with Kutools for Excel**

**Kutools for Excel boasts over 300 features, ensuring that what you need is just a click away...**

Supports Office/Excel 2007-2021 & newer, including 365 | Available in 44 languages | Enjoy a full-featured 30-day free trial.

#### Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!