Check betting sets

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,422
Office Version
  1. 2010
Hello,


I have a question I want to check my betting sets with all the results one by one and if matches greater than 10, 11, 12, 13, 14 filter those rows and copy paste them in another sheet one below another.


Data sheet is holding Results in the Columns C:P, Betting sets in the Columns R:AE, I am using formula in cell AF6 = SUMPRODUCT(--($C$6:$P$6=R6:AE6)) copied down to AF55 once match result are calculated I just filter AF row grater than 9 and copy data in sheet "Match Result"
Check for the next row match results I change the formula AF6 = SUMPRODUCT(--($C$7:$P$7=R6:AE6)) copied down to AF55 and repeat the process filter AF row grater than 9 and copy data in sheet "Match Result"

Is there any way it could be auto mechanize to check all result with betting sets and filter the matches and put them in the sheet "Match Result"

Sheet Data

Book1
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
1
2
3
4NYearn1n2n3n4n5n6n7n8n9n10n11n12n13n14EM1n1n2n3n4n5n6n7n8n9n10n11n12n13n14Match
5NYearn1n2n3n4n5n6n7n8n9n10n11n12n13n14EM1n1n2n3n4n5n6n7n8n9n10n11n12n13n14Match
612001111111111221111111111111111112
722001X11121212X11X1X2XX111X2112124
832001XX21XX1121X211X2X22X1121X2X22
942001211X21X1122111111221211221X110
10520011X1X11211XXX112X1X211122211X8
1162001X2XX2X11211112X1XX21X11222217
1272001X112111211X1X11X11211121XX217
13X1121212X2X1118
14112111X1122X1X10
15121X1X2X1XXX215
162212111X211X116
1712XX2X212X111X4
18111112X22211119
19X11221X22X11XX4
20221211121111217
21XX1X1121112X127
22112111X1122X1X10
2312X1211X11X1118
24212X2XX212211X6
25X2X12121XX11X24
26XXX1X1X11111117
271111XX111212X19
281XX1X1111212X18
29XX2X111111X2117
30X111XXX11111X26
31XX12XX11X1X2124
3212X11XX12111X16
33111211X111X2X18
34112XX1121111X17
35XX1111212X21XX7
36111211X111X2X18
37XX2X111111X2117
381X1X211X1X2X118
3921X1X111X2X1119
40X22121212211216
4111122111111X128
4221X121X2122X118
43111X1X1111212X9
44X1112121XXXXX25
452X121X21111X116
461211X221X111126
471111XX1211212X8
48XX111X12121X118
49X111XX211XX1118
5011XX1X2111XX117
511111222XXX11X16
52121112X21121218
53111221211221X110
54XX12X1111X11217
55112X121X111X117
Data


Sheet Match Result

Book1
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
1
2
3
4NYearn1n2n3n4n5n6n7n8n9n10n11n12n13n14EM1n1n2n3n4n5n6n7n8n9n10n11n12n13n14Match
5NYearn1n2n3n4n5n6n7n8n9n10n11n12n13n14EM1n1n2n3n4n5n6n7n8n9n10n11n12n13n14Match
612001111111111221111111111111111112
7111221211221X110
8112111X1122X1X10
9112111X1122X1X10
10111221211221X110
11
1222001X11121212X11X1X11221X22X11XX10
13X2X12121XX11X210
14XX1111212X21XX10
15X221212122112110
16X1112121XXXXX210
171111222XXX11X110
18
1932001XX21XX1121X211XX2X111111X21110
20XX12XX11X1X21210
21XX2X111111X21110
22
2342001211X21X1122111XX2X111111X21110
24XX12XX11X1X21210
25XX2X111111X21110
26
27520011X1X11211XXX11XX2X111111X21110
28XX12XX11X1X21210
29XX2X111111X21110
30
3162001X2XX2X11211112XX2X111111X21110
32XX12XX11X1X21210
33XX2X111111X21110
34
3572001X112111211X1X1XX2X111111X21110
36XX12XX11X1X21210
37XX2X111111X21110
Match Result


Thank you all
Excel 2000
Regards,
Moti
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Re: Check betting sets not sure is it possible.

Hello

I wrote:
I just filter AF row grater than 9 and copy data in sheet "Match Result"

But this is the correct procedure:
Sorry about error
, I just filter AF column (not the row) grater than 9 and copy the match rows in sheet "Match Result"

I have more than 1000 results to check and filter matches row and than copy them in to sheet "Match Result" which manually is not impossible but it is very difficult.

Please need a macro solution, which can do it for me this automatically.

Thank you
Moti
 
Upvote 0
Re: Check betting sets not sure is it possible.

Please any suggestions any solution with my query?
 
Last edited:
Upvote 0
Re: Check betting sets not sure is it possible.

Maybe this macro

Try it in a copy of your workbook

Code:
Sub aTest()
    Dim lastRowA As Long, lastNo As Long, rngToFilter As Range
    Dim i As Long, destRow As Long
    
    With Sheets("Data")
        lastRowA = .Cells(.Rows.Count, "A").End(xlUp).Row
        lastNo = .Cells(lastRowA, 1).Value
        Set rngToFilter = .Range("R5:AE" & .Cells(.Rows.Count, "R").End(xlUp).Row)
        .Range("AG5") = ""
    End With
        
    On Error Resume Next
    Sheets("Match Result").Select
    If Err.Number <> 0 Then
        Sheets.Add After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
        ActiveSheet.Name = "Match Result"
    End If
    On Error GoTo 0
    Cells.ClearContents
    Range("A4:AE5").Value = Sheets("Data").Range("A4:AE5").Value
    
    For i = 1 To lastNo
        Sheets("Data").Range("AG6").Formula = _
            "=SUMPRODUCT(--(INDEX($C$6:$P$" & lastRowA & "," & i & ",0)=R6:AE6))>9"
        destRow = Cells(Rows.Count, "R").End(xlUp).Row + 1
        If destRow > 6 Then destRow = destRow + 1
        Range("A" & destRow).Resize(, 16).Value = Sheets("Data").Range("A" & 5 + i).Resize(, 16).Value
        Range("A" & destRow).Resize(, 2).Font.Color = vbRed
        rngToFilter.AdvancedFilter _
            Action:=xlFilterCopy, CriteriaRange:=Sheets("Data").Range("AG5:AG6"), _
            CopyToRange:=Range("R" & destRow - 1).Resize(, 14), Unique:=False
        If destRow > 6 Then Range("R" & destRow - 1).Resize(, 14).ClearContents
    Next i
    Cells.HorizontalAlignment = xlCenter
