Help with sum and countif

Samgraphics

Board Regular
Joined
Jan 9, 2022
Messages
52
Office Version
  1. 2011
Platform
  1. MacOS
Hi, I'm trying to create conditional formatting that will highlight the cell next to the number combination if that combination has 3 or more matching numbers and the winning number. I'm using =sum(countif()) but it's not producing the correct results. I'm not sure what is causing this. Can you please help me? Here is a snippet of the worksheet.
As you can see I tried different approaches but not getting desired results.

HIGHLIGHT THE LATEST LOTTERY MATCHES.xlsx
ABCDEFGHIJKLMNOP
1LOTTERY TICKET PURCHASE HISTORY
2
3LATEST DRAW
4NO 1NO 2NO 3NO 4NO 5BONUS 1BONUS 2
535103334710FALSE< I was testing the formula here before going to conditional formatting
6
7
8DATENO 1NO 2NO 3NO 4NO 5BONUS 1BONUS 2WINNERS
911/22/2115679910
1015789212
1119123334912
1225689911
13192630323369
14810152033712
1541115171838
16714182021611
171017212324912
181320242627312
19162327293036
20216171834410
21510212531511
LotteryTable
Cell Formulas
RangeFormula
J5J5=SUM(COUNTIF($A9:$H9,$A$5:$G$5))>=3
Named Ranges
NameRefers ToCells
number07=tbllottery[BONUS 2]J5
number08=tbllottery[BONUS 1]J5
number09=tbllottery[NO 5]J5
numberCheck=LotteryTable!$B5:INDEX(number09,COUNT(number09),1)J5
numberCheck02=LotteryTable!$G5:INDEX(number08,COUNT(number08),1)J5
numberCheck03=LotteryTable!$H5:INDEX(number07,COUNT(number07),1)J5
Cells with Conditional Formatting
CellConditionCell FormatStop If True
I9:I88Expression=SUM(COUNTIF($A9:$H9,$A$5:$G$5))>=3textNO
A9:A88Expression=SUM(COUNTIF(B9:F9,A5:E5)+COUNTIF($G9:$H9,$F$5:$G$5))>=3textNO
H9:H88Expression=AND(COUNTIF($G$5,H9),COUNTIF(numberCheck03,H9)=1)textNO
H9:H88Expression=COUNTIF($G$5,H9)textNO
G9:G88Expression=AND(COUNTIF($F$5,G9),COUNTIF(numberCheck02,G9)=1)textNO
G9:G88Expression=COUNTIF($F$5,G9)textNO
B9:F88Expression=AND(COUNTIF($A$5:$E$5,B9),COUNTIF(numberCheck,B9)=1)textNO
B9:F88Expression=COUNTIF($A$5:$E$5,B9)textNO


Thank you in advance for your help and time.

ps I was finally able to install the xl2bb add in so if there are any problems i'm sorry.
 
Try asking one question at a time, when you ask too much people tend to skip over it.

Starting with post 17, is this something that you can use? Note that I've made changes to the table in the lower right corner. Also should the 2 number prize be for 2 normal numbers, 2 bonus balls, or any combination of 2 balls? I've set it up for 2 normal but it will need changing if it should be anything else.

Book1
ABCDEFGHIJKLMNOP
1LOTTERY TICKET PURCHASE HISTORY
2
3LATEST DRAW
4NO 1NO 2NO 3NO 4NO 5BONUS 1BONUS 2
52493234910
6
7
8DATENO 1NO 2NO 3NO 4NO 5BONUS 1BONUS 2WINNERS
944522156799105
10157897120
11191233349125
12256899115
131926303233690
148101520337120
15411151718380
167141820216110
1710172123249120
1813202426273120
191623272930360
202161718344105
215102125315110
222131432342125
23182122232511120
2413181927326110
251921232527290
264452412131523246110JACKPOT7 NUMBERS52●●●●●●●1000000
275212431323502ND PLACE6 NUMBERS51●●●●●¥500 000
2815161925291603RD PLACE5 NUMBERS50●●●●●10000
296712172981204TH PLACE6 NUMBERS42●●●●●●3000
30234102641055TH PLACE5 NUMBERS41●●●●300
311926303233690HERE6TH PLACE5 NUMBERS32●●●●●200
3281015203371207TH PLACE4 NUMBERS40●●●●100
331567991058TH PLACE4 NUMBERS31●●●15
3415789212022●●●●15
351912333491259TH PLACE3 NUMBERS30●●●5
3625689911512●●5
3741115171838021●●5
3871418202161102 NUMBERS20●●5
3910172123249120
4013202426273120= REGULAR BALLS'
411623272930360= BONUS BALLS'
426192128308100
43671315357120
445101431341100
451318273435780
46216232932365
4728111417250
481819232534490
492141719359110
508111819279100
5114152325302110
521251115890
53512242933280
5416112434480
557891219480
561122832331110
5757121416890
5848151720890
59456813190
6046813201120
61256813190
6257121322480
638101516257120
6412131819283100
651516212231160
661819242734490
672491019155
68310171929560
69814172223140
7031114283011120
711720212430240
722161718344105
735102125315110
742131432342125
75182122232511120
7613181927326110
771921232527290
7844527156799105
79157892120
80191233349125
81256899115
822161718344105
835102125315110
842131432342125
85182122232511120
8613181927326110
871921232527290
884454579122229680
Sheet1
Cell Formulas
RangeFormula
I9:I88I9=IFERROR(VLOOKUP(--(SUMPRODUCT(COUNTIF(B9:F9,$B$5:$F$5))&SUMPRODUCT(--(G9:H9=TRANSPOSE($G$5:$H$5)))),$M$26:$P$38,4,0),0)
 
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Try asking one question at a time, when you ask too much people tend to skip over it.

