Jump to content

Function Question - Case statement


This topic is 5707 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi, I'm stuck with a ormula and although I can get it to work using loads of if statements I'm hoping there is a easier way.

Basically as a practice project I want to make a program that can work out the best poker hand from data entered.

I've got all my fields set up (flop1, flop2, river, etc) and I have used the case statement and lots of AND and OR's to get it to pick up pairs, trips, etc but I'm thinking there must be a easier way than listing all possible combinations?

Also I can't think of how I would use this method to pick up the straights, etc.

So far I have not included suits. just numbers.

Any ideas?

Link to comment
Share on other sites

You've got your work cut out for you. What work have you done so far?

I suspect it'd be a lot easier with a Custom Function, but it doesn't seem you have a copy of Advanced. So you'll need some scripts to massage the data. I'd go about this from two directions:

1) Breaking up the data into a format usable to conduct evaluative calculations. A carriage delimited list of the values of the cards sorted and a carriage delimited list of the suits of the cards (for flushes and straight flushes).

2) Determing how to evaluate the data. I'd create a blank calc field for each Hand Ranking and then work on each ranking individually. PatternCount will be useful, as will Max.

Hand rankings are exclusive, so your final Case statemet would be evaluate your calc fields in order for Straight Flush, then Four of a Kind, then Full House, down to High Card.

Link to comment
Share on other sites

This topic is 5707 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.