I have a work problem to solve and very little to no training on complicated math formulas. This seems like it would be easy but I don't have the right terminology and can't find the correct formula online!

I need to know the amount of combinations for multiple sets of data. Each item in a set is unique and there must be one item from each set. An example of my data set looks like this:

Set 1: Black, White, Green, Blue 
Set 2: Jeans, Trousers, Skirt, Short
Set 3: Sneaker, Sandal, Flat

If I use the product rule, I can determine that there are 48 total combinations (4 x 4 x 3).

HOWEVER, some of these items will not combine together and I do not know how to properly subtract them to get the total possible combinations. For example, say these rules exist:

Black does not go with Skirt or Short
Black does not go with Sandal
Trousers do not go with Sandal or Flat
Skirt does not go with Sneaker

Now, how do I create a formula (by hand or in excel) that will tell me the real number of combinations considering the above exceptions?

I'm hoping this is simple and easy to explain, but I'm starting to worry it won't be. If my information is not clear, please let me know!


Count the number of times the event occurs and subtract it from the total.

Black does not go with Skirt or Short: -6

You can list the sample spaces if necessary





You could also think of it this way

you have 3 choices {x,y,z}, x and y are chosen for you {black,short,z} this is a combination:$3c1$ as there are 3 items to fill the last spot z {sneaker, sandal, flat} and of course you must do this again for the case of {black, skirt, z}

for your fourth example "Trousers do not go with Sandal or Flat" it would go something like

{x, Trousers, sandal}, $4c1*1*1 = 4$

{x, Trousers, flat}, $4c1*1*1 = 4$

add the combinations and you get 8. This means there are 8 unfavorable combinations out of the total 48 combinations

If this wasn't what you were looking for please leave a comment.

To remove overlapping set's you can adjust your original statement to account for all cases.

for example:

  • white does not go with jeans or skirt
  • white does not go with Flat
  • skirt does not go with white

There are two restrictions for white, one for skirt however some of the statements can be concatenated.

The third restriction is encompassed by the first and therefore can be ignored

{white, y, z}

y:{skirt,s̶k̶i̶r̶t̶,jeans}#due to restriction 3

z:{sneaker, sandal, flat}


{white, y, flat}

y:{J̶e̶a̶n̶s̶, Trousers, s̶k̶i̶r̶t̶, Short}


Adding the two we get: 8 unfavorable outcomes. As you can see both sets have white in common which is what allows us to relate the two to each other.

sample spaces:

Restriction #1:

{white, skirt, sneaker} {white, skirt, sandal} {white, skirt, flat}

{white, jeans, sneaker} {white, jeans, sandal} {white, jeans, flat}

Restriction #2:

{̶w̶h̶i̶t̶e̶,̶ ̶j̶e̶a̶n̶s̶,̶ ̶f̶l̶a̶t̶}̶ {white, trousers, flat} {̶w̶h̶i̶t̶e̶,̶ ̶s̶k̶i̶r̶t̶,̶ ̶f̶l̶a̶t̶}̶ {white, short, flat}

Restriction #3:

{̶w̶h̶i̶t̶e̶,̶ ̶s̶k̶i̶r̶t̶,̶ ̶s̶n̶e̶a̶k̶e̶r̶}̶ ̶{̶w̶h̶i̶t̶e̶,̶ ̶s̶k̶i̶r̶t̶,̶ ̶s̶a̶n̶d̶a̶l̶}̶ ̶{̶w̶h̶i̶t̶e̶,̶ ̶s̶k̶i̶r̶t̶,̶ ̶f̶l̶a̶t̶}̶

Now as for a general formula, it will really depend on your restrictions, if you are planning to do this on excel I imagine there is someway to make calculate the combinations for each restriction individually and then compare the sample spaces to remove any duplicates, but I am not well versed in excel or VBA if you are looking for a way to implement this algorithm I would suggest heading over to StackOverflow there will probably be someone there that knows how to go about this.

  • $\begingroup$ Thanks so much for your help!! Question - How do I account for overlap? For example, if I run the first scenario I come out with 6 unfavorable combinations. However, if I run the second scenario independently, the answer would be 4 mismatches, but that's not accounting for the 2 combinations that were already subtracted from the first scenario (which would be {black, skirt, sandal} and {black, short, sandal}). I'm hoping there's a general formula I can use to apply these rules! $\endgroup$ – lloyd Nov 11 '14 at 2:37
  • $\begingroup$ Response in main text $\endgroup$ – DRAGONMASTER4000 Nov 11 '14 at 4:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.