+ Reply to Thread
Results 1 to 14 of 14

Generate all possible combinations from 4 sets.

  1. #1
    Forum Contributor
    Join Date
    08-06-2006
    Location
    Spain
    MS-Off Ver
    Excel 2010 32Bit
    Posts
    545

    Generate all possible combinations from 4 sets.

    Using Excel 2010
    Hello,

    I am sure this is bit tricky question.

    1st option I want to make all possible combinations from the 4 data sets, are in the column C, D, E and F…Result in the column I:L

    2nd option I want to generate only those combinations they pass min & max sums as per value given in the cells I1 & I2.

    Note: Why I want 2nd option in this example there are only 26880 sets…but (for example if data increase in 4 columns say for in C=55, D=70, E=35, F=30…so this will be 55*70*35*30 = 4042500 combinations…so far restring min and max would be handy.

    I have tried to as much as possible clearer in the workbook I need count in the row D4:AO4 but if any question I will try to answer.

    Please help.

    Regards,
    Moti

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,879

    Re: Generate all possible combinations from 4 sets.

    This ?

    Please Login or Register  to view this content.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Contributor
    Join Date
    08-06-2006
    Location
    Spain
    MS-Off Ver
    Excel 2010 32Bit
    Posts
    545

    Re: Generate all possible combinations from 4 sets.

    @JohnTopley I like the both macros superb! And the both options worked fine. Excellent solutions!

    I appreciate you for your help. Good luck.

    My Best regards,
    Moti

  4. #4
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,513

    Re: Generate all possible combinations from 4 sets.

    you can setting how many group ,nGroup to result SUM
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by daboho; 05-30-2024 at 01:38 AM.
    "Presh Star Who has help you *For Add Reputation!! And mark case as Solve"

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,879

    Re: Generate all possible combinations from 4 sets.

    Glad to have helped and thank you for the rep

  6. #6
    Forum Contributor
    Join Date
    08-06-2006
    Location
    Spain
    MS-Off Ver
    Excel 2010 32Bit
    Posts
    545

    Re: Generate all possible combinations from 4 sets.

    @daboho, your code is extraordinary! It recognizes the length of each group automatically and generates all combination as per min-max input multiplying group’s correctly Brilliant idea! (This way one code covers both options!) This is solved 100%...

    I appreciate you for your help. Good luck.

    My Best regards,
    Moti

  7. #7
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,513

    Re: Generate all possible combinations from 4 sets.

    Yes if you have More data Example from C:H, and want get result sum with Group 4,5,6 etc not all to revision
    Only litte part code
    Please Login or Register  to view this content.
    Last edited by daboho; 05-30-2024 at 08:48 AM.

  8. #8
    Forum Contributor
    Join Date
    08-06-2006
    Location
    Spain
    MS-Off Ver
    Excel 2010 32Bit
    Posts
    545

    Re: Generate all possible combinations from 4 sets.

    @daboho, thank you for the additional Note: post#7 how to extend columns.

    I am stuck trying the code post#4 as per following extended data rows…example attached it take long time and excel does not respond please can you check what I am doing wrong?

    My Best regards,
    Moti
    Attached Files Attached Files
    Last edited by Motilulla; 05-30-2024 at 09:52 AM.

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,879

    Re: Generate all possible combinations from 4 sets.

    [Using my macro] I tested your latest file which has 4.6 Million + ( 70*55*40*30) combinations ALL of which fall within MIN/MAX limits

    So YES, it takes some time to produce the results .....2 minutes 15 secs (faster than Daboho which I aborted) BUT which will not fit on 1M+ rows available!
    Last edited by JohnTopley; 05-30-2024 at 12:41 PM.

  10. #10
    Forum Contributor
    Join Date
    08-06-2006
    Location
    Spain
    MS-Off Ver
    Excel 2010 32Bit
    Posts
    545

    Re: Generate all possible combinations from 4 sets.

    @JohnTopley, I got it you are correct but there is any way after 1M rows can continue to next columns is it possible?

    My Best regards,
    Moti

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,879

    Re: Generate all possible combinations from 4 sets.

    Of course it can be done, BUT of what practical use is 4M + rows of data?

  12. #12
    Forum Contributor
    Join Date
    08-06-2006
    Location
    Spain
    MS-Off Ver
    Excel 2010 32Bit
    Posts
    545

    Re: Generate all possible combinations from 4 sets.

    Quote Originally Posted by JohnTopley View Post
    Of course it can be done, BUT of what practical use is 4M + rows of data?
    @JohnTopley, my honest answer is may be not after looking into it or may be useful I am not sure…May I request you if it can be done. Please can you create it for me.

    My Best regards,
    Moti

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,879

    Re: Generate all possible combinations from 4 sets.

    Please Login or Register  to view this content.
    Resultant file is far too big to upload:

    You are chasing "ghosts" with all this!

  14. #14
    Forum Contributor
    Join Date
    08-06-2006
    Location
    Spain
    MS-Off Ver
    Excel 2010 32Bit
    Posts
    545

    Re: Generate all possible combinations from 4 sets.

    Quote Originally Posted by JohnTopley View Post
    Please Login or Register  to view this content.
    Resultant file is far too big to upload:
    @JohnTopley, hats off to you I am amazed how you create this entire complicate task. This worked fine got fully results in 5:23 minutes.

    I am grateful thank you for your support and providing a perfect answer. This one is solved 101%!


    Quote Originally Posted by JohnTopley View Post
    You are chasing "ghosts" with all this!
    I am agreeing you are absolutely right…sometime really I find It's similar to chasing Shadows or chasing the wind. All my efforts that lead nowhere….

    Have a lovely evening.

    My Best regards,
    Moti

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Get Reduced sets out of 1X2 full predict Combinations
    By Motilulla in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-15-2023, 06:59 AM
  2. Returning combinations of two sets of data
    By dw_22801 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-13-2021, 11:38 AM
  3. [SOLVED] Generate Combinations Using VBA
    By NeedForExcel in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 06-06-2021, 01:10 AM
  4. Replies: 3
    Last Post: 06-28-2020, 04:09 AM
  5. vba to generate combinations
    By thoandros in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2018, 09:20 AM
  6. Generate Combinations
    By subrato312 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-04-2017, 12:53 PM
  7. Generate combinations
    By cjt_choccy in forum Excel General
    Replies: 6
    Last Post: 11-20-2011, 02:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1