Grouping Items Into 2 groups
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Good day!
I am trying to create a macro that will group certain number of data into 2 groups. Each group does not necessarily need to be equal number of members. I need to get all possible groupings.
Example:
Data: A,B,C,D (4 items)
Possible groupings:
1) A and B,C,D
2) B and A,C,D
3) C and A,B,D
4) D and A,B,C
5) A,B and C,D
6) B,C and A,D
and so on...
Any idea is greatly appreciated. Thank you!
Solved! Go to Solution.
- Labels:
- Macros
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@JovanieYonson
Good to know you here in this community. 😁
there is a similar question answered by @SPetrie maybe we can take as reference.
I try not to touch the macro itself and make some process outside.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I'm glad my macro is able to help more people! :)
@Qiu mentioned that he tried not to touch the actual macro in his solution so I though I would offer my version of a solution that does adjust the original macro.
Since Group 2 is the inverse set of Group 1 and the macro already has knowledge of that inverse set, so we just need to add a few tools to capture it.
Now the macro will output every combo plus its inverse.
The only additional steps needed would be to clear out "duplicates", assuming that ABC-D is the same as D-ABC.
I hope this helps as an alternative example to so the many ways you can attack a problem.
Happy solving!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
