Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to list / generate all possible combinations in Excel?

doc list all combinations 01

Let’s say, I have the following two columns of data, and now, I want to generate a list of all possible combinations based on the two lists of values as following screenshot shown. Maybe, you can list all the combinations one by one if there are few values, but, if there are several columns with multiple values needed to be listed the possible combinations, here are some quick tricks may help you to deal with this problem in Excel.

List / generate all possible combinations with formula

List / generate all possible combinations with Kutools for Excel


List All Possible Combinations from multiple columns:

Kutools for Excel’s List All Combinations utility can help you quickly generate / list all possible combinations based on multiple lists of values.

doc find combination equal sum 2

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!


List / generate all possible combinations with formula


The following long formula can help you to list all possible combinations of two lists values quickly, please do as follows:

1. Enter this formula: =IF(ROW()-ROW($D$1)+1>COUNTA($A$1:$A$4)*COUNTA($B$1:$B$3),"",INDEX($A$1:$A$4,INT((ROW()-ROW($D$1))/COUNTA($B$1:$B$3)+1))&INDEX($B$1:$B$3,MOD(ROW()-ROW($D$1),COUNTA($B$1:$B$3))+1)) into a blank cell, in this case, I will enter it to cell D1, and then press Enter key to get the result, see screenshot:

doc list all combinations 2

Note: In the above formula, $A$1:$A$4, are the first column values, and $B$1:$B$3 are the second list values which you want to list all their possible combinations, the $D$1 is the cell that you put the formula, you can change the cell references to your need.

2. Then select cell D1 and drag the fill handle down to the cells until get the blank cells, and all the possible combinations have been listed based on the two lists values. See screenshot:

doc list all combinations 3


List / generate all possible combinations with Kutools for Excel

The above formula can help you generate the possible combinations with only two lists, if there are more than two lists values need to be listed the possible combinations, the formula will not work. Here, I can recommend a powerful tool -- Kutools for Excel, it contains a handy feature List All Combinations which can quickly list all the possible combinations based on given data lists.

Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days.

After installing Kutools for Excel, please do as follows:

1. Click Kutools > Insert > List All Combinations, see screenshot:

doc list all combinations 4

2. In the List All Combinations dialog box, do the following operations:

(1.) Choose Value from the Type drop down list;

(2.) Then click doc list combinations 6 button to select the first data list that you want to use.(You can also type the values which are separated by commas into the Text box one by one )

doc list all combinations 5

3. Then click Add button to add the first value list into the Combinations list box, see screenshot:

doc list all combinations 6

4. If you need to use certain character to separate the combinations, please choose Separator from the Type drop down, and specify the separator you need in Text box, then click Add button to add the separator into the Combinations list, see screenshot:

doc list all combinations 7

5. Then repeat step3 and step4 to insert other data lists and separators into the Combinations list box, see screenshot:

doc list all combinations 8

6. After inserting the data list, then click Ok button, and a prompt box will pop out to remind you select a cell to output the result, see screenshot:

doc list all combinations 9

7. Click OK, all of the possible combinations based on the given lists have been generated into the worksheet as following screenshot shown:

doc list all combinations 10

Note: If you don’t need the separators between the combinations, you just need to skip step 4 and add the values lists into the dialog box.

Click to Download Kutools for Excel Now !


List / generate all possible combinations with Kutools for Excel

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    JJ · 2 months ago
    Almost very handy. Would be good if it actually used whatever is in the cell ($A$1)and not convert the cell to text. Then I could just paste what I need in A1 and run it again without having to change anything.
  • To post as a guest, your comment is unpublished.
    Sergio Gomez · 7 months ago
    I used the extions and works fantastic,, but now i have a problem, i need to calculate the sum,, but the result is a text,, i enter a separator that is the simbol +, but finally i have a text and is impossible to convert in a operation.
  • To post as a guest, your comment is unpublished.
    sergio · 7 months ago
    Hello, and if these combinations intead text are number,, how can i made the calculation for the results???? i try to add the "+" but excel dont know that is the simbol.. how you solve this?
  • To post as a guest, your comment is unpublished.
    ricardo · 7 months ago
    Hola me arroja una referencia circula la formula
    =SI(FILA()-FILA($D$1)+1>(CONTARA($A$1:$A$4)*CONTARA($B$1:$B$3));"";INDICE($A$1:$A$4;RESIDUO((FILA()-FILA($D$1));COUNTA($B$1:$B$3)+1))
    &INDICE($B$1:$B$3;RESIDUO(FILA()-FILA($D$1);CONTARA($B$1:$B$3))+1))
  • To post as a guest, your comment is unpublished.
    Anirban Karmakar · 1 years ago
    Why my formula did not work to create 25 combinations in Column E (5 elements from Col A * 5 elements from Col B) ? Whereas the formula in this article worked in Column D when I dragged it for 25 cells? Screenshot - https://prnt.sc/ihwr18