Excel: How to List All Possible Combinations Between Lists


You can use the following formula to list all possible combinations between multiple lists in Excel:

=IF(ROW()-ROW($D$2)+1>COUNTA($A$2:$A$4)*COUNTA($B$2:$B$4),"",INDEX($A$2:$A$4,INT((ROW()-ROW($D$2))/COUNTA($B$2:$B$4)+1))&" "&INDEX($B$2:$B$4,MOD(ROW()-ROW($D$2),COUNTA($B$2:$B$4))+1))

This particular formula lists all possible combinations between the values in the range A2:A4 and the range B2:B4, and outputs these combinations starting in cell D2.

The following example shows how to use this formula in practice.

Example: List All Possible Combinations Between Multiple Lists in Excel

Suppose we have a list of basketball team names and a list of positions:

Suppose we would like to list all possible combinations between the team names and the positions.

To do so, we can type the following formula into cell D2:

=IF(ROW()-ROW($D$2)+1>COUNTA($A$2:$A$4)*COUNTA($B$2:$B$4),"",INDEX($A$2:$A$4,INT((ROW()-ROW($D$2))/COUNTA($B$2:$B$4)+1))&" "&INDEX($B$2:$B$4,MOD(ROW()-ROW($D$2),COUNTA($B$2:$B$4))+1))

We can then click and drag this formula down to more cells in column D until the formula stops producing results:

Excel list all possible combinations

Column D now contains all possible combinations between the team names and the positions.

We can see that there are a total of 9 possible combinations.

If you’d like, you can display the combinations in separate columns by typing the following formula into cell E2:

=TEXTSPLIT(D2, " ")

You can then click and drag this formula down to each remaining cell in column E:

All of the possible combinations between the team names and positions are now displayed in two columns.

Note that the TEXTSPLIT function in Excel splits the text in a cell into multiple columns based on a delimiter.

In this example, we specified that the TEXTSPLIT function should use a space as a delimiter to decide where to split the text in each cell in column D.

Additional Resources

The following tutorials explain how to perform other common tasks in Excel:

Excel: How to Count Unique Names
Excel: How to Count Unique Values by Group
Excel: How to Generate Unique Identifiers

2 Replies to “Excel: How to List All Possible Combinations Between Lists”

    1. I have 10 numbers i want to generate a combination of six possible numbers that will cover all, what must i do.
      LIST A B C D E F
      1ST 15 15 15 15 15 15
      2ND 2 2 2 2 2 2
      3RD 26 26 26 26 26 26
      4th 4 4 4 4 4 4
      5th 5 5 5 5 5 5
      6th 28 28 28 28 28 28
      7th 42 42 42 42 42 42
      8th 17 17 17 17 17 17
      9th 3 3 3 3 3 3
      10th 8 8 8 8 8 8
      11th 7 7 7 7 7 7
      12th 4 4 4 4 4 4
      10th 12 12 12 12 12 12

Leave a Reply

Your email address will not be published. Required fields are marked *