How to Use the IF function for an IF THEN ELSE Statement

2 followers
0
Avatar

 Hi

 

I am trying to use IF function for IF then else statement  and having challenges, can some help me on the syntax or how I can arrive.

 

Ways been used :

1) IF( (CNTRY="IN"); "XXX"; "YYY")

2)IF(EQUALS(CNTRY;"IN");"XXX";"YYY")

 

Thanks

Kranthi

 

Kranthi Kumar Sreeram

2 comments

  • Avatar
    Konsta Danyliuk

    Hello Kranthi.
    Hope you are doing fine.

    In general syntax of IF function for mentioned case is IF(<#SheetName!ColumnName>=="<match string>";<then>;<else>) or IF(EQUALS(<#SheetName!ColumnName>;"<match string>");<then>;<else>)

    For example. You have the column Status and want to apply IF condition based on the value "failed".

    Status
     passed
     failed
     running
     failed
     not_stared

    Formulas you might want to use:

    • IF(<#Status>=="failed";"job failed";"job not failed")
    • IF(EQUALS(<#Status>;"failed");"job failed";"job not failed")

    Hope this helps you to move forward.

     

    1
  • Avatar
    Kranthi Kumar Sreeram

    Thanks Konsta, 

    Hope you are doing good.

    Your inputs have helped me. I realized the what went wrong 

    Scenario 1: I was using = instead of ==

     

    Thanks

    Kranthi Kumar Sreeram

     

    0
Please sign in to leave a comment.