custom sequence

Hello. I would like to make a custom sequence and don’t how to go about it. it does 1, 2, 3 + and a,b,c+. but it isn’t working when i add AKQ, AKJ, AK10, AK9, AK8 etc (i’d like to have all the possible flops in a texas holdem poker game sequenced so i don’t have to write them all). please explain in as much detail as possible because i’m new to libre/spreadsheets.

Thank you

Your specification is incomplete. You didn’t tell if you tolerate repetition of cards.

In case you accept repetition, this is equivalent to an enumeration problem. Your card deck est analogous to a numbering system in radix 13 (A 2 3 … 10 J Q K). Then you only need to generate number which you display in base 13: =BASE(<number_or_cell>; 13; 3). The last “3” means you explicitly want 3-digit numbers (adapt if your hand contains 4 or more cards).

The resulting number is expressed with digits 0-9A-C which is not the usual marking for cards. You need then to translate to some other marking. It is up to you to decide the mapping between digits 0-9A-C and A2-10JQK. You maychoose 0->A, 1->2, 9->10, A->J, B->Q, C->K. But to limit the complexity of formulas, i leave 2-9 unchanged and map 0->A, 1->K, A->10, B->Q, C->K.

For a single change: =SUBSTITUTE(<cell>;"0","X"). To transcode 2 “digits”: =SUBSTITUTE(SUBSTITUTE(<cell>;"0","X");"1","k"). You will easily modify the formula for the five changes. Note that I changed 0->X, not 0->A (card name), so that when I change A (digit in radix 13) to 10, I don’t change again an ace for something else. This requires a final rule X->A. For the same reason, you must also change 0 and 1 innermost to avoid adverse effects with A->10.

IMHO, this could be done more easily in Perl where a translate function is provided to transcode strings from one representation to another.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!