Skip to Content
avatar image
Former Member

CASE statement in Calculated column


Hi Frzz,

I have below requirement in Calculated column with CASE statement. Could some one help me how to achieve this with case statement.

String  =   0Hello

                01Hello

                012Hello

                0123Hello

If  1st Character of the string is '0' then  -  0Hello

    1st 2 characters of the String is '01'  -   22Hello

    1st 3 characters of the String is '01'  -   333Hello

    1st 4 characters of the String is '01'  -  4444Hello

Thank you.

Best Regards,

Krishna.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Mar 19, 2014 at 03:23 PM

    Hi Krishna ,

    Using IF and MATCH to do that: ( I took one of the conditions you specified )

    IF(match("STRING1",'??0??'),'333Hello',"STRING1")
    
    

    Output:

    Regards,

    Krishna Tangudu

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Krishna Tangudu

      Hi Krishna,

      If i want to implement IF ELSE kind of statements in Calculated column, how can i achieve it. In your last reply you mentioned how to write multiple IF statements.

      Scenario:

      IF ( 1st Character <> 0 ) -- >  Yes -->  Do some calculation

                                              --->  NO ---> < IF (Numeric )  --> YES--> Convert to String->Lpad->IFs(con)

                                                                                              --> NO  --> Lpad-->IFs(condition)

        

      Best Regards,

      Krishna.

  • avatar image
    Former Member
    Mar 19, 2014 at 02:53 PM

    If  1st Character of the string is '0' then  -  0Hello

        1st 2 characters of the String is '01'  -   22Hello

        1st 3 characters of the String is '012'  -   333Hello

        1st 4 characters of the String is '0123'  -  4444Hello

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 23, 2014 at 05:03 PM

    Hi everyone,

    I've looked through the previous examples and think that mines is a bit different because it is an integer data type. Below is my statement. I am trying to create a calculated column based on ALERTID, for integers between 2051-2073 I want the text 'Turkish to be displayed', then for 1-2050 i want it text to be 'INIT'.

    case("ALERTID",2051-2073,'TURKISH',1-2050,'INIT','NONE')

    Can someone show me how this code should look? I don't get an error but I don't get the correct

    results.

    Thanks,

    Connor Nelson

    Add comment
    10|10000 characters needed characters exceeded