Excel - Generating All Possible Lottery Combinations in Excel - Step by Step Tutorial - Episode 2441

Поделиться
HTML-код
  • Опубликовано: 21 дек 2024

Комментарии • 219

  • @excelisfun
    @excelisfun 3 года назад +4

    That is some of the coolest VBA code I have seen you podcast about!!!!! Thanks, Mr Excel : ) : ) : ) : )

  • @gerdsfargen6687
    @gerdsfargen6687 2 года назад +7

    Mr Excel is living legend! Been learning everything I need to in Excel from his tutorials for years. Bill Jelen!

    • @MrXL
      @MrXL  2 года назад +3

      Thanks NickKey! Ever since 1985 when I used a spreadsheet to with $690 in the lottery and then to win a trifecta at the Kennel Club, I was hooked. Glad to help!

    • @cirej0506
      @cirej0506 Год назад

      @@MrXL How do you use it to win $690? Might also use your technique to win here in Ph! lols😁

  • @simfinso858
    @simfinso858 3 года назад +2

    Thanks God.Mr.Excel is there on this planet for such complex problems. Thanks mr.Excel.

  • @blgxpo2726
    @blgxpo2726 Год назад +4

    Great tutorial! Thank you for posting this!
    Could you please explain if it's possible to exclude from the list certain combinations based on specific criteria (like: no more than 3 consecutive numbers, all numbers odd, all numbers even, not more than 3 numbers ending in the same digit, etc.).
    Your help is greatly appreciated, thanks again!

    • @jessiedelgado
      @jessiedelgado 11 месяцев назад

      Are you a lottery enthusiast?

  • @TonyJackson44
    @TonyJackson44 Год назад +2

    I've been looking for this for a few years

  • @lilsept77
    @lilsept77 3 дня назад

    Could I use Excel for pick-3, pick-4, and pick-5?

  • @marvinhife9389
    @marvinhife9389 2 года назад +2

    Hi, how we should do or filter from all combinations generated those list of all lotto results that came out already, and just remain those that has not come out yet. Lets say I have all the results since from year 2000-2022 and I used your lottery combinations to generate all the 6/55 combinations, then in my list of results from year 2000-2022 I wanted to removed them from the generated combinations of 6/55 and remain those that did not came out yet?

  • @ruckus8012
    @ruckus8012 Год назад +3

    Is there a way to do this with choosing 5 numbers from 1-69 but excluding any combinations that have 4 or 5 consecutive numbers in a row? Example 1-2-3-4-10 or 32-33-34-35-54 would be excluded.

  • @bma737
    @bma737 11 месяцев назад

    This worked great. I changed it a little for Powerball and so far my computer has been running for the last 12 hours and still have a ways to go. Do you still have your book and if so does it contain the updates with the latest Excel?

  • @cl8439
    @cl8439 6 месяцев назад

    Can you do excel for powerball and add an additional column for sums?
    I have other questions, but wanted to know that first. Thank you

  • @devonjansen9728
    @devonjansen9728 2 года назад +1

    Interesting! Kindly advise what about running the same code for lotto numbers 1-49?

  • @AlexD-xo8ji
    @AlexD-xo8ji 11 месяцев назад

    I've been looking for a way to use Excel more effectively to track lottery numbers and analyze the data

  • @josipkova5402
    @josipkova5402 4 месяца назад

    Hi @MrXL can you maybe make a script for printing full system combinations for lottery (I mean when you have certain numbers anf you made combinations from them). Thanks!

  • @arvinlacanlale1504
    @arvinlacanlale1504 Год назад +1

    How about 6/42 all combi?

  • @kazadimeji6746
    @kazadimeji6746 Год назад

    Thank you very much for the knowledge transmitted in this video, but I can't understand how you managed to align the combinations in columns A, B, C, D, F, G. I can't figure it out. do and I limit only in column A. Please help me.

  • @rajeshkumarsaha6662
    @rajeshkumarsaha6662 Год назад +1

    What will be the code for the combination 7 numbers between 1 and 50 and Combination 6 numbers 1 and 49. Will those codes run in 16 GB RAM with 64 Bit.

  • @TGMoney-10Keasy
    @TGMoney-10Keasy 4 месяца назад

    I’ve been looking for something in excel that compares historical data to all possible combinations to determine how many of the possible combinations have been drawn and number of times any combination of numbers were drawn repeatedly 😊

  • @JohnDough-jt2zb
    @JohnDough-jt2zb Год назад +1

    How about permutations and combinations in excel when you have repeating numbers like in the pick-3 or pick-5 type lotteries?
    What I'm attempting is an equation that looks at 5 columns and returns the number of permutations and combinations.
    Any thoughts as to how this can be accomplished?
    Example 12345 has
    120 permutations
    1 combination

  • @josestudyexcel
    @josestudyexcel Год назад +1

    Can you make a formula where it generates a series of lottery number combinations out of those most frequent numbers? Let's say I want to generate 50 lottery number combinations out of 18 frequent numbers.

  • @tripelbier7335
    @tripelbier7335 4 месяца назад

    Can i download your project to test it? When i try your code in Calc it does not work.

  • @SivaKumar-mo9kg
    @SivaKumar-mo9kg 2 месяца назад

    Hi sir how to calculate full video please in singapor toto

  • @mehmetdogu384
    @mehmetdogu384 8 месяцев назад

    make some conditional number extracting from 49 numbers? Any 5 numbers from 49 ok 7 million combinatios. any 5 if 6 in the firtst 5000 lines or similar?

  • @wayneedmondson1065
    @wayneedmondson1065 3 года назад +2

    Hi Mr. Excel. What an awesome bit of code there! Thanks for sharing it. Also, you snuck in the COMBIN() function at the beginning of the video. That's one that probably many people don't know about. Thanks for all the great tips :)) Thumbs up!!

  • @danielvasquez8117
    @danielvasquez8117 7 месяцев назад

    I REALLY....REALLY NEED HELP WITH MY SITUATION, PLEASE! I have combinations in multiple cell blocks. I need to add a selection of numbers to all cellblocks while maintaining the correct numerical order of the combination. For example: I have cell blocks containing such combinations as: 03 05 09....15 17 21...ect and I want to add 2 even numbers say 2 and 4. How can I add to cell blocks making them 02 03 04 05 09, ect ??? BIG thanx!

  • @deninsrmic4165
    @deninsrmic4165 3 года назад +1

    Great tutorial Bill, got your great book on VBA 2010 & 2016. Shame you are not offering any VBA courses as books are well explained.

    • @MrXL
      @MrXL  3 года назад +1

      I have a course based on that book: I will put the URL in the video description above.

  • @kishaapmyers1804
    @kishaapmyers1804 2 года назад +1

    How do you make a generator 0f 39 numbers to make 575,757 combinations

    • @MrXL
      @MrXL  2 года назад

      39 numbers, chosen 5 at a time. The first one is 1-2-3-4-5 and the last one is 35-36-37-38-39. The VBA code would be:
      Sub ListThemAll()
      TC = 1
      TR = 1
      Ctr = 1
      MaxRows = Rows.Count
      EndCell = 7059052
      Application.ScreenUpdating = False
      For a = 1 To 35
      For b = (a + 1) To 36
      For c = (b + 1) To 37
      For d = (c + 1) To 38
      For e = (d + 1) To 39
      Application.StatusBar = Ctr & " on way to " & EndCell
      Cells(TR, TC).Value = a & "-" & b & "-" & c & "-" & d & "-" & e
      Ctr = Ctr + 1
      If Ctr Mod 25000 = 0 Then
      Cells(TR - 20, TC).Select
      Application.ScreenUpdating = True
      ThisWorkbook.Save
      Application.ScreenUpdating = False
      End If
      TR = TR + 1
      If TR = MaxRows Then
      TR = 1
      TC = TC + 1
      End If
      Next e
      Next d
      Next c
      Next b
      Next a
      Application.StatusBar = False
      Application.ScreenUpdating = True
      End Sub

    • @ladyshenna967
      @ladyshenna967 2 года назад

      You must be in Missouri. Hello homey!!!!

    • @lottocombination6856
      @lottocombination6856 2 года назад

      You can access the mobile application you need from this website www.lottocombination.com

  • @MoisesRodriguez-f5d
    @MoisesRodriguez-f5d 7 месяцев назад

    I'm confused. I'm using the Powerball 2021 and it only goes until 24999. It doesn't give me all the combinations and I don't have the breakpoint on anymore. Could I get some help on it please?

  • @halsigmund3426
    @halsigmund3426 Год назад

    What I am looking for is a way to get Excel to generate a list of the numbers that appear with each other in a group of drawings I select. Not sure which function or functions to use to do that.

  • @pandimugunthan9656
    @pandimugunthan9656 Год назад

    Can you tell 6 digit lottery number tricks

  • @zorahguzman7467
    @zorahguzman7467 2 года назад

    can i get all the # from 1 to 39 plz my computer dont have all those up to date features in xcel

  • @AndreasGanster
    @AndreasGanster Год назад

    ich verfüge über eine Excel-Liste der bisherigen Ziehungen und kann hier auch bereits eine Menge interessante Auswertungen machen. Für die aktuellste Tippreihe sind die Erfahrungen der vergangenen Ziehungen relevant.

  • @mirriamjulile9738
    @mirriamjulile9738 2 года назад

    MR Excel can you please help with the formula to use in order to select winning combination if you can.

    • @MrXL
      @MrXL  2 года назад +1

      If I posted that formula here in public, then everyone would play the same number and no one would win anything. (Imagine splitting a $1 million jackpot 300 million ways). You’ve got to come up with the magic mojo yourself. I can just give you tools to help analyze.

    • @mirriamjulile9738
      @mirriamjulile9738 2 года назад

      MR Excel am still waiting for the tools pls

    • @MrXL
      @MrXL  2 года назад

      @@mirriamjulile9738 Here is the complete list of tools that I have published: ruclips.net/user/MrExcelcomsearch?query=lottery

  • @miguelll8754
    @miguelll8754 Год назад

    How does this need to be coded differently to work in Google Sheets? It won't work for me on there.

  • @darrylmorgan
    @darrylmorgan 3 года назад +1

    Really Neat VBA Code..Thank You Mr Excel :)

  • @servicesangleaccountants9410
    @servicesangleaccountants9410 2 года назад +1

    Hi Mr. Excel, I came across this tutorial searching for Combo mixes with no repeats and your presentation caught my eye. I am trying to run or create a report in excel that will give me all possible combinations with a list of 10 items each having 3 possible outcomes, how would you generate a list without repeating any combinations?

    • @MrXL
      @MrXL  2 года назад

      There are 59049 combinations. Here are the steps:
      1. Fill A1:J1 with Item 1, Item 2, Item 3, ... Item 10
      2. Fill B1:J2 with 1
      3. Formula in J3 is =IF(J2=3,0,J2)+1
      4. Formula in I3 is =IF(J3

  • @teclartizvigone5638
    @teclartizvigone5638 2 месяца назад

    Thank you for sharing

  • @b.prarthannanaik4788
    @b.prarthannanaik4788 Год назад

    Hello.. How to work in Emirates draw.. Lottery.. Plz tell me formula

  • @Mortal_Kombat__778
    @Mortal_Kombat__778 8 месяцев назад

    Can I still generate the combinations but have each number in its own cell?😢

  • @bingingwithcomicsnerd8069
    @bingingwithcomicsnerd8069 2 года назад

    Is there a way i can make a look up formula that finds permutation (in any order numbers)?

    • @MrXL
      @MrXL  2 года назад

      This is an interesting question. I can picture two different scenarios. Which one is yours?
      1) Do you mean that you want to point to a cell that contains 15-25-5-12-18 and it would say that this is a permutation of 5-12-15-18-25? Enter the five numbers in A1, and then use this formula: =TEXTJOIN("-",,SORT(TEXTSPLIT(A1,,"-")+0))
      2) Or do you want to pass five numbers 5-12-15-18-25 and generate all 120 possible permutations of those five numbers? This one is definitely not built into Excel. It could be done with VBA in Excel, but let me know if this is what you really want.

  • @zanderhuynh7998
    @zanderhuynh7998 2 года назад

    Is that possible write code to eliminate the past lottery number so we know which one have high probability?

    • @lottocombination6856
      @lottocombination6856 2 года назад

      yes it is possible but you don't need to mess with excel . contact me www.lottocombination.com

  • @MohammedAbdulhamid-vv9ks
    @MohammedAbdulhamid-vv9ks Год назад +1

    Hi MR Excel thank you for the great tutorial , we are following you from Norway I was wondering how can I modify the code if I only have 34 digits and want it to list all combinations of 7 digits? thank you in advance

  • @bearjew3915
    @bearjew3915 Год назад

    I need help please!!! How do i input for lottery 00-54???

    • @MrXL
      @MrXL  Год назад

      Is there really an option for "00" to be drawn? How many balls are selected?

  • @hirengson
    @hirengson 2 года назад

    I was doing word column combinations in my excel.
    And rows are continuing loding till now. So can I save it.. for stop loading rows and catch up already loaded rows. ?????

  • @cirej0506
    @cirej0506 Год назад

    Hello Guys! Can I have the script? Thank you!

  • @michaelhofmann6552
    @michaelhofmann6552 2 года назад

    How do I adopt to 1x49 like Canada 49

  • @mfariasnav
    @mfariasnav 2 года назад

    thanks for the video Mr Excel! ... the combination I need help with is for 14 numbers between 1 and 30.

    • @BillJelen
      @BillJelen 2 года назад +1

      Is this some sort of Keno game?
      Sub Choose14From30()
      TC = 1 ' ThisColumn
      TR = 1 ' ThisRow
      Ctr = 1 ' Ctr = 1
      MaxRows = Rows.Count
      Application.ScreenUpdating = False
      ' Last possible is 17-18-19-20-21-22-23-24-25-26-27-28-29-30
      For A = 1 To 17
      For B = (A + 1) To 18
      For C = (B + 1) To 19
      For D = (C + 1) To 20
      For E = (D + 1) To 21
      For F = (E + 1) To 22
      For G = (F + 1) To 23
      For H = (G + 1) To 24
      For I = (H + 1) To 25
      For J = (I + 1) To 26
      For K = (J + 1) To 27
      For L = (K + 1) To 28
      For M = (L + 1) To 29
      For N = (M + 1) To 30
      Cells(TR, TC).Value = A & "-" & B & "-" & C & "-" & D & "-" & E & "-" & F & "-" & G & "-" & H & "-" & I & "-" & J & "-" & K & "-" & L & "-" & M & "-" & N
      Ctr = Ctr + 1
      If Ctr > 99 Then Exit Sub
      If Ctr Mod 1000000 = 0 Then
      ThisWorkbook.Save
      End If
      TR = TR + 1
      If TR = MaxRows Then
      TR = 1
      TC = TC + 3
      End If
      Next N, M, L, K, J, I, H, G, F, E, D, C, B, A
      Application.StatusBar = False
      End Sub

    • @mfariasnav
      @mfariasnav 2 года назад

      @@BillJelen thx Mr Excel!! yeah is sort a keno game in a south american country... btw what videos or manuals do you recommend to learn VB from 0?

    • @MrXL
      @MrXL  2 года назад +1

      @@mfariasnav There is a great channel called ruclips.net/user/excelvbaisfun

  • @ChandoeBasti65
    @ChandoeBasti65 2 года назад

    how many people won already with this?

  • @PublicGin
    @PublicGin 2 года назад

    How can I use the same function for creating names instead using numbers

    • @PublicGin
      @PublicGin 2 года назад +1

      For example using a particular no of letters to auto generate possible names for example "a, c, d, g, h, y, o, p, q, m, n, g, l, v, x"

    • @MrXL
      @MrXL  2 года назад +1

      @@PublicGin This question would best be handled at the MrExcel board. It is free to register and post: www.mrexcel.com/board/

    • @PublicGin
      @PublicGin 2 года назад

      Will looking forward to here from you 👨‍🎓

  • @jongall76
    @jongall76 Год назад

    Hi MrExcel, I'm so glad I came across this video. Thank you so much for posting this information. We really do appreciate it. I have no issues with the initial VBA macro you created (6/44). I'm wondering, how would the VBA macro look if I wanted to find all different 5 number variation combos for 30 numbers, not in any particular number sequence. For example 1,3,6,10,18,27,31,39,43.... (The numbers are between 1 and 60 for this example). How would that VBA macro look? Thanks in advance, Sir!

    • @jongall76
      @jongall76 Год назад

      @MrXL Any help with this question would be greatly appreciated. Is my question easy to understand? If not, I have no problem rewording it. Thanks in advance!

    • @jongall76
      @jongall76 Год назад

      @MrXL Is this possible what I'm asking, Sir?

  • @stephenotoo6252
    @stephenotoo6252 2 года назад

    Amazing video. Please how can I get the combination from 1-50 in 5 sets instead of 6?

    • @MrXL
      @MrXL  2 года назад +3

      Sub Choose5From50()
      TC = 1 ' ThisColumn
      TR = 1 ' ThisRow
      Ctr = 1 ' Ctr = 1
      MaxRows = Rows.Count
      Application.ScreenUpdating = False
      ' Last possible is 46-47-48-49-50
      For a = 1 To 46
      For b = (a + 1) To 47
      For c = (b + 1) To 48
      For d = (c + 1) To 49
      For e = (d + 1) To 50
      Cells(TR, TC).Value = a & "-" & b & "-" & c & "-" & d & "-" & e
      Ctr = Ctr + 1
      If Ctr Mod 250000 = 0 Then
      ThisWorkbook.Save
      End If
      TR = TR + 1
      If TR = MaxRows Then
      TR = 1
      TC = TC + 1
      End If
      Next e, d, c, b, a
      Application.StatusBar = False
      End Sub

  • @donbill-xh7mg
    @donbill-xh7mg Год назад +1

    Thank for the video

  • @ysmith9336
    @ysmith9336 2 года назад

    How do I generate different combinations from a 4x11 grid of numbers? numbers only 0-9 are used. I have a list of different numbers but need all possible combinations.

    • @MrXL
      @MrXL  2 года назад +1

      How many numbers are you choosing? Is it one number from each row so four numbers are drawn?

  • @emanuelllee
    @emanuelllee 10 месяцев назад

    Where a can find the formula?

    • @summnerinformacao1069
      @summnerinformacao1069 4 месяца назад

      Ai mulher, ele não falou bo vídeo que iria ter na descrição

  • @eveceo7154
    @eveceo7154 Год назад

    What if I have 30 or less numbers what do you think the odds will be

    • @MrXL
      @MrXL  Год назад

      How many numbers are drawn?

  • @herntont
    @herntont 2 года назад

    The macro works, but why does it move so slow?

  • @jamijami7586
    @jamijami7586 Год назад

    How to get a lottey 6 digit number in between 1 to 29?

    • @MrXL
      @MrXL  Год назад

      Using Excel Online or Microsoft 365, enter this in A1: =SORT(TAKE(SORTBY(SEQUENCE(29),RANDARRAY(29)),6))
      Every time you press F9, you will get 6 new numbers.

    • @jamijami7586
      @jamijami7586 Год назад

      @@MrXLhow can I get full 6 digit numbers?

    • @MrXL
      @MrXL  Год назад

      If you have the newest version of Excel,@@jamijami7586 then the formula will return 6 numbers. I just tried it and it gave me 1, 2, 4, 16, 18, and 24.
      I press F9 and I then get 4, 15, 23, 25, 27, 29.
      This formula is using new functions that were introduced in November of 2022.
      If your Excel is older than that, you can try Excel Online.
      Steps:
      1. Open a new tab in a browser on your computer (Use Edge or Chrome)
      2. In the Address bar (not the search box), type Excel.New
      3. Copy this formula: =SORT(TAKE(SORTBY(SEQUENCE(29),RANDARRAY(29)),6))
      4. Paste in any cell in Excel

    • @jamijami7586
      @jamijami7586 Год назад

      @@MrXL I can understand your formula. If I will put this formula after I will press F9. It's generate one sequence again I press the F9 it's again give another sequence. But I want, if I put any formula in excel, It will show whole 6 digit number in between 1 to 29.
      I don't know, how many sequences in between 1 to 29. So pls I need while sequences. Help me.

  • @patriktoth9067
    @patriktoth9067 2 года назад +1

    Hi,
    I like your video.
    I have an excel spreadsheet for football bettings.
    10 matches. 59049 variations are possible.
    I want to write a program that can calculate all the possible variations automatically each time I add the teams and the odds to the spreadsheet. Home/Draw/Away
    Can you help me with this?

  • @anoopjugurnauth7881
    @anoopjugurnauth7881 2 года назад

    Hello Bill,anoop here. You know i have been searching these since 7 yrs.shane that i don't have a computer and not enough computer literate.is possible for tou to calculate that possibilities for feom.1 to 40 please it will be a great help for and the kids for the orphanage that am working for. Thank you in advance.

  • @PlayLogicalSims
    @PlayLogicalSims 2 года назад

    Is there a way of finding all possible combinations for specific numbers? For example, 16,21,35,6 could be 6-16-21-35 or 21-35-6-16.

    • @MrXL
      @MrXL  2 года назад +1

      Those are called Permutations instead of Combinations. Excel offers =PERMUT to count them. But I don't have code to create them. You might try posting a new thread at www.mrexcel.com/board/forums/excel-questions.10/

  • @emanuelllee
    @emanuelllee 10 месяцев назад

    pODERIA POR FAVOR COMPARTILHAS A FORMULA? OBRIGADA

  • @arvinlacanlale1504
    @arvinlacanlale1504 Год назад

    Greetings Mr. Excel!
    Do you have a formula for 6-42 all combinations? I'm willing to pay. Thank you and more power. God bless!

  • @LowkeyMAGICCHESS
    @LowkeyMAGICCHESS Год назад

    hmm, why i'm only getting up to 24999 rows only? need help please

    • @MrXL
      @MrXL  Год назад

      Make the workbook is saved with a name before you run the macro. The program tries to do an AutoSave at row 25000. If the workbook doesn’t already have a path and file name it could stop there.

  • @lisagust3806
    @lisagust3806 2 года назад

    Mr. Excel. Instead of aggregating all possible number combinations at one time. Is there a way to aggregate only the possible number combinations starting with 1. So for example in 5 digit combination 1 to 70, which only start with 1. I would like to create a separate page for combinations starting with 1, then another page for combinations starting with 2, etc. Also, the way the code suggested here populated each number combination in column a (1-2-3-4-5). Is there a way to generate the number combination where the combinations are generated as A - 1, B-2, C-3, D-4, E-5? I believe if these methods could be utilized it would make it easier to disseminate the data.

    • @BillJelen
      @BillJelen 2 года назад +1

      Let's start with your second question. In many of these lottery systems, we are generating 40 million cells. If you would instead list them into five columns, then you are generating 200 million cells and it is far more likely that you will need 64-bit Excel. You can see many comments from people who have a machine that is stopping long before the program can run because they are running 32-bit Excel with not enough memory. If you use 5 cells instead of 1 then it dies much sooner.
      Second, it is very easy to later split the data into multiple columns. Choose a range of interest - perhaps A2:A50000. In Excel, click the Data tab along the top. Just over half way across, there is a tool called Text To Columns. Select that tool. In Step 1, choose Delmited and click Next. In Step 2, unselect Tab. Choose Other. In the Other box, type a hyphen. Click Finish.
      Third, if you really want to build the worksheet with the numbers in five columns, you would replace this line:
      Cells(TR, TC).Value = A & "-" & B & "-" & C & "-" & D & "-" & E
      With This
      Cells(TR, TC).Resize(1, 5).Value = array(A, B, C, D, E)
      Later in the macro, change this line:
      TC = TC + 3
      to
      TC = TC + 7
      For the first question, I don't currently have that code. It is a bit more complex than what I would write for free. What would you think about generating 66 different workbooks? Trying to put 66 large worksheets in one workbook is going to run into memory issues.

    • @lisagust3806
      @lisagust3806 2 года назад

      @@BillJelen Thanks for your reply. I ran the program you made available here. I will use it when I transfer my data to my other lottery workbook. I ran into the problem of memory. So I am wondering if after I transfer my data and delete it. Is there a way to start the list of lottery numbers where the program stopped due to insufficient memory?

    • @MrXL
      @MrXL  2 года назад +1

      @@lisagust3806 Let's say that the last number before the memory problem was 4-8-12-16-21
      You could have the program skip all of the groups starting with 1, 2, and 3 by changing this line of code:
      For a = 1 to 31
      to be
      For a = 4 to 31
      You would still get duplicates starting with 4-5-6-7-8 up through 4-8-12-16-21.
      If you are running out of memory before you get all the way through the numbers that start with 1, then I it would be harder to restart.

  • @Nikkie_therussian
    @Nikkie_therussian 2 года назад

    What would be the formula to do this for the daily 3 numbers?

    • @MrXL
      @MrXL  2 года назад

      Sub ListThemAll
      TR = 2
      for a = 0 to 9
      for b = 0 to 9
      for c = 0 to 9
      Cells(TR, 1).Value = a & "-" & b & "-" & c
      TR = TR + 1
      Next c
      Next b
      Next a
      End Sub

    • @Nikkie_therussian
      @Nikkie_therussian 2 года назад

      @@MrXL Thank you so much for getting back to me. One more question if I could but how could I input previous winning numbers and use that algorithm to find the next possible numbers

    • @MrXL
      @MrXL  2 года назад

      I just have the Excel skills,@@Nikkie_therussian . If I had the winning algorithm, I sure wouldn't post it in a public video because then everyone would win and it would dilute the jackpot pool.
      Many people have hired me over the last decades to write the Excel formulas to calculate algorithms that they invent. Those are all confidential and I can't share them.

    • @Nikkie_therussian
      @Nikkie_therussian 2 года назад

      @@MrXL I understand. Thank you anyways!

  • @TammyloveEnterprises
    @TammyloveEnterprises 2 года назад

    Mr. Excel, I tried to to this with a 5 numbers 1-69 without a powerball and something went haywire. I believe there should be 11,238,513 combinations. Can you explain how to alter the formula for just the 5 number without the 6th powerball number please & thank you.

    • @MrXL
      @MrXL  2 года назад +1

      I agree with your 11,238,513. Here is the code to generate it:
      Sub Choose5From69()
      TC = 1 ' ThisColumn
      TR = 1 ' ThisRow
      Ctr = 1 ' Ctr = 1
      ' 5 of 69 will generate 11,238,513 combinations
      ' according to =COMBIN(69,5)
      MaxRows = Rows.Count
      Application.ScreenUpdating = False
      ' Last possible is 65-66-67-68-69
      For a = 1 To 65
      For b = (a + 1) To 66
      For c = (b + 1) To 67
      For d = (c + 1) To 68
      For e = (d + 1) To 69
      Cells(TR, TC).Value = a & "-" & b & "-" & c & "-" & d & "-" & e
      Ctr = Ctr + 1
      If Ctr Mod 25000 = 0 Then
      ThisWorkbook.Save
      End If
      TR = TR + 1
      If TR = MaxRows Then
      TR = 1
      TC = TC + 1
      End If
      Next e, d, c, b, a
      Application.StatusBar = False
      End Sub

    • @TammyloveEnterprises
      @TammyloveEnterprises 2 года назад

      @@MrXL thank you

  • @montanam2464
    @montanam2464 2 года назад

    this code you are using is different than the one down you copied. i cant see the last possible line?

    • @MrXL
      @MrXL  2 года назад

      The last two lines of code are:
      Application.StatusBar = False
      End Sub

  • @Barca331
    @Barca331 10 месяцев назад

    Can you replay me the code “ listthemAll” didn’t work for me

  • @omarelsharief
    @omarelsharief 2 года назад

    Hi Mr Excel, I love your videos, this one got me interested, my question is what if I had to choose a 7 number combination of the numbers 1 to 44 what will the code be

    • @MrXL
      @MrXL  2 года назад

      Choosing 7 from 44 is a lot of numbers.... over 38 million. This will most likely crash Excel before it finishes (unless you are running 64-bit Excel with 16 or 32 GB of RAM).
      Sub ListFrom44Choosing7()
      TC = 1 ' ThisColumn
      TR = 1 ' ThisRow
      Ctr = 1 ' Ctr = 1
      MaxRows = Rows.Count
      Application.ScreenUpdating = False
      ' Last possible is 44-43-42-41-40-39-38
      For a = 1 To 38
      For b = (a + 1) To 39
      For c = (b + 1) To 40
      For d = (c + 1) To 41
      For e = (d + 1) To 42
      For f = (e + 1) To 43
      For g = (f + 1) To 44
      Cells(TR, TC).Value = a & "-" & b & "-" & c & "-" & d & "-" & e & "-" & f & "-" & g
      Ctr = Ctr + 1
      If Ctr = 100 Then Exit Sub
      If Ctr Mod 100000 = 0 Then
      ThisWorkbook.Save
      End If
      TR = TR + 1
      If TR = MaxRows Then
      TR = 1
      TC = TC + 1
      End If
      Next g, f, e, d, c, b, a
      Application.StatusBar = False
      End Sub

    • @omarelsharief
      @omarelsharief 2 года назад +1

      @@MrXL Thank you very much for this MrExcel 🤩. The PC am using is a 16gig ram I hope it wont melt 😅

  • @AmaKonadu-i5i
    @AmaKonadu-i5i Год назад

    Can I chart

  • @chrism9037
    @chrism9037 3 года назад +1

    Amazing, thanks Mr Excel!

    • @MrXL
      @MrXL  3 года назад

      Glad you liked it!

  • @seyonpollard9311
    @seyonpollard9311 2 года назад

    How do I calculate the combination for lottery numbers 01 to 39 and in 5 set. Numbers can Not be repeated.
    eg.- 01-13-24-29-38

    • @MrXL
      @MrXL  2 года назад

      Sub ListThemAll35()
      TC = 1 ' ThisColumn
      TR = 1 ' ThisRow
      Ctr = 1 ' Ctr = 1
      MaxRows = Rows.Count
      Application.ScreenUpdating = False
      ' Last possible is 39-38-37-36-35
      For a = 1 To 35
      For b = (a + 1) To 36
      For c = (b + 1) To 37
      For d = (c + 1) To 38
      For e = (d + 1) To 39
      Cells(TR, TC).Value = a & "-" & b & "-" & c & "-" & d & "-" & e
      Ctr = Ctr + 1
      If Ctr Mod 25000 = 0 Then
      ThisWorkbook.Save
      End If
      TR = TR + 1
      If TR = MaxRows Then
      TR = 1
      TC = TC + 1
      End If
      Next e, d, c, b, a
      Application.StatusBar = False
      End Sub

  • @sheroafridi1112
    @sheroafridi1112 2 года назад

    Can i make every 7 number combinition upto 44

    • @MrXL
      @MrXL  2 года назад

      Be aware that there are 38 million combinations. This will likely require over 40 hours to run on a very fast PC.
      Sub ListFrom44Choosing7()
      TC = 1 ' ThisColumn
      TR = 1 ' ThisRow
      Ctr = 1 ' Ctr = 1
      MaxRows = Rows.Count
      Application.ScreenUpdating = False
      ' Last possible is 44-43-42-41-40-39-38
      For a = 1 To 38
      For b = (a + 1) To 39
      For c = (b + 1) To 40
      For d = (c + 1) To 41
      For e = (d + 1) To 42
      For f = (e + 1) To 43
      For g = (f + 1) To 44
      Cells(TR, TC).Value = a & "-" & b & "-" & c & "-" & d & "-" & e & "-" & f & "-" & g
      Ctr = Ctr + 1
      If Ctr Mod 500000 = 0 Then
      ThisWorkbook.Save
      End If
      TR = TR + 1
      If TR = MaxRows Then
      TR = 1
      TC = TC + 1
      End If
      Next g, f, e, d, c, b, a
      Application.StatusBar = False
      End Sub

  • @11rsort
    @11rsort Год назад

    Very good video, I liked it

  • @kat5232
    @kat5232 Год назад

    Hi Mr excel hope your well, I have a question , what are the odds of choosing 5 correct numbers on a pick 5 entry playing 100 games?

    • @MrXL
      @MrXL  Год назад +1

      In a Pick 5 game where you choose five digits from 0 to 9, the odds of a single straight bet being correct are one in 100,000.
      If you play 100 games, the odds of one of them being correct are one in 1000.
      If you choose 5 different digits and box them, (known as a 120-way box), then the odds of a single ticket winning are 1 in 833. If you play this game 100 times, then you have a one in 8.33 odds of winning. The payout for a $1 bet is $416.

  • @williamwoodward2632
    @williamwoodward2632 2 года назад

    Is there a way to list all permutations given data multiple columns? An example would be, there are 5 slots and the data for those slots exist in multiple columns and there is a different number of data points per column. I want to list all permutations. Is this even a thing? Edit: Thank you

  • @gamecasters7935
    @gamecasters7935 3 года назад

    This is nice but is there a way in Excel to find how many combinations are in a range of sums. So if i wanted to see which combinations are in the sum range of 100, could you make excel list all those combinations in that specific range of sums? That would be really useful to me.

    • @MrXL
      @MrXL  3 года назад +2

      The only way that I can think of doing this is to run the macro in this video. Add a new column to the right that does the SUM. Then use Data, Filter to look for combinations that match 100 or any number.

  • @ntombifuthilukhele9838
    @ntombifuthilukhele9838 2 года назад

    hey Mr Excel been trying this lottery combination but only one row is generated until 24999 only I waited for more than an hour but still nothing. how do I know its working or not because its been hours but still only one row

    • @MrXL
      @MrXL  2 года назад

      Here is my trick. The macro is set to save every 25000 rows. I open Windows Explorer and set the View to Details. In this view, you can see the last date and time the workbook is saved. Start the macro running. Watch for the file date and time to update.

    • @ntombifuthilukhele9838
      @ntombifuthilukhele9838 2 года назад

      Hello Mr Excel. I have tried this it is still not working 😭. Please help me how to do it please please. I have been trying do many times but nothing still. Any alternative way or something I can do ?

  • @leonardoclaudianopaesbarre1444
    @leonardoclaudianopaesbarre1444 2 года назад

    Hello Mr Excel! Please Can You Tell me How can I compare the combinations generated in the form presented a-b-c-d-e with the lottery results that are numbers presented in separate cells in order to determine which combinations are winning?

  • @shonnellYouCantHandlethetruth
    @shonnellYouCantHandlethetruth 2 года назад

    Can I ask if it's possible for something that I made up but can't get it to work properly

    • @shonnellYouCantHandlethetruth
      @shonnellYouCantHandlethetruth 2 года назад

      Can you take a look at it for me

    • @MrXL
      @MrXL  2 года назад +1

      @@shonnellYouCantHandlethetruth Sure. How can you get me the workbook? I went to your "About" page to find your e-mail, but you don't list it there. Go to my About page, scroll down, and you can find my e-mail. Send me the example.

  • @rdl5043
    @rdl5043 2 года назад

    Hi Mr. Excel, thanks for the video. If you had a list of 24 names and you wanted to generate all possible 6 name combinations, how would you generate a list without repeating any combinations?

    • @MrXL
      @MrXL  2 года назад +1

      Hi Ryan
      First - in any cell, enter =COMBIN(24,6) and press Enter. This will tell you there will be 134,596 combinations of 24 names.
      To generate the names:
      List the 24 names in cells A1 through A24.
      Run this macro:
      Sub List24NamesChosenBy6()
      TR = 1 ' ThisRow
      Application.ScreenUpdating = False
      ' Last possible is 19-0-21-22-23-24
      For a = 1 To 19
      For b = (a + 1) To 20
      For c = (b + 1) To 21
      For d = (c + 1) To 22
      For e = (d + 1) To 23
      For f = (e + 1) To 24
      Cells(TR, 3).Value = Cells(a, 1).Value
      Cells(TR, 4).Value = Cells(b, 1).Value
      Cells(TR, 5).Value = Cells(c, 1).Value
      Cells(TR, 6).Value = Cells(d, 1).Value
      Cells(TR, 7).Value = Cells(e, 1).Value
      Cells(TR, 8).Value = Cells(f, 1).Value
      TR = TR + 1
      Next f, e, d, c, b, a
      Application.ScreenUpdating = True
      End Sub
      On my machine, it takes about 46 seconds to run and generates all combinations in C1:H134596.

    • @lottocombination6856
      @lottocombination6856 2 года назад

      maybe it will work for you; www.lottocombination.com

    • @MartinBordeleau
      @MartinBordeleau 2 года назад

      @@MrXL What would be the difference if I was to put the names through A4 to A27? I did not figure out where it's taken into consideration in your script. Thank you so much!

    • @MartinBordeleau
      @MartinBordeleau 2 года назад

      Sub List20NamesChosenBy6()
      TR = 29 ' ThisRow
      Application.ScreenUpdating = False
      ' Last possible is 15-16-17-18-19-20

      For a = 4 To 18
      For b = (a + 1) To 19
      For c = (b + 1) To 20
      For d = (c + 1) To 21
      For e = (d + 1) To 22
      For f = (e + 1) To 23
      Cells(TR, 2).Value = Cells(a, 1).Value
      Cells(TR, 3).Value = Cells(b, 1).Value
      Cells(TR, 4).Value = Cells(c, 1).Value
      Cells(TR, 5).Value = Cells(d, 1).Value
      Cells(TR, 6).Value = Cells(e, 1).Value
      Cells(TR, 7).Value = Cells(f, 1).Value
      TR = TR + 1
      Next f, e, d, c, b, a

      Application.ScreenUpdating = True

      End Sub
      I think I got it. Does it make sense?

  • @ranjansarkar2081
    @ranjansarkar2081 Год назад +1

    Many many thanks sir.

  • @wayumba1
    @wayumba1 3 года назад

    Hello MrExcel, can this code be edited for numbers from 0 to 49

    • @MrXL
      @MrXL  3 года назад

      At 1:48, there are six lines of code ending in 39, 40, 41, 42, 43, and 44.
      Edit those to end in 44, 45, 46, 47, 48, and 49 instead:
      For a = 1 to 44
      For b = (a+1) to 45
      For c = (b+1) to 46
      For d = (c+1) to 47
      For e = (d+1) to 48
      For f = (e+1) to 49

    • @lottocombination6856
      @lottocombination6856 2 года назад

      maybe it will work for you; www.lottocombination.com

  • @hemrajpokhrel12
    @hemrajpokhrel12 2 года назад

    can you provide me all combination sir??

    • @MrXL
      @MrXL  2 года назад

      No I don’t sell the data. I only provide instructions on how you can generate the data.

  • @preesha5815
    @preesha5815 9 месяцев назад

    it is more helpful for further study

  • @ricos1497
    @ricos1497 3 года назад +13

    I actually bought 7,059,051 lottery tickets once, and I didn't even win. What are the odds?

    • @drsteele4749
      @drsteele4749 3 года назад +7

      Using different numbers for each ticket might have helped. D'oh.

    • @MrXL
      @MrXL  3 года назад +15

      Next time you do this, please let me know the one ticket you didn't buy!

    • @ladyshenna967
      @ladyshenna967 2 года назад +4

      How is that even possible?

    • @lottocombination6856
      @lottocombination6856 2 года назад

      7 million !! I wish I had known when you were going to try such an option. Let me prepare 2 million options for you. Our chance of winning would be 70%. cantact me : www.lottocombination.com

    • @hemrajpokhrel12
      @hemrajpokhrel12 2 года назад +1

      @@MrXL can you provide all posible combination of 6/45 lotto. if posible please replay sir

  • @garfieldbarrette9171
    @garfieldbarrette9171 Год назад +1

    Mr excel i wish you were in my country i would be a millionaire, i just can't find a person who knew how to do a excel sheets .

  • @OneAndDone5150
    @OneAndDone5150 Год назад +2

    Wait you didn’t give the winning numbers 😢

    • @MrXL
      @MrXL  Год назад +1

      Giving the winning numbers would mean that a million people share the jackpot and everyone gets a few dollars. I am convinced the key is to come up with a method that no one else is using. That way, when you hit, you are the only one with the numbers and the jackpot is not split.

    • @OneAndDone5150
      @OneAndDone5150 Год назад

      @@MrXL no to me …not you but great point. What iron some have won 3/4 times.

  • @besthifisystem6511
    @besthifisystem6511 2 года назад

    Hi Mr. Excel! Can you please help me? I need a code for a lottery which requires 6 numbers out from 1 to 58. I know that it has 40 million+ combinations, and it will surely take many hours to run, but it will be worth it as a guide for me in winning this. Thank you!

    • @MrXL
      @MrXL  2 года назад

      If you study this code compared to the code in the video, can you see the simple changes you need to have the numbers end at 58?
      Sub Choose6From58()
      TC = 1 ' ThisColumn
      TR = 1 ' ThisRow
      Ctr = 1 ' Ctr = 1
      MaxRows = Rows.Count
      Application.ScreenUpdating = False
      ' Last possible is 58-57-56-55-54-53
      For a = 1 To 53
      For b = (a + 1) To 54
      For c = (b + 1) To 55
      For d = (c + 1) To 56
      For e = (d + 1) To 57
      For f = (e + 1) To 58
      Cells(TR, TC).Value = a & "-" & b & "-" & c & "-" & d & "-" & e & "-" & f
      Ctr = Ctr + 1
      If Ctr Mod 1000000 = 0 Then
      ThisWorkbook.Save
      End If
      TR = TR + 1
      If TR = MaxRows Then
      TR = 1
      TC = TC + 3
      End If
      End If
      Next f, e, d, c, b, a
      Application.StatusBar = False
      End Sub

    • @besthifisystem6511
      @besthifisystem6511 2 года назад

      @@MrXL thanks a lot! does this work on my excel 2016 version?

    • @MrXL
      @MrXL  2 года назад

      @@besthifisystem6511 the code runs in 2016. The only issue might be that you need 64-but Excel and likely 16 GB of RAM to store 40 million cells.

    • @besthifisystem6511
      @besthifisystem6511 2 года назад

      @@MrXL I've tried it on my laptop which has only 4 GB of ram and run it for about 30 minutes then I've got 25 million combinations but the pc was throttling, and I've stopped the process and decided to rerun it when I'm not busy in editing some projects.

    • @peterparker2981
      @peterparker2981 2 года назад

      @@MrXL Hi MrExcel! Great job with the excel btw. I want to know if the code above can be sequenced in normal counting order for those 6 numbers or they will be all mixed?

  • @alvinclark1370
    @alvinclark1370 2 года назад

    Could I hire someone to make every 5 number combination for me from 1-43. So I can print it out and keep in a binder.

    • @MrXL
      @MrXL  2 года назад

      Sure - drop me a note to Pub@MrExcel.com.

    • @lottocombination6856
      @lottocombination6856 2 года назад

      maybe it will work for you; www.lottocombination.com

  • @marioboom4878
    @marioboom4878 Год назад +1

    Merci ! excellent

  • @MrSunshanmu
    @MrSunshanmu 2 года назад

    HI MR Excel, thank you for the tutorial, it's great. I was wondering how I should modify the code if I only had 35 numbers and wanted it to list all the combinations of 5 numbers? Thank you in advance.

    • @MrXL
      @MrXL  2 года назад +1

      Are the numbers 1 to 35? Use this:
      Sub ListThemAll35()
      TC = 1 ' ThisColumn
      TR = 1 ' ThisRow
      Ctr = 1 ' Ctr = 1
      MaxRows = Rows.Count
      Application.ScreenUpdating = False
      ' Last possible is 31-32-33-34-35
      For a = 1 To 31
      For b = (a + 1) To 32
      For c = (b + 1) To 33
      For d = (c + 1) To 34
      For e = (d + 1) To 35
      Cells(TR, TC).Value = a & "-" & b & "-" & c & "-" & d & "-" & e
      Ctr = Ctr + 1
      If Ctr Mod 25000 = 0 Then
      ThisWorkbook.Save
      End If
      TR = TR + 1
      If TR = MaxRows Then
      TR = 1
      TC = TC + 1
      End If
      Next e, d, c, b, a
      Application.StatusBar = False
      End Sub
      Or are you in a system where you need to select 5 numbers from 1 to 60 and you have 35 of those that seem hot at the moment? In that case, it would be easiest if you listed the 35 hot numbers in A1:A35 of Sheet2 and Sheet1 was blank for the combination of numbers. Let me know if this is your situation.

    • @reparationcles7262
      @reparationcles7262 2 года назад

      Hello everyone, I am looking for a way in Excel to generate five million possibilities from 1 to 49 (6 chiffres)

    • @lottocombination6856
      @lottocombination6856 2 года назад

      maybe it will work for you; www.lottocombination.com

  • @renegadek9
    @renegadek9 3 года назад +1

    Awesome, from Port Orange.

    • @MrXL
      @MrXL  3 года назад

      Greetings from just down the coast!

  • @barthbriders4364
    @barthbriders4364 Год назад +1

    Bonjour
    J’ai utilisé cette méthode selon votre explication sauf que j’y arrive toujours pas à chaque fois l’action est interrompue
    Si quelqu’un pouvait le faire et me l’envoyer en fichier PDF, un tirage 6 boules sur 32 sans remise sa donne 906 192 combinaisons possibles.
    Merci pour votre diligence

  • @abdelhakimkassi2872
    @abdelhakimkassi2872 13 дней назад

    Some one have the script pleas ?

  • @toryglen
    @toryglen 2 года назад

    Rather than list ALL combinations:
    What is required is (a spreadsheet or program)
    which returns the required set of numbers,
    based on a position (in your example 1 to 7,059,052) and vice versa:
    For example
    Based on 6/44 (7,059,052)
    Position 6,000,000 = 12 14 21 23 26 28
    Set 20 25 30 35 40 44 = 6,911,737
    And for the current MegaMillions (5/70 + 1/25) (302,575,349)
    Position 6,000,000 = 01 07 14 23 34 + (25)
    Set 20 25 30 35 40 + (05) = 245,618,830
    etc.

    • @MrXL
      @MrXL  2 года назад

      In cells A1:A10, put 10 position numbers. For example, 6000000 in A1. 6911737 in A2. And then any other position numbers in A3 to A10.
      Sub StoreInArray()
      Ctr = 1
      Dim Res(7059053)
      For a = 1 To 39
      Application.StatusBar = a & " on way to 39"
      For b = (a + 1) To 40
      For c = (b + 1) To 41
      For d = (c + 1) To 42
      For e = (d + 1) To 43
      For f = (e + 1) To 44
      Res(Ctr) = a & "-" & b & "-" & c & "-" & d & "-" & e & "-" & f
      Ctr = Ctr + 1
      Next f
      Next e
      Next d
      Next c
      Next b
      Next a
      ' For the numbers in A1:A10, fill in the results in B
      For i = 1 To 10
      Cells(i, 2).Value = Res(Cells(i, 1).Value)
      Next i
      Application.StatusBar = False
      Application.ScreenUpdating = True
      End Sub
      Run the macro. It takes about 40 seconds to load the array and then report the results in B1:B10.

  • @MrBrown-ml3lf
    @MrBrown-ml3lf 2 года назад

    Can you give me the formula for fantasy 5 with the sequence of 1-36 with 376992 possibilities please.

    • @MrXL
      @MrXL  2 года назад +1

      Choosing 5 from 1 to 36:
      Sub Choose5From36()
      TC = 1 ' ThisColumn
      TR = 1 ' ThisRow
      Ctr = 1 ' Ctr = 1
      MaxRows = Rows.Count
      Application.ScreenUpdating = False
      ' Last possible is 32-33-34-35-36
      For a = 1 To 32
      For b = (a + 1) To 33
      For c = (b + 1) To 34
      For d = (c + 1) To 35
      For e = (d + 1) To 36
      Cells(TR, TC).Value = a & "-" & b & "-" & c & "-" & d & "-" & e
      Ctr = Ctr + 1
      If Ctr Mod 25000 = 0 Then
      ThisWorkbook.Save
      End If
      TR = TR + 1
      If TR = MaxRows Then
      TR = 1
      TC = TC + 1
      End If
      Next e, d, c, b, a
      Application.StatusBar = False
      End Sub

    • @MrBrown-ml3lf
      @MrBrown-ml3lf 2 года назад +2

      Thank you so much Mr excel

  • @SivaKumar-mo9kg
    @SivaKumar-mo9kg 2 месяца назад

    Please send vba code

  • @TomyCroSound
    @TomyCroSound 2 года назад

    I changed the code and it doesn't work. I need it for 11/22. Then I will delete all that look like 1,2,3,4,5,6,7,8.. and 1,3,5,7,9, and 2,4,6,8 etc. Then deletion with the help of duplicates that have been extracted so far. That is idea.

    • @MrXL
      @MrXL  2 года назад

      Post your changed code in a reply here and I can troubleshoot it.

    • @TomyCroSound
      @TomyCroSound 2 года назад

      @@MrXL Unfortunately, I did not save the edited code. I'm not an expert in excel, so I would ask, if you have time, to set the code to list all possible combinations from 1-22, if a total of 11 numbers are drawn daily.

  • @jandalzz
    @jandalzz 2 года назад +2

    Has anyone done this and won or want to partner up with me

  • @AndreaVacca87
    @AndreaVacca87 2 года назад

    Hello, Mr. Excel. Thank you for the videos and the information. I like all your videos, and you have my subscription. After all the list of numbers, is it possible to remove, giving 6 digits, all the lines with 3 or more numbers in common? For example, I have all the possible combinations in excel; I want to insert 1-2-3-4-5-6, and now I want to eliminate all the lines that have 3 or more numbers in common. Thank you very much for your knowledge.

    • @MrXL
      @MrXL  2 года назад +1

      Let me make sure I have this correct.
      You will select a set of six numbers. Maybe 13-14-36-45-57-67. You want to eliminate all of the possibilities that would have matched 3 or more of those six numbers?
      What a great idea. But tough to do. Let me think about that one for a bit.

    • @AndreaVacca87
      @AndreaVacca87 2 года назад

      @@MrXL yes, thank you!

    • @MrXL
      @MrXL  2 года назад +1

      @@AndreaVacca87 I ran the macro this morning. It removed 179,494 of the 7,059,052 possible combinations, leaving 6,879,558 combinations left.
      Two things:
      1) Because it is difficult to parse the numbers out of a text value like "7-8-22-29-32-38", I chose to remove the numbers as I wrote the combinations to the sheet.
      2) There are six lines in the code where you have to edit the numbers from the last drawing. They look like this:
      LastDraw(1) = 2
      LastDraw(2) = 4
      LastDraw(3) = 17
      LastDraw(4) = 21
      LastDraw(5) = 24
      LastDraw(6) = 43
      In my case, the numbers to remove were 2-4-17-21-24-43. You can see how to change the code for your numbers to remove, right?
      Here is the new code:
      Sub ListThemAllUnlessThreeMatch()
      TC = 1 ' ThisColumn
      TR = 1 ' ThisRow
      Ctr = 1 ' Ctr = 1
      Dim LastDraw(1 To 6) As Integer
      ' Change these lines to show the numbers in the last drawing
      ' Logic below will eliminate any combinations that have three of these
      LastDraw(1) = 2
      LastDraw(2) = 4
      LastDraw(3) = 17
      LastDraw(4) = 21
      LastDraw(5) = 24
      LastDraw(6) = 43
      MaxRows = Rows.Count
      Application.ScreenUpdating = False
      ' Last possible is 39-40-41-42-43-44
      For a = 1 To 39
      For b = (a + 1) To 40
      For c = (b + 1) To 41
      For d = (c + 1) To 42
      For e = (d + 1) To 43
      For f = (e + 1) To 44
      MatchCtr = 0
      ' Count how many match the LastDraw
      For j = 1 To 6
      If a = LastDraw(j) Then MatchCtr = MatchCtr + 1
      If b = LastDraw(j) Then MatchCtr = MatchCtr + 1
      If c = LastDraw(j) Then MatchCtr = MatchCtr + 1
      If d = LastDraw(j) Then MatchCtr = MatchCtr + 1
      If e = LastDraw(j) Then MatchCtr = MatchCtr + 1
      If f = LastDraw(j) Then MatchCtr = MatchCtr + 1
      Next j
      If MatchCtr < 3 Then
      Cells(TR, TC).Value = a & "-" & b & "-" & c & "-" & d & "-" & e & "-" & f
      Ctr = Ctr + 1
      If Ctr Mod 2500000 = 0 Then
      ThisWorkbook.Save
      End If
      TR = TR + 1
      If TR = MaxRows Then
      TR = 1
      TC = TC + 1
      End If
      End If
      Next f, e, d, c, b, a
      Application.StatusBar = False
      End Sub
      Good luck!

    • @AndreaVacca87
      @AndreaVacca87 2 года назад

      @@MrXL Thank you so much, you're the best.

    • @AndreaVacca87
      @AndreaVacca87 2 года назад

      @@MrXL What if I want to remove multiple drawings?