Starting with post 17, is this something that you can use? Note that I've made changes to the table in the lower right corner. Also should the 2 number prize be for 2 normal numbers, 2 bonus balls, or any combination of 2 balls? I've set it up for 2 normal but it will need changing if it should be anything else.

Book1
ABCDEFGHIJKLMNOP
1LOTTERY TICKET PURCHASE HISTORY
2
3LATEST DRAW
4NO 1NO 2NO 3NO 4NO 5BONUS 1BONUS 2
52493234910
6
7
8DATENO 1NO 2NO 3NO 4NO 5BONUS 1BONUS 2WINNERS
944522156799105
10157897120
11191233349125
12256899115
131926303233690
148101520337120
15411151718380
167141820216110
1710172123249120
1813202426273120
191623272930360
202161718344105
215102125315110
222131432342125
23182122232511120
2413181927326110
251921232527290
264452412131523246110JACKPOT7 NUMBERS52●●●●●●●1000000
275212431323502ND PLACE6 NUMBERS51●●●●●¥500 000
2815161925291603RD PLACE5 NUMBERS50●●●●●10000
296712172981204TH PLACE6 NUMBERS42●●●●●●3000
30234102641055TH PLACE5 NUMBERS41●●●●300
311926303233690HERE6TH PLACE5 NUMBERS32●●●●●200
3281015203371207TH PLACE4 NUMBERS40●●●●100
331567991058TH PLACE4 NUMBERS31●●●15
3415789212022●●●●15
351912333491259TH PLACE3 NUMBERS30●●●5
3625689911512●●5
3741115171838021●●5
3871418202161102 NUMBERS20●●5
3910172123249120
4013202426273120= REGULAR BALLS'
411623272930360= BONUS BALLS'
426192128308100
43671315357120
445101431341100
451318273435780
46216232932365
4728111417250
481819232534490
492141719359110
508111819279100
5114152325302110
521251115890
53512242933280
5416112434480
557891219480
561122832331110
5757121416890
5848151720890
59456813190
6046813201120
61256813190
6257121322480
638101516257120
6412131819283100
651516212231160
661819242734490
672491019155
68310171929560
69814172223140
7031114283011120
711720212430240
722161718344105
735102125315110
742131432342125
75182122232511120
7613181927326110
771921232527290
7844527156799105
79157892120
80191233349125
81256899115
822161718344105
835102125315110
842131432342125
85182122232511120
8613181927326110
871921232527290
884454579122229680
Sheet1
Cell Formulas
RangeFormula
I9:I88I9=IFERROR(VLOOKUP(--(SUMPRODUCT(COUNTIF(B9:F9,$B$5:$F$5))&SUMPRODUCT(--(G9:H9=TRANSPOSE($G$5:$H$5)))),$M$26:$P$38,4,0),0)
Hi Jason,
Thank you so much for your help, you are right and I'm sorry about that. I just got carried away really, trying to explain myself properly and then I saw some replies before others and just wanted to make sure I wasn't being rude by not replying or explaining myself clearly, but I'm terribly sorry, and thanks for calling me out on it. When I win, I won't forget all the help I received from everyone.
Thank you again for your time and helpful solutions.
Thank you so much
 
Upvote 0
Try asking one question at a time, when you ask too much people tend to skip over it.

Starting with post 17, is this something that you can use? Note that I've made changes to the table in the lower right corner. Also should the 2 number prize be for 2 normal numbers, 2 bonus balls, or any combination of 2 balls? I've set it up for 2 normal but it will need changing if it should be anything else.

