## 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

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

 🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions… Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ... Super Lookup: Multiple Criteria VLookup  |   Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup .... Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List .... Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ... Featured Features: Grid Focus   |  Design View   |   Big Formula Bar   |  Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells   |  Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ... Top 15 Toolsets:  12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

#### 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!