+ Reply to Thread
Results 1 to 20 of 20

listing the 2, 598, 960 different poker hands in separate cells

  1. #1
    Registered User
    Join Date
    11-10-2007
    Posts
    6

    listing the 2, 598, 960 different poker hands in separate cells

    Let's say My criteria is :
    1 2 3 4 5 6 7 8 9 10 J Q K A (13 ranks of cards)
    s c d h (4 different suits...s=spades c = clubs,etc)
    5 would be the number of draws of 1 card to make a poker hand

    How would I go about listing the 2, 598, 960 different poker hands in separate cells?

    I would really appreciate any kind of help that helps me get this done.

    thanks,
    Chico

  2. #2
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520
    This should deliver it for you ..

    Save this sample from my archives to a folder & open the file:
    http://savefile.com/files/518493
    MyrnaLarson_Combination_Permutation.xls

    In Sheet1,

    Put this in A3, copy down to A54:
    =INDEX({"s";"c";"d";"h"},INT((ROWS($1:1)-1)/13)+1)&"-"&INDEX({2;3;4;5;6;7;8;9;10;"J";"Q";"K";"A"},MOD(ROWS($1:1)-1,13)+1)

    The above will auto-list the full 52 "cards" into A3:A54, viz:

    s-2
    s-3
    s-4
    ...
    h-Q
    h-K
    h-A

    Then input in A2: 5
    (as you want sets of 5 from 52)

    Input in A1: C
    (C = combination)

    Re-select cell A1, then press the button: ListPermutations

    Leave it to run overnight. You should get the desired 2.6* mil "poker hand" returns in a new sheet in the morning.
    *COMBIN(52,5)
    Max
    Singapore

  3. #3
    Forum Contributor
    Join Date
    10-30-2007
    Location
    Norway
    MS-Off Ver
    MS Office 2007
    Posts
    345
    I think you will have problem making the 2,6 mill pokerhands fit into the 65536 rows in Excel.

  4. #4
    Registered User
    Join Date
    10-29-2007
    Posts
    38
    Could with 2007 but why would you want to bother?
    Richard Walker

    For training and consultancy visit www.imits.co.uk

  5. #5
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520
    Myrna's sub will snake the results right across the sheet, so the 2.6 mil results will be generated into 40 columns, viz:

    In A1 down to A65536 (col A)
    s-2, s-3, s-4, s-5, s-6
    s-2, s-3, s-4, s-5, s-7
    s-2, s-3, s-4, s-5, s-8
    ...
    ...

    then in B1 down (col B)
    s-2, s-6, c-6, h-9, h-10
    s-2, s-6, c-6, h-9, h-J
    s-2, s-6, c-6, h-9, h-Q
    ...
    ...

    then in C1 down (col C)
    s-2, s-J, c-5, c-K, h-K
    s-2, s-J, c-5, c-K, h-A
    s-2, s-J, c-5, c-A, d-2

    and so on ..

  6. #6
    Registered User
    Join Date
    10-29-2007
    Posts
    38
    But Why would you ever want to do it?

  7. #7
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520
    > Could with 2007 ..

    As explained, the results will snake across the sheet.
    It works ok in xl2003.

    (Actually I didn't say that the results will be generated in one column. I mentioned: "in a sheet")

  8. #8
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520
    Quote Originally Posted by Badger101
    But Why would you ever want to do it?
    I dunno. But think the OP, Chico, would definitely have the answer to your question. Let's see whether the OP returns here.

  9. #9
    Registered User
    Join Date
    11-10-2007
    Posts
    6
    Quote Originally Posted by Max, Singapore
    This should deliver it for you ..

    Save this sample from my archives to a folder & open the file:
    http://savefile.com/files/518493
    MyrnaLarson_Combination_Permutation.xls

    In Sheet1,

    Put this in A3, copy down to A54:
    =INDEX({"s";"c";"d";"h"},INT((ROWS($1:1)-1)/13)+1)&"-"&INDEX({2;3;4;5;6;7;8;9;10;"J";"Q";"K";"A"},MOD(ROWS($1:1)-1,13)+1)

    The above will auto-list the full 52 "cards" into A3:A54, viz:

    s-2
    s-3
    s-4
    ...
    h-Q
    h-K
    h-A

    Then input in A2: 5
    (as you want sets of 5 from 52)

    Input in A1: C
    (C = combination)

    Re-select cell A1, then press the button: ListPermutations

    Leave it to run overnight. You should get the desired 2.6* mil "poker hand" returns in a new sheet in the morning.
    *COMBIN(52,5)
    I am not sure what I am doing wrong but as soon as I hit the button I get "run time error 1004"

  10. #10
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520
    Quote Originally Posted by Chico
    I am not sure what I am doing wrong but as soon as I hit the button I get "run time error 1004"
    Save the file to a folder, then open the file from there.

  11. #11
    Registered User
    Join Date
    11-10-2007
    Posts
    6
    I already had it on my hard drive. I copied the formula into cell A3 and it was displayed in cell A3 as tex showing the exact thing I copied. It did not turn the cell into s-2, so I hit [F2] and hit enter again and I got something to the effect invalid...do you accept to correct proposed change to fix formula? So I hit enter and it gave me the s-2 in the cell. I copied down but the formula put s-2 in all the cells down to cell A54. I think there is a typo in the formula somewhere. Could you have a look?

    thanks a bunch for your help so far,
    Chico

  12. #12
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520
    Quote Originally Posted by Chico
    I already had it on my hard drive. I copied the formula into cell A3 and it was displayed in cell A3 as tex showing the exact thing I copied. It did not turn the cell into s-2, so I hit [F2] and hit enter again and I got something to the effect invalid...do you accept to correct proposed change to fix formula? So I hit enter and it gave me the s-2 in the cell. I copied down but the formula put s-2 in all the cells down to cell A54. I think there is a typo in the formula somewhere. Could you have a look?
    Not sure what happened, but here's a fully implemented sample, "ready-to-run", with the formulas in A3:A54 working properly*:

    http://www.flypicture.com/download/NTQ5ODI=
    Generating PokerHands.xls

    I've also placed the cursor on A1, so all you need to do is to click the button to start the generation of the 2.6 mil pokerhands ..

    *you could cross-check later the differences between your attempt and the installed formulas. It could be just the "ROWS($1:1)" bits being inadvertently changed to "ROWS(1:1)" by Excel when you pasted the formula into A3 and confirmed the formula with Enter.

    And perhaps you could also let us know why you wanted to generate the 2.6 mil hands ..

  13. #13
    Registered User
    Join Date
    11-10-2007
    Posts
    6
    I clicked on the link you just provided and got this :

    File not found...

    There was an error retrieving your file.
    The file may not be on this server.
    Please check the address and try again.


    p.s. you wanted to know why I wanted all these hands...I am testing a vlookup from any possible combination of poker hands. I realise it might be easier just to convert the results of a poker hand to something like "two pair, kings and 2's with ace kicker instead of kc,kh,2s,2d,ah since the latter has many other possible kings and twos combos but I am also checking other things that go along with a large data worksheet.

  14. #14
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520
    [QUOTE=Chico]I clicked on the link you just provided and got this :
    File not found...
    QUOTE]

    The link was working fine when I uploaded/tested it y'day.
    (Flypicture.com seems to have vanished)

    Anyway, here's another link to the sample:
    http://www.freefilehosting.net/download/MzYwOTg=
    Generating PokerHands.xls

    Thanks for the ps explanation.

  15. #15
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520
    Chico,

    Maybe just spare me a liner that
    you've got it downloaded fine via the new link

    (The new link would also presumably be expired
    by the free filehosting site after awhile)

  16. #16
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    2, 598, 960 hands? just out of interest where does this figure come from?
    for example AAAAk down to AAAA2 there are only 12 ways of getting that it doesnt matter what suit the other cards are.
    similarly for
    2 3 4 5 6 its the same hand as long as one card is off suit

  17. #17
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520
    Quote Originally Posted by martindwilson
    2, 598, 960 hands? just out of interest where does this figure come from?
    That's the figure you get from choosing sets of 5 cards from a deck of 52:
    =COMBIN(52,5)

  18. #18
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    ah but the question is "hands" not all the ways of achieving them!
    e.g.a pair of 10's
    there are only 6 ways of getting that.... but all 6 ways = one hand

  19. #19
    Registered User
    Join Date
    01-21-2011
    Location
    Tustin, California
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: listing the 2, 598, 960 different poker hands in separate cells

    Quote Originally Posted by Chico View Post
    Let's say My criteria is :
    1 2 3 4 5 6 7 8 9 10 J Q K A (13 ranks of cards)
    s c d h (4 different suits...s=spades c = clubs,etc)
    5 would be the number of draws of 1 card to make a poker hand

    How would I go about listing the 2, 598, 960 different poker hands in separate cells?

    I would really appreciate any kind of help that helps me get this done.

    thanks,
    Chico

    i'm running excel 2003, if you want to list all hands, attach this macro to a button on a blank sheet and hit go (look online to see how to put a macro to a button).... this will list all hands like "1.2.3.4.5" where each # corresponds to a different card (1 - 52). all you need to do then is to assign a # to each card (1-52) and 1.2.3.4.5 changes to A.2.3.4.5 spades.... let me know if u have questions: [email protected] (btw... takes about 2 hours to run this macro as there are over 2.5 million hands!)

    Please Login or Register  to view this content.

  20. #20
    Registered User
    Join Date
    10-20-2021
    Location
    Kazakhstan
    MS-Off Ver
    2108
    Posts
    1

    Re: listing the 2, 598, 960 different poker hands in separate cells

    Have you been able to generate all 2, 598, 960 poker combinations in excel? If so, can you please share with me. Your help will be much appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1