Forum Discussion

Deleted's avatar
Deleted
Sep 19, 2018

Using IF function with OR

Hi, 

 

I need some help with the IF function, I created the formula to fit my condition of:

 

If either C9 or C10 display Pass then display YES, otherwise display NO. 

 

=IF((OR(C9="Pass",C10="Pass")),"YES","NO")

 

Unfortunately, this no longer fits as I have multiple conditions, and every time I've tried to change the formula to fit my conditions I've gotten an error.

 

Conditions:

1. If either C9 or C10 display Pass then display YES

2. If C9 displays Fail and C10 displays N/A then display NO

3. If C9 displays N/A and C10 displays Fail then display NO

4. If C9 displays Fail and C10 displays Fail then display NO

5. If both C9 or C10 display N/A then display N/A

 

Can anyone point me in the right direction? Is there another function I should be using instead of IF? 

 

Thanks heaps!

  • Damien_Rosario's avatar
    Damien_Rosario
    Silver Contributor

    Hi Deleted

     

    If you are using Office 365, you have IFS at your disposal that can do multiple conditions.

     

    I've given your conditions a crack, so maybe try this and see if it works for you?

     

    =IFERROR(IFS(OR(C9="Pass",C10="Pass"),"YES",AND(C9="Fail",C10="N/A"),"NO",AND(C9="N/A",C10="Fail"),"NO",AND(C9="Fail",C10="Fail"),"NO",OR(C9="N/A",C10="N/A"),"N/A"),"")

     

    IFERROR will catch any errors and make the cell blank (last condition in the formula is where I did that "")

     

    IFS lets you do multiple criteria.

     

    Best wishes with your spreadsheet!

     

    Cheers

    Damien

    • Deleted's avatar
      Deleted
      thanks for your help! It is now working :)
  • BobOrrell's avatar
    BobOrrell
    Iron Contributor

    If you don't have 365, or just want to continue using If you can use

    =IF(OR(C9="Pass",C10="Pass"),"Yes",IF(AND(C9="N/A",C10="N/A"),"N/A","No"))

    and to make sure I understood, either cell says Pass, then the result is Pass, both cells say N/A, the result is N/A, anything else will say No

    • Deleted's avatar
      Deleted

      Thanks for your help! I managed to get it working.

Resources