How to use OR within a IF Statement in Formula field

  • I am trying to use the following code snippet in a formula field. I am confused on how i would represent OR within a IF statement

    if(project_type__c == 'Billed' || project_type__c == 'UnBilled')
       //do something
       //do something
  • rael_kid

    rael_kid Correct answer

    8 years ago

    You can just use the IF function with || like you're used to:

    IF(project_type__c  == 'Billed' || project_type__c == 'UnBilled', 'true', 'false')

    Note that if your field project_type__c is a picklist, you need to enclose them in a TEXT() function:

    IF(TEXT(project_type__c)  == 'Billed' || TEXT(project_type__c) == 'UnBilled', 'true', 'false')

    IF(OR(project_type__c == 'Billed', project_type__c == 'UnBilled'), 'true', 'false') is this acceptable?

    Yes, that'd work too.

License under CC-BY-SA with attribution

Content dated before 7/24/2021 11:53 AM

Tags used