All Combinations of Lists with an addition

bjorgen

New Member
Joined
Aug 23, 2011
Messages
33
I would like to output all the permutations of a list.

I can do this by just dumping each field and setting unique to yes, however I'd like to be able to include an "ALL" value for each field as the first value.

Any input here is greatly appreciated!
 
Create a query for each field with the unique values in that field.

Add all of those queries to a new query.

Add the single field from each table to the query.

Don't join anything or enter any criteria.

You should now have a list of all the permutations of all the values in all the fields.

I tried it with the data you posted and it results in 24 records which is 2x2x2x3.
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
One option is to create a unique list for each column. You can use SELECT DISTINCT for that; you will also need a query for each column
eg:
SELECT DISTINCT Vertical FROM MyList;

Now you have 4 queries (qryVertical, qryMedium, qryPartner, qryCostModel)

New query. Add those 4 queries, no joins.
Add the single field from each query to the grid. Sort as required

Denis
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,152
Members
452,891
Latest member
JUSTOUTOFMYREACH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top