Check 2 Conditions With IF AND OR

  • Hi all, i am trying to create what is probably a simple If statement for a worksheet formula i want to check to see if one of two cells have the text specified if so then the cell value is A4 from another sheet if not the cell containing the formula should be blank, something like below


    Code
    =IF(B1="on" Or D1="on",Sheet2!A4,"")

    I also need this kind of formula with the AND operator, something like


    Code
    =IF(B1="off" AND D1="off",Sheet2!A4,"")

    i have tried varying combinations but had no joy, any suggestions?


    Regards,
    Simon

  • Re: Worksheet Formula If Statement Involving And/or?


    Hi Simon


    Try


    Code
    =IF(B1="Off",IF(D1="off",Sheet2!A4,""))


    instead of


    Code
    =If(B1="off" And D1="off",Sheet2!A4,"")


    Regards


    Ian

  • Re: Worksheet Formula If Statement Involving And/or?


    Thanks Ian i had already tried both of those, the first shows false if B1 shows off and D1 shows on but if they both show on the name from sheet 2 appears.


    With the second formula it says there is a formula error, which i also got when i tried it before posting.


    Any other ideas?


    Regards,
    Simon

  • Re: Worksheet Formula If Statement Involving And/or?


    Simon


    Try


    Code
    =IF(AND(B1="Off",D1="Off"),Sheet2!A4,"")


    and


    Code
    =IF(OR(B1="On",D1="On"),Sheet2!A4,"")


    These should work


    Ian

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!