In this example I’ve set up two lists and created tables from them called List1 and List2.

Create a Connection Only Query for the Two Lists

For each table, we’re going to create a connection only query that adds a column with the same constant value in each row. We will then use this column to join our two tables together using a merge query.

Select a cell in your list and then go to the Data tab and select the From Table/Range command in the Get & Transform Data section.

From the query editor go to the Add Column tab and select Custom Column from the menu.

In the Custom Column dialog box add a constant formula. This can be any text or number, just make sure it’s the same in both list queries.

Go to the Home tab in the query editor and press the lower part of the Close & Load button then select Close & Load To from the menu.

In the Import Data dialog box, select Only Create Connection and then press the OK button. Repeat these steps for both lists. You should have two connection only queries called List1 and List2.

Join the Two Connection Only Queries with a Merge Query

Now we are ready to join these two lists together using a Merge query.

Go to the Data tab and select Get Data from the Get & Transform Data section. Select Combine Queries from the menu and then select Merge from the submenu.

Now we can set up our merge query to join the two lists.

We can delete the Join Column now as we don’t really need it anymore and the output will be less cluttered if we remove it. Right click on the column heading and select Remove.

Now we can expand the List2 table in our query.

Now Close & Load the query from the Home tab.

Our List of All Possible Combinations

Now we have a table which contains every possible combination of items from List1 and List2. With small tables like this example, we could have easily created a table manually. For Large lists this query becomes a massive time saver though! We can also iterate this process if we have more than two tables to find all possible combinations items from 3 or more lists.

A Slightly Quicker Method

Since writing this post, I’ve found a slightly quicker method to do this. In this method, we still need to load both tables into power query, but we will only need to create one custom column and we don’t need to create a merge query. Create a connection only query that imports the List1 table.

Now, create a query that imports the List2 table and Edit the query. Add a Custom Column to and name it List1. Enter the formula =List1.

Expand out the new List1 column and then Close & Load the query to a table. The table will have all the combinations of items from both lists and we saved on making a custom column in List1 and avoided using a merge query altogether!

How To Generate All Possible Combinations Of Items From Two Lists - 67How To Generate All Possible Combinations Of Items From Two Lists - 86