Home > Software design >  OR condition in a formula
OR condition in a formula

Time:07-15

The below formula helps to Start from ASD and before the slash it prints all the data.

Query: Now as per the requirement, i need to search for two words with OR condition. For eg it should either start with ASD or DEF I tried with OR condition but that is not working. Can someone pls guide in this.

Working Formula: =IF(ISNUMBER(SEARCH("ASD",A11)),MID(A11,SEARCH("""",A11) 1,SEARCH("/",A11)-1-SEARCH("""",A11)),"")

With OR Condition(which is not working) =IF(ISNUMBER(SEARCH("ASD",A11) OR SEARCH("DEF",A11)),MID(A11,SEARCH("""",A11) 1,SEARCH("/",A11)-1-SEARCH("""",A11)),"")

CodePudding user response:

It has to look like:

=IF(OR(ISNUMBER(SEARCH("ASD",A11)), ISNUMBER(SEARCH("DEF",A11))),MID(A11,SEARCH("""",A11) 1,SEARCH("/",A11)-1-SEARCH("""",A11)),"")

CodePudding user response:

It seems that the order of the operations in your formula is the issue.

Example: OR – =IF(OR(Something is True, Something else is True), Value if True, Value if False)

cf: https://support.microsoft.com/en-us/office/using-if-with-and-or-and-not-functions-d895f58c-b36c-419e-b1f2-5c193a236d97

My best guess is that your formula should be

=IF(OR(ISNUMBER(SEARCH("ASD",A11), SEARCH("DEF",A11))),MID(A11,SEARCH("""",A11) 1,SEARCH("/",A11)-1-SEARCH("""",A11)),"")
  • Related