Book1
ABCDEFGHIJKLMNOP
1LOTTERY TICKET PURCHASE HISTORY
2
3LATEST DRAW
4NO 1NO 2NO 3NO 4NO 5BONUS 1BONUS 2
52493234910
6
7
8DATENO 1NO 2NO 3NO 4NO 5BONUS 1BONUS 2WINNERS
944522156799105
10157897120
11191233349125
12256899115
131926303233690
148101520337120
15411151718380
167141820216110
1710172123249120
1813202426273120
191623272930360
202161718344105
215102125315110
222131432342125
23182122232511120
2413181927326110
251921232527290
264452412131523246110JACKPOT7 NUMBERS52●●●●●●●1000000
275212431323502ND PLACE6 NUMBERS51●●●●●¥500 000
2815161925291603RD PLACE5 NUMBERS50●●●●●10000
296712172981204TH PLACE6 NUMBERS42●●●●●●3000
30234102641055TH PLACE5 NUMBERS41●●●●300
311926303233690HERE6TH PLACE5 NUMBERS32●●●●●200
3281015203371207TH PLACE4 NUMBERS40●●●●100
331567991058TH PLACE4 NUMBERS31●●●15
3415789212022●●●●15
351912333491259TH PLACE3 NUMBERS30●●●5
3625689911512●●5
3741115171838021●●5
3871418202161102 NUMBERS20●●5
3910172123249120
4013202426273120= REGULAR BALLS'
411623272930360= BONUS BALLS'
426192128308100
43671315357120
445101431341100
451318273435780
46216232932365
4728111417250
481819232534490
492141719359110
508111819279100
5114152325302110
521251115890
53512242933280
5416112434480
557891219480
561122832331110
5757121416890
5848151720890
59456813190
6046813201120
61256813190
6257121322480
638101516257120
6412131819283100
651516212231160
661819242734490
672491019155
68310171929560
69814172223140
7031114283011120
711720212430240
722161718344105
735102125315110
742131432342125
75182122232511120
7613181927326110
771921232527290
7844527156799105
79157892120
80191233349125
81256899115
822161718344105
835102125315110
842131432342125
85182122232511120
8613181927326110
871921232527290
884454579122229680
Sheet1
Cell Formulas
RangeFormula
I9:I88I9=IFERROR(VLOOKUP(--(SUMPRODUCT(COUNTIF(B9:F9,$B$5:$F$5))&SUMPRODUCT(--(G9:H9=TRANSPOSE($G$5:$H$5)))),$M$26:$P$38,4,0),0)
Hi sorry again, I didn't answer your question, the last "2 numbers" ball should be for two bonus balls. The first question is, "Is this something I can use?" I'm not sure what you mean by that question.

Thank you again.
 
Upvote 0
The first question is, "Is this something I can use?" I'm not sure what you mean by that question.
If you look at the sheet in my reply you will see that I've changed the formula so that it shows a 2 digit number for matching balls with the first digit being for normal numbers and the second for bonus numbers, I've also made some small changes to the prize list table to match that. If you can make that method fit into what you are doing then it will be the simplest way to do it. With the original formula it would need to be about 10 timer longer to include all possible results.
 
Upvote 0
If you look at the sheet in my reply you will see that I've changed the formula so that it shows a 2 digit number for matching balls with the first digit being for normal numbers and the second for bonus numbers, I've also made some small changes to the prize list table to match that. If you can make that method fit into what you are doing then it will be the simplest way to do it. With the original formula it would need to be about 10 timer longer to include all possible results.
Hi Jason, thank you so much for explaining that to me. lol so I did spend a lot of time analyzing the formula, but my Excel skills are so poor I couldn't piece it together but what you said helped. So I did notice that you changed the numbers from 3 + 2 to 32 but I thought you were doing that so excel would be able to recognize them as a whole integer and be able to reference it. I was wrong! once I read your email I was able to piece the rest together and now have a working formula that's giving me the results I need. Thank you so much. here's what I did. first, because excel removes the first zero in a number if it's not a decimal number and I needed to make the 20 into a 02 so that the second digit would match the balls in the bonus area so, I had to write it as '02 then I placed a '--' in front of the range in the formula so that Excel could convert it back into a number and voila, it worked. I don't know if that's the most efficient way to do it, but it's working and producing the right results so I'm ecstatic.
Thank you so much I won't forget all your help and time.

=IFERROR(VLOOKUP(--(SUMPRODUCT(COUNTIF(B9:F9,$B$5:$F$5))&SUMPRODUCT(--(G9:H9=TRANSPOSE($G$5:$H$5)))),--$M$26:$P$38,4,0),0)

ps, I still haven't figured out what other changes you made in the prize list table, but everything's working fine now. I don't know if you're referring to removing the dollar signs and the spaces but it's really working the way I need it to, so I'm happy.
Thank you thank you thank you.
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,387
Members
449,080
Latest member
Armadillos

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