### Title

Case Statement Help

### Post

I have the following Case statement:

Case ( ImmediateStart = "Yes"; "P1 - Immediate Start"; Category = "5a" and ImmediateStart = "No" ; "P2 - 5a "; Category = "5i" and ImmediateStart = "No" ; "P3 - 5i "; **Category = "5"** and ImmediateStart = "No" ; "P4 - Remaining Category 5 "; C**ategory = "4" **and ImmediateStart = "No" ; "P5 - Category 4's")

For the two sections I have in bold what I'm trying to say is:

If there are any other category 5's other than those listed previous in the statement, make them P4..etc

And for any category 4's (regardless of the letter after the 4) and immediate start = No make them P5 Category 4's.

I just don't know how to basically say the remaining different category 5's and all the category 4's as they would all have a letter after them.

Thanks!

The return key and space bar can help make case functions easier to read an analyze. The following format will work directly in your specify calculation dialog. But what you are trying to do with your quoted result expressions is not at all clear to me.

Case ( ImmediateStart = "Yes"; "P1 - Immediate Start";

GetAsNumber ( Category ) = 5 ; "P4 - Remaining Category 5 ";

Category = "5a" ; "P2 - 5a ";

Category = "5i" ; "P3 - 5i ";

GetAsNumber ( Category ) = 4 ; "P5 - Category 4's"

) // case

You can omit the and ImmediateStart = "No" terms since if immediateStart is "yes", the very first result text: "P1 - Immediate Start" will be returned and none of the following comparison expresions (boolean expressions) will be evaluated. GetAsNumber will strip off all the following non-numeric characters and evaluate the field as a number to compare to 4 or 5 in the last two Boolean expressions.

Left ( Category ; 1 ) = 5 might also work if only single digit numbers are possible for your values in Category.