End Sub

Hope this helps

M.
 
Upvote 0
Re: Check betting sets not sure is it possible.

Here is another macro for you to try...
Code:
[table="width: 500"]
[tr]
	[td]Sub CheckBettingSets()
  Dim Y As Long, S As Long, C As Long, NextRow As Long
  Dim YearData As Variant, SetData As Variant, Matches As Variant
  Const StartRow = 6
  YearData = Range(Cells(StartRow, "A"), Cells(Rows.Count, "P").End(xlUp))
  SetData = Range(Cells(StartRow, "R"), Cells(Rows.Count, "AE").End(xlUp))
  Cells(StartRow, "AF").Resize(UBound(SetData)).Clear
  With Sheets("Match Result")
    .Cells.Clear
    Range(Cells(StartRow - 2, "A"), Cells(StartRow - 1, "AF")).Copy .Cells(StartRow - 2, "A")
    For Y = 1 To UBound(YearData)
      ReDim Matches(1 To UBound(SetData), 1 To 1)
      For S = 1 To UBound(SetData)
        For C = 1 To UBound(SetData, 2)
          If YearData(Y, C + 2) = SetData(S, C) Then Matches(S, 1) = Matches(S, 1) + 1
        Next
        If Matches(S, 1) < 10 Then Matches(S, 1) = ""
      Next
      Cells(StartRow, "AF").Resize(UBound(Matches)) = Matches
      NextRow = .Cells(.Rows.Count, "R").End(xlUp).Offset(2).Row
      If NextRow = StartRow + 3 Then NextRow = NextRow - 1
      Cells(StartRow + Y - 1, "A").Resize(, UBound(YearData, 2)).Copy .Cells(NextRow, "A")
      .Cells(NextRow, "A").Resize(, UBound(YearData, 2)).HorizontalAlignment = xlCenter
      Intersect(Columns("R:AE"), Cells(StartRow, "AF").Resize(UBound(SetData)).SpecialCells(xlConstants).EntireRow).Copy .Cells(NextRow, "R")
      Cells(StartRow, "AF").Resize(UBound(SetData)).Clear
    Next
  End With
End Sub[/td]
[/tr]
[/table]
 
Upvote 0
Re: Check betting sets not sure is it possible.

Maybe this macro

Try it in a copy of your workbook

Hope this helps

M.
Marcelo Branco, Thank you very much!! That's exactly fine! This is what I was looking for to get all to be done at once.

After running the code I found errors in my data are shown in the Post1
Result nº4 I found only 3 matches. Your code found 6 matches, which are correct!
Result nº5 I found only 3 matches. Your code found 4 matches, which are correct!
Result nº7 I found only 3 matches. Your code found 4 matches, which are correct!

Appreciate a lot!! Your solution has saved a lot of time to me.

Regards
Moti


 
Upvote 0
Re: Check betting sets not sure is it possible.

Marcelo Branco, Thank you very much!! That's exactly fine! This is what I was looking for to get all to be done at once.

After running the code I found errors in my data are shown in the Post1
Result nº4 I found only 3 matches. Your code found 6 matches, which are correct!
Result nº5 I found only 3 matches. Your code found 4 matches, which are correct!
Result nº7 I found only 3 matches. Your code found 4 matches, which are correct!

Appreciate a lot!! Your solution has saved a lot of time to me.
Just wondering if you tried the code that I post or not? It differs from Marcelo's code in that it keeps the formatting from the original data.
 
Upvote 0
Re: Check betting sets not sure is it possible.

Marcelo Branco, Thank you very much!! That's exactly fine! This is what I was looking for to get all to be done at once.


You are very welcome.

After running the code I found errors in my data are shown in the Post1
Result nº4 I found only 3 matches. Your code found 6 matches, which are correct!
Result nº5 I found only 3 matches. Your code found 4 matches, which are correct!
Result nº7 I found only 3 matches. Your code found 4 matches, which are correct!

Yeah, I had noticed that, too. I'm glad my code generated the correct results! :)

M.
 
Upvote 0
Re: Check betting sets not sure is it possible.

Here is another macro for you to try...
Rick Rothstein, while replying to Marcelo Branco post I say your code and just fineshed to try it.

Also I admit my opening post result data are not correct, while your and Marcelo Branco macro are giving the perfect results.

I do appreciate your help and for giving an also nice solution.

Just wondering if you tried the code that I post or not? It differs from Marcelo's code in that it keeps the formatting from the original data.
Your code has some advantages, which I like.
1st-it it keeps the formatting from the original data. Which is helpful
2nd-it is not necessary to keep numbers in the column "A" 1 through increasing numbers like 1 to 1000. It works with broken series like I can set 1 to 25 for year 2001, 1 to 55 for year 2005 and so etc....it is fine.

Thank you very much for giving a time saying solution too.

Regards
Moti
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,876
Members
452,949
Latest member
Dupuhini

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