Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

Function Question - Case statement

Featured Replies

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?

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.

  • Author

thanks a lot. well explained and very helpful. Think it might be out my range right now, but i'm gonna give it a go

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.