+ Reply to Thread
Results 1 to 14 of 14

Modify VBA to pick numbers from group.

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

    Modify VBA to pick numbers from group.

    Using Excel 2010
    Hello,

    Hello, present macro pick 1 number from each 5 groups and make 100000 combinations.

    I need to pick instead 1 number out of 5 groups (do not pick any number from first three groups) just pick 2 numbers from Gr4, & 3 numbers from Gr 5

    Pick from�Gr1-0num, Gr2-0num, Gr3-0num, Gr4-2num, Gr5-3num this will create 5400 combinations.

    I want code also pick group number selection from the sheet rang C3:G3 as now 0 0 0 2 3 from each group

    Please help to make it possible.

    Regards,
    Moti
    Attached Files Attached Files
    Last edited by Motilulla; 02-24-2024 at 10:30 AM.

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,672

    Re: Modify VBA to pick numbers from group.

    Try
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,672

    Re: Modify VBA to pick numbers from group.

    Another type of combination.
    Please Login or Register  to view this content.
    Attached Files Attached Files

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

    Re: Modify VBA to pick numbers from group.

    Quote Originally Posted by kvsrinivasamurthy View Post
    Another type of combination.
    Please Login or Register  to view this content.
    Hello kvsrinivasamurthy, your ans2 macro is generating correctly 5400 combinations picking 2 numbers from group4 & 3 numbers from group5in the columns W:AA. As it is shown pick in the (range C3:G3) 0-0-0-2-3.

    But if I change in the range (range C3:G3) as 0-0-0-1-4 this mean pick 1 numbers from group4 & 4 numbers from group5 which must generate 2100 combinations (but it generate the same 5400) what I am doing wrong? Please can you take a look?

    I appreciate your help Good Luck.

    Regards,
    Moti

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

    Re: Modify VBA to pick numbers from group.

    Please also I want to summit the link of cross post...
    https://www.mrexcel.com/board/thread.../#post-6158987

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,672

    Re: Modify VBA to pick numbers from group.

    The present macro has no link for range C3:G3. Macro written for picking 2 numbers from group4 & 3 numbers from group5in the columns W:AA.
    For other requirement separate macro is to be written.

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

    Re: Modify VBA to pick numbers from group.

    @kvsrinivasamurthy, thank you for the response, that would be great option if it can be linked with the range.

    Please can you make it when you can that will be huge help.

    Regards,
    Moti

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Modify VBA to pick numbers from group.

    The attached is only for the data how you provided.

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

    Re: Modify VBA to pick numbers from group.

    Quote Originally Posted by jindon View Post
    The attached is only for the data how you provided.
    Hello jindon , excellent macro it worked like magic. Thank you so much for kind help.This query is solved 100%

    Good Luck.

    My best regards,
    Moti

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

    Re: Modify VBA to pick numbers from group.

    Quote Originally Posted by jindon View Post
    The attached is only for the data how you provided.
    Hello jindon, your code is working perfect as data provided.

    Please if it is not annoying can you take a look my modified request, does it is possible to get solution over, if the numbers are unstructured as shown in the sheet “Unstructured Data”. Also there is an explanation.

    Kind Regards,
    Moti

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Modify VBA to pick numbers from group.

    try this one
    Please Login or Register  to view this content.
    Last edited by jindon; 02-29-2024 at 08:07 AM.

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

    Re: Modify VBA to pick numbers from group.

    Quote Originally Posted by jindon View Post
    try this one
    Hello jindon, I am grateful it worked as explained; I am sorry due to my lack of information is it possible? Select lower number from any starting group and to next number higher from next group. I would have mentioned it previously.

    For example if the 5 group selection is like 0-0-2-2-1, 0-1-2-0-2, 0-1-1-1-2 or 0-0-0-2-3.

    Please could you take a look?

    Kind Regards,
    Moti

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Modify VBA to pick numbers from group.

    Code in #11 has been modified.

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

    Re: Modify VBA to pick numbers from group.

    Quote Originally Posted by jindon View Post
    Code in #11 has been modified.
    Hello jindon, I am so happy and grateful to you. I appreciate you give time to being with me and solving all request.

    Have a nice time good luck.

    Kind 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. [SOLVED] randomly picked names from overall list need to pick those chosen and group
    By KBLiver in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 07-21-2020, 04:07 PM
  2. [SOLVED] Macro to generate groups randomly of 20 numbers, being 10 of group A and 10 of group B,
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 11-14-2017, 08:02 AM
  3. Replies: 5
    Last Post: 11-28-2015, 03:44 AM
  4. pick the number from a group
    By sun_ilkumar in forum Excel - New Users/Basics
    Replies: 10
    Last Post: 12-15-2009, 04:09 PM
  5. Modify this SQL to pick certain fields
    By davegugg in forum Access Programming / VBA / Macros
    Replies: 3
    Last Post: 11-03-2009, 10:06 AM
  6. Group data and pick a particular row based on a condition
    By VishalBade in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-22-2006, 02:25 PM
  7. [SOLVED] pick the greatest number out of a group for the total box
    By chunky in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-21-2006, 09:30 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