Excel provides support for both logical and and or. The keyword and is used for "and" operation and the keyword or is used for "or" operation.

 

Examples

{code}

if ((condition1) and (condition2)) then

msgbox "I am here"

end if

{/code}

The above code displays the message box, if both condition1 and condition2 are true.

 

{code}

if ((condition1) or (condition2)) then

msgbox "I am here"

end if

{/code}

The above code displays the message box, if either condition1 or condition2 is true.