+ Reply to Thread
Results 1 to 15 of 15

generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

  1. #1
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,179

    generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    generate the combinations of 6 positions more by positions of the digits from 0 to 9 if it were by crescent it would give 210, but I need by positions where the digit 9 can be in the 1st position, then always add 0,1,2,3,4,5 the same, example
    8,9,0,4,6,1 add in front digit 0,1,2,3,4,5
    08 19 20 34 46 51
    the front digits will always be the same 0,1,2,3,4,5
    https://www.excelforum.com/attachmen...1&d=1683626220
    Attached Files Attached Files

  2. #2
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    If I understand your requirements ???:
    A) You want to randomly generate 6 unique single-digit numbers per row.
    B) The first number must be non-zero; the remaining numbers may fall between 0 and 9.
    C) Each of the above is added to a "10's" digit corresponding to its position (numbered 0,1,2,3,4,5).
    ...So {3,4,2,8,5,1} becomes {03,14,22,38,45,51}

    The following code generates the described output, placing it in a Named Range called Output_Range. This range may be any number of rows, but must be 6 columns wide. NOTE - If you don't want to deal with a Named Range, you can replace the RED TEXT with a standard range reference eg. "A9:F18"

    Please Login or Register  to view this content.

    Row\Col
    A
    B
    C
    D
    E
    F
    8
    Output_Range
    9
    03
    19
    27
    36
    41
    50
    10
    05
    13
    21
    38
    40
    56
    11
    04
    10
    23
    31
    46
    58
    12
    02
    16
    23
    30
    44
    58
    13
    04
    11
    28
    30
    45
    52
    14
    06
    15
    24
    31
    42
    50
    15
    03
    17
    26
    35
    41
    54
    16
    06
    18
    27
    35
    42
    59
    17
    07
    18
    20
    32
    41
    55
    18
    09
    12
    23
    31
    47
    58



    I await your response...
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  3. #3
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,179

    Re: generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    hello, leelmich, thanks for seeing the post almost there, it's for a 60/6 lottery similar to powerball,
    you have to imiminate the front digits and digit of the number, example 17 the digit 7 is the back digit, which goes from 0 to 9 already the front digit goes from 0 to 5 the number 60 does not enter the study, if you do 0 to 9 combining
    with 6 it will be 210, but they are in ascending order, it doesn't work, it has to be by position, so the digit 9 can be in the 1st position, eg a draw
    09 10 25 38..... 9 0 5 8.. note that the digit 9 is in the 1st position, and in the 210 it will only be at the end, it does not serve in the crescent, it has to be by position, then add 0.1 as the initial digit ,2,3,4,5 in all of them
    there is and forgetting it cannot have repeated digits when removing the 6 digit formations example 999112 or 112323, it cannot tend to be digits without repetition

  4. #4
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,179

    Re: generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    hello LEELNICH we have a problem=runtime error 1004 9 WITH RANGE("OUTPUT RANGE")

  5. #5
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    Quote Originally Posted by jorel View Post
    hello LEELNICH we have a problem=runtime error 1004 9 WITH RANGE("OUTPUT RANGE")
    You must select the range of cells where you want the output and NAME them by typing Output_Range (no spaces; note the underscore character) in the Name Box (the left-most box/text-entry area on the formula bar, just above column A).

    Regarding post #3, I'm completely lost.
    A) You keep referring to the crescent. What is that?
    B) "imiminate" isn't a real word.
    C) "...the number 60 does not enter the study..." HUH?!?
    D) Where does the number 210 come from / fit into this discussion?

  6. #6
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,179

    Re: generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    ok let's go step by step
    the 210, is taken from the 10 digits (last digit of each number) so 0 to 9 are 10 digits if you do
    10 digits combining for 6 we have 210 in total
    but it is in ascending order, which is not useful in the study, in ascending order the digit 9 will always be at the end, whereas in the positional digit 9 can be in any position, this is what I need, it cannot have repetitions example 666123, it cannot be 6 distinct digits from 0 to 9 positional
    the lottery is from 01 to 60, 6 numbers are drawn
    mega sena, in the initial digits 0,1,2,3,4,5, the digit 6 does not go because there is only one number, 60
    ex does not have 61,65,69.. he can be left out of the study, as he is rarely drawn.

  7. #7
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    OK, I googled Mega Sena (it's a Brazilian lottery, mentioned by O.P. in post#6). Here are some recent results:

      6-May-2023
    01 15 16 25 32 36
      3-May-2023
    09 13 22 31 57 58
      29-Apr-2023
    05 10 11 22 23 37
      26-Apr-2023
    10 18 41 49 53 59
      22-Apr-2023
    14 26 34 36 43 59

    I can randomly generate groups of six (unique) numbers that match this pattern. Is that all you want? If so, how many? One at a time? Several at a time? Or do you want something more. It seems like you have extra restrictions regarding individual digits. My existing code avoids repetition for BOTH digits within each row - no 2 first digits match, no 2 second digits match. This is different from the Mega Sena drawings, where individual digits may repeat, but each 2-digit number is unique.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,573

    Re: generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    ex does not have 61,65,69.. he can be left out of the study, as he is rarely drawn.
    It can't be drawn at all if 60 is the maximum number!!!
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  9. #9
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,179

    Re: generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    hello, thanks for seeing the post, yes there are repetitions both in the beginning and end of this pattern,
    like in powerball u.s.a. masa every 4 to 6 draws
    we have this pattern of non-repetition, I'll play until I get it right, it turns out that doing positional repeated combinations will give a lot of combinations
    if you do 10 digits ( 0 to 9) combining by 6 you will have 210 but they are in the crescent, I in the positional, you haven't generated this yet, then it's easier to join with 0,1,2,3,4,5,

  10. #10
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    Quote Originally Posted by jorel View Post
    ...yes there are repetitions both in the beginning and end of this pattern,
    like in powerball u.s.a. masa every 4 to 6 draws
    we have this pattern of non-repetition, I'll play until I get it right,...
    My use of the word "pattern" in post#7 referred solely to the uniqueness of numbers drawn on a single day/row.
    Are you suggesting there is some relationship/pattern between different rows? That numbers drawn on Saturday affect numbers drawn on Wednesday?

  11. #11
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,179

    Re: generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    hello the matrix of the mega sena has 6 lines and 10 columns, as six digits are drawn from the front the probability is enormous of repetition, sorry I had not seen this. in the final digit there are 10 digits for 6
    in the initial digit 0,1,2,3,4,5 i.e. the chance of repetition is huge

  12. #12
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    Quote Originally Posted by jorel View Post
    ...in the initial digit 0,1,2,3,4,5 i.e. the chance of repetition is huge
    Yes, expect at least 1 left-digit to repeat in ~98.5% of the draws, while at least 1 right-digit will repeat in ~85% of the draws.
    So, how can I help you? I'm still not sure what you want the code to do.

  13. #13
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,179

    Re: generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    hello,double repetition will do, 00. 99
    sometimes there are trios = 000 but few times, track the pairs and if possible the repeated trios, then make the list beside which ones were repeated more times if they were drawn
    https://www.excelforum.com/attachmen...1&d=1683747949
    Attached Files Attached Files

  14. #14
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    WSheet_PIC.png


    Formulas are sufficient for this:
    H5:M5 = INT(A5/10)
    O5:T5 = MOD(A5,10)
    W5:AB5 = LEFT("x",COUNTIF($H5:$M5,INT(W$4/10))>1)
    AH5:AQ5 = LEFT("x",COUNTIF($O5:$T5,INT(AH$4/10))>1)

    I would modify this to use 1's instead of "x", so you can count them more easily.

    W5:AB5 = --(COUNTIF($H5:$M5,INT(W$4/10))>1)
    AH5:AQ5 = --(COUNTIF($O5:$T5,INT(AH$4/10))>1)

    You could use a custom number format to hide the zeroes.
    Attached Files Attached Files
    Last edited by leelnich; 05-10-2023 at 07:34 PM. Reason: Added Graphic

  15. #15
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,179

    Re: generate the combinations of 6 positions more by positions of the digits from 0 to 9 .

    hello,LEEL! perfect, work of art, when you win a prize you will be rewarded, congratulations, thank you

+ 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] generate all formations in the 7 positions with the digits 0,1,2,3.
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-02-2023, 01:49 AM
  2. [SOLVED] detect the numbers, but only the first 5 positions and the last 5 positions.
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-04-2021, 09:17 AM
  3. [SOLVED] how many formations of 4 digits in each of the 7 positions only pairs 0,2,4,6,8.
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-12-2021, 07:19 AM
  4. generate all possible training with digits 1,2,3,4 in 7 positions.
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-17-2020, 09:23 AM
  5. detect all the positions of the two pairs of twins in the 7 positions,
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2020, 11:43 AM
  6. [SOLVED] how many formations do you have in ascending order with 5 positions with 0 to 9 digits?
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-17-2019, 10:43 AM
  7. [SOLVED] Locate the 25 positions of the letters of the 4 blocks Each block has 25 positions
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 50
    Last Post: 12-22-2017, 12:46 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