Lottery Odds for 2 most frequent numbers out of 5 as well as the 3 most frequent numbers out of 5

rebel123

Active Member
Joined
Apr 18, 2017
Messages
347
Office Version
  1. 365
Platform
  1. MacOS
Enclosed are examples of the Florida Lotto Fantasy 5 which is 5 numbers
from 1 thru 36.

I am trying to figure out which 2 numbers appear TOGETHER the most frequently
as well as the 3 numbers that appear TOGETHER the most frequently.

The data set is.

1. All time numbers- 9260 results
2. The last 5 year numbers- 1461 results


I need = sign formulas for the areas in green.
 

Attachments

  • Screen Shot 2021-08-01 at 5.26.05 PM.jpg
    Screen Shot 2021-08-01 at 5.26.05 PM.jpg
    126 KB · Views: 36
  • Screen Shot 2021-08-01 at 5.34.54 PM.jpg
    Screen Shot 2021-08-01 at 5.34.54 PM.jpg
    139.8 KB · Views: 35

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Also, MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are, without having to manually type it out. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Here is one approach for the pairs.

VBA Code:
Sub MostCommonPairs()
  Dim SL As Object, d As Object
  Dim a As Variant
  Dim i As Long, j As Long, uba2 As Long, x As Long, y As Long

  Set SL = CreateObject("System.Collections.Sortedlist")
  Set d = CreateObject("Scripting.Dictionary")
  a = Range("B2", Range("F" & Rows.Count).End(xlUp)).Value2
  uba2 = UBound(a, 2)
  For i = 1 To UBound(a)
    SL.Clear
    For j = 1 To uba2
      SL.Add a(i, j), a(i, j)
    Next j
    For x = 0 To uba2 - 2
      For y = x + 1 To uba2 - 1
        d(SL.GetByIndex(x) & ", " & SL.GetByIndex(y)) = d(SL.GetByIndex(x) & ", " & SL.GetByIndex(y)) + 1
      Next y
    Next x
  Next i
  SL.Clear
  For i = 1 To d.Count
      SL(d.Items()(i - 1)) = SL(d.Items()(i - 1)) & " | " & d.Keys()(i - 1)
  Next i
  Range("H2").Value = Mid(SL.GetByIndex(SL.Count - 1), 4)
  Range("I2").Value = d(Split(Range("H2").Value, " | ")(0)) & " of " & UBound(a)
End Sub

My sample data is in columns B:F and the above code produced the results in H2:I2

rebel123.xlsm
BCDEFGHI
1Ball 1Ball 2Ball 3Ball 4Ball 5Most Common PairsFrequency
226925101228, 31 | 12, 304 of 29
31122242920
43213172314
53152728
61230202729
773532510
8314263421
952918736
101621221215
11216292330
12313272519
13218293425
14212433201
15116341230
161411241230
17810201730
1823296519
19243620
20201231530
21312881135
2215164301
232814252
24191373035
252510142318
262514213036
27361392430
28282920185
29283114348
30363128329
31
Sheet1
 
Upvote 0
Solution
Hi Rebel,

Doesn't answer your question per se, but have you considered a heat amp? You can get yyour tep 5 or 10 list from there and visualize your "hottest" combinations.

In the data sheet, I split the balls into combinations

1627874132094.png


In the map sheet, I have 1-36 as row and col labels.

Formula for the array: =COUNTIF(Sheet2!$G$2:$J$10, $A2 & ";" & B$1)

Do note that these are one way matches (eg: 14;15 but not 15;14); It can be modified a bit to get two way matches (eg: 14:15 and 15:14)

Then, I applied a Top 10 Color set to the table.

1627874186901.png
 
Upvote 0
This is my Excel version.
 

Attachments

  • Screen Shot 2021-08-02 at 8.20.53 AM.jpg
    Screen Shot 2021-08-02 at 8.20.53 AM.jpg
    18.4 KB · Views: 17
Upvote 0
I do not know how to use VBA's which is why I was looking for an equals sign answer.
 
Upvote 0
I was looking for an equals sign answer.
I'm happy to be proven wrong, but I doubt you will get one which is why I suggested a vba approach.

I do not know how to use VBA's
To implement ..
1. With your workbook active press Alt+F11 to bring up the vba window.
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code provided into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Press Alt+F8 to bring up the Macro dialog
6. Select the 'MostCommonPairs' macro & click ‘Run’
7. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)
 
Upvote 0
Thanks for both of your replies, Peter and Richh. I have ab iMac so there is no ALT F11. I also tried
command F11
Option F11
Control F11
FN F11
Shift F11

and no luck
 
Upvote 0
The shortcut in the Mac version is Opt+F11 or Fn+Opt+F11. ;)
 
Upvote 0
Only way I can think of getting the top combos is parsing out each ball combination possible, then counting how many times the ball combos are made using helper columns in the data source.

Data file with paring formula: =IF(A2<B2,A2&";"&B2,B2&";"&A2)

1627929857827.png


Then, the tally sheet using COUNTIF: =COUNTIF(Sheet2!$G$2:$J$50,Sheet1!A2)

Pivot table used for quick sorting to get top combos

1627929949964.png
 
Upvote 0

Forum statistics

Threads
1,215,455
Messages
6,124,937
Members
449,196
Latest member
Maxkapoor

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top