Factorials? to calculate values for multiple group combinations

yomero

Active Member
Joined
May 14, 2008
Messages
257
I have 4 groups {A, B, C, D}, in a column called "Event" .

How in MS Access can I calculate the unique/distinct combinations.
Is there a way to do it without creating individual queries per group?

For example:

Groups
A
A+B
A+B+C
A+B+C+D
A+C
A+C+D
A+D
B
B+C
B+C+D
B+D
C
C+D
D

How can I create the groups in MS Access (instead of using many queries)
 
Last edited:

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Create a Group By Query. Here is an example that counts the number of unique items (field1)

Code:
SELECT Sheet1.field1, Count(Sheet1.field1) AS CountOffield1
FROM Sheet1
GROUP BY Sheet1.field1;
 
Upvote 0
Create a Group By Query. Here is an example that counts the number of unique items (field1)
Code:
SELECT Sheet1.field1, Count(Sheet1.field1) AS CountOffield1
FROM Sheet1
GROUP BY Sheet1.field1;

Won't this simply return the number of times A, B, C and D are found in the column?

I'm guessing you want the possible combinations of a population taken one at a time (since you started only with A) and not just the numer. Excel has a native function (Combin, I think) but it will only give you the number. I've read of other ways to do this, but have never tested any of them.
If your data is in one table only, try creating a query with the table in 2x and don't create any joins. Something like
SELECT A, B, C, D FROM tbl1, tbl2;
You should get the Cartesian product and can evaluate the number of records using the Excel function to cross-check the result.
 
Upvote 0
Yes Micron, I need all the combinations which I will use to calculate the values (not count) for each of them.

Thanks. I will try this approach.
 
Upvote 0
Won't this simply return the number of times A, B, C and D are found in the column?
Yes. That was my understanding of the the problem. Apologies if not what you were looking for.
 
Upvote 0
Yes. That was my understanding of the the problem. Apologies if not what you were looking for.

I'd say no apologies required, but I'm like you in that respect. Funny how we should be so inclined when all we're trying to do is help. Keep on keepin on! You've been at it a lot longer that some of us, I see!
 
Upvote 0

Forum statistics

Threads
1,221,846
Messages
6,162,376
Members
451,760
Latest member
samue Thon Ajaladin

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