# How can I create all possible combinations of 17 items into 2 groups using excel?

I want to find all the different combinations of dividing 17 into 2 groups; the order does not matter; each group has to contain at least one item.

I know the formula is C(17,r)=17!/(r!*(17-r)!) and my r is one to eight so there's a lot! I hoping there is an easy way to do this. I have been trying to assign items into the two groups by using 1 and 0 - i.e. 01111111111111111, 10111111111111111, 11011111111111111, ... 00111111111111111, 01011111111111111, etc ...

• Actually, there are $2^{16}=65536$ ways of diving a group of $17$ objects in $2$ groups, assuming that one accepts empty groups (otherwise, the answer is 65535). Is it practical to generate such a large number of groups in Excel? Does it suit some practical purpose? – digital-Ink Sep 16 '12 at 9:48
• Also, note that in MS Excel 2003 and earlier there are a maximum of 65,536 rows and 256 columns per worksheet, so you could arrive to some limitations when generating all the groups (assuming you put one group in the first column and the other group in another column + a header, you arrive to the maximum number of rows). – digital-Ink Sep 16 '12 at 9:54
• The tag is wrong. This question has nothing to do with group theory! – Derek Holt Sep 16 '12 at 10:52
• I don't know about Excel, but LibreOffice Calc has "=DECINBIN($x$,17)". Let $x$ run from 0 to 65535. – Hagen von Eitzen Sep 16 '12 at 11:03
• Excel has no direct function to present each partition. You may want to do this using another program and import the large result into Excel. – NoChance Sep 16 '12 at 11:15