Logical operators in excel are also known as the comparison operators and they are used to compare two or more values, the return output given by these operators are either true or false, we get true value when the conditions match the criteria and false as a result when the conditions do not match the criteria.
Private Sub Constant_demo_Click()
Dim a As Integer
a = 10
Dim b As Integer
b = 0
If a <> 0 And b <> 0 Then
MsgBox ("AND Operator Result is : True")
Else
MsgBox ("AND Operator Result is : False")
End If
If a <> 0 Or b <> 0 Then
MsgBox ("OR Operator Result is : True")
Else
MsgBox ("OR Operator Result is : False")
End If
If Not (a <> 0 Or b <> 0) Then
MsgBox ("NOT Operator Result is : True")
Else
MsgBox ("NOT Operator Result is : False")
End If
If (a <> 0 Xor b <> 0) Then
MsgBox ("XOR Operator Result is : True")
Else
MsgBox ("XOR Operator Result is : False")
End If
End Sub
When you save it as .html and execute it in the Internet Explorer, then the above script will produce the following result.
AND Operator Result is : False
OR Operator Result is : True
NOT Operator Result is : False
XOR Operator Result is : True