Poker hand analyzer out of a 7 card hand

chrisbroe411

New Member
Joined
May 15, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
3 questions
Okay so I'm trying to make a sheet that represents a 100 full table of players and their hands and then summarizes the results for analysis I've got an almost complete. I used the forums to find formulas that work. This in the spreadsheet that I attached. the way I got the cards to layout using RANDBETWEEN. Eight players are dealt cards in turn then the burn and the flop and burn and turn and the burn and the river. I did that so that not only does a player get a random card but if it were actually being dealt one of the other cards remaining would've been wasted on the Burns.
I have a formula to determine if there's a flush. I found a formula to determine the various forms of matching cards in a five card hand and thought I had adapted it for the seven card hand properly until I started analyzing the data. I used
=LOOKUP(SUMPRODUCT(COUNTIF(H1:H7,"="&LEFT(H1:H7,1)&"*")),{7,9,11,13,15,19},{"no","one pair","two pair","3 of kind","full house","4 of kind"})
which actually works great except when there's three pairs. Now three pairs is not a valid poker hand. But the SUMPRODUCT returns a value of 13 for both the condition of three pairs or one three of a kind. I also have a problem when there is two 3 of the kinds, it should be a full house but it registers as four a kind.

question 1. Is there a way to fix it?

I also have a formula for finding straight that's also in the sheet that is also in the sheet. What I did was break out the left-hand value of the cards and then check them against a helper section.

Question 2. Is there a way to use this formula with the original seven cards or going to need to go through the step of breaking out the left-hand number?

Question 3. Is there a way to pull out just the five cards used for each one of these hands?

Side note I want to do this all with formulas.

formula error.xlsx
ABCDEFGHIJKLMNOPQRSTU
1JSJSJSJSJSJSJSJSJHJS1
2JHJHJHJHJHJHJHkskskscardshands
3TDjc5h5hTD5h5h5h5h9SP1A5
4jdTH5cTHTHTHTHTHTHTHP2A8
55d5djcjc5dTCksqcqcqcP3A9
6jc3c5d2c3c2c2c2c2H2cP4A42
73S3S3S3S3S3S3S3S3H3SP5A50
8P6A36
9xxxxxxxxflushxP7A19
10P8A29
114 of kindfull house4 of kind3 of kind3 of kindtwo pairone pairnononoP1B25
121915191313119777the resulting numbers from the sumproduct used aboveP2B16
13P3B46
14JJJJJJJJJJP4B48
15JJJJJJJkkkP5B39
16Tj55T55559P6B2
17jT5TTTTTTTP7B27
1855jj5TkqqqP8B45
19j352322222B118
203333333333F124
21F237
221111111111F333
231111111111B223
241111111111T13
251111111111B349
261111111111R11
271111111111Duplicate checkFALSE
281111111111
291111111111
301111111119TJQK
311111111111
32
33A2345A2345
342345623456
353456734567
364567845678
375678956789
386789T6789T
39789TJ789TJ
4089TJQ89TJQ
419TJQK9TJQK
42TJQKATJQKA
43
Sheet1
Cell Formulas
RangeFormula
A9:J9A9=IF(OR(COUNTIF(A1:A7,"=*"&RIGHT(A1,1))>4,IF(RIGHT(A2,1)=RIGHT(A1,1),,(COUNTIF(A2:A7,"=*"&RIGHT(A2,1))>4)),IF(RIGHT(A3,1)=RIGHT(A2,1),,(COUNTIF(A3:A7,"=*"&RIGHT(A3,1))>4))),"flush","x")
A11:J11A11=LOOKUP(SUMPRODUCT(COUNTIF(A1:A7,"="&LEFT(A1:A7,1)&"*")),{7,9,11,13,15,19},{"no","one pair","two pair","3 of kind","full house","4 of kind"})
A12:J12A12=SUMPRODUCT(COUNTIF(A1:A7,"="&LEFT(A1:A7,1)&"*"))
A14:J20A14=LEFT(A1,1)
A22:J31A22=IF(AND(COUNTIF(A$14:A$20,Sheet1!$A33)>0,COUNTIF(A$14:A$20,Sheet1!$B33)>0,COUNTIF(A$14:A$20,Sheet1!$C33)>0,COUNTIF(A$14:A$20,Sheet1!$D33)>0,COUNTIF(A$14:A$20,Sheet1!$E33)>0),Sheet1!$F33,1)
S3:S26S3=IFERROR(LARGE(ROW($1:$52)*NOT(COUNTIF(S$2:S2,ROW($1:$52))),RANDBETWEEN(1,52-1-ROW(S2)+2)),"")
S27S27=SUMPRODUCT(COUNTIF(S3:S26,S3:S26)-1)>0
F33:F42F33=A33&B33&C33&D33&E33
Press CTRL+SHIFT+ENTER to enter array formulas.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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