Got Excel skills? Let's see.
It's a return to playing cards for this month's challenge. I suspect this one will be more about the optimisation than actually coming up with a working solution, but we'll have to wait and see about that.
Here are the usual rules.
Cell A1 contains a string representing a hand of cards; the number cards (2-10) are worth their face value, the Jack ("J"), Queen ("Q") and King ("K") are all worth ten, and the Ace ("A") can be either 1 or eleven. Create a single formula to evaluate the strength of the hand when playing Blackjack, ie it should return the highest possible value less than or equal to 21. If there's no way to obtain a hand value below 22 then the function should return "bust". For example:
A1
"468" --> "18"
"4684" --> "bust"
"A4726" --> "20" not "30"
"AA9" --> "21" not "11" or "31"
"K7" --> "17"
"KQ4" --> "bust"
Have fun
It's a return to playing cards for this month's challenge. I suspect this one will be more about the optimisation than actually coming up with a working solution, but we'll have to wait and see about that.
Here are the usual rules.
- Create a single Excel formula to solve the stated problem.
- The shortest formula wins (when calculating the length of the formula there's no need to include the leading "=", or the curly braces that Excel uses to represent array formulae).
- The formula's number format can be set to whatever you want.
- Conditional formatting is not allowed.
Cell A1 contains a string representing a hand of cards; the number cards (2-10) are worth their face value, the Jack ("J"), Queen ("Q") and King ("K") are all worth ten, and the Ace ("A") can be either 1 or eleven. Create a single formula to evaluate the strength of the hand when playing Blackjack, ie it should return the highest possible value less than or equal to 21. If there's no way to obtain a hand value below 22 then the function should return "bust". For example:
A1
"468" --> "18"
"4684" --> "bust"
"A4726" --> "20" not "30"
"AA9" --> "21" not "11" or "31"
"K7" --> "17"
"KQ4" --> "bust"
Have fun
Last edited: