Join conditions with Or to run the code when at least one is True: If Range("B2").Value = "East" Or Range("B2").Value = "West" Then. The Else part runs only when every condition is False. Repeat the cell reference in each condition; If x = "East" Or "West" Then stops with a type mismatch.
To check one value against a list, Select Case is shorter:
Select Case Range("B2").Value
Case "East", "West", "North"
Range("C2").Value = "Region"
Case Else
Range("C2").Value = "Other"
End Select
When you mix And and Or, use brackets. VBA works out And before Or, so If region = "East" Or region = "West" And sales > 10000 Then applies the sales test only to West. Write If (region = "East" Or region = "West") And sales > 10000 Then.
VBA evaluates every condition, even after one is already True. If x = 0 Or y / x > 2 Then still divides by zero when x is 0, so split it into If x = 0 Then with an ElseIf y / x > 2 Then branch.
You can use the OR operator with the VBA IF statement to test multiple conditions. When you use it, it allows you to test two or more conditions simultaneously and returns true if any of those conditions are true. Only if all the conditions are false does it return false in the result.
Use OR with IF
- First, start the IF statement with the “IF” keyword.
- After that, specify the first condition that you want to test.
- Next, use the OR keyword to specify the second condition.
- In the end, specify the second condition that you want to test.

To have a better understanding, let’s see an example.
Sub myMacro() 'two conditions to test using OR If 1 = 1 Or 2 < 1 Then MsgBox "One of the conditions is true." Else MsgBox "None of the conditions are true." End If End Sub

If you look at the above example, we have specified two conditions: the first is (1 = 1) and the second is (2 < 1). Here only the first condition is true, and even so, it has executed the line of code that we have specified if the result is true.

Now let’s see what happens if both conditions are false. Let me use a different code here.
Sub myMacro() 'two conditions to test using OR If 1 = 2 Or 2 < 1 Then MsgBox "One of the conditions is true." Else MsgBox "None of the conditions are true." End If End Sub

In the above code, both conditions are false, and when you run this code, it executes the line of code that we have specified if the result is false.

Multiple Conditions with IF OR
In the same way, you can also test more than two conditions at the same time. Let’s continue the above example and add a third condition to it.
Sub myMacro() 'three conditions to test using OR If 1 = 1 Or 2 > 1 Or 1 - 1 = 0 Then MsgBox "one of the conditions is true." Else MsgBox "none of the conditions are true." End If End Sub

Now we have three conditions to test, and we have used the OR after the second condition to specify the third condition. As you learned above, when you use OR, only one of the conditions needs to be true to get true in the result. When you run this code, it executes the line of code that we have specified for true.

And if all the conditions are false, just like you have in the following code, it returns false.
Sub myMacro() 'three conditions to test using OR If 1 < 1 Or 2 < 1 Or 1 + 1 = 0 Then MsgBox "one of the conditions is true." Else MsgBox "none of the conditions are true." End If End Sub

Use IF OR with Cell Values
In real life, you will use IF OR to test values from the worksheet. In the following code, if cell A1 has “Yes” or “Y”, it shows one message, and for anything else, it shows the other one.
Sub CheckAnswer()
Dim answer As String
answer = Range("A1").Value
If answer = "Yes" Or answer = "Y" Then
MsgBox "You said yes."
Else
MsgBox "You didn't say yes."
End If
End Sub
Text comparison in VBA is case-sensitive by default, so “yes” in lowercase won’t match “Yes”. To ignore the case, convert the value with LCase and compare it with lowercase text:
Sub CheckAnswerAnyCase()
Dim answer As String
answer = LCase(Range("A1").Value)
If answer = "yes" Or answer = "y" Then
MsgBox "You said yes."
End If
End Sub
Combine OR with AND
You can use OR and AND in the same condition, but use parentheses to group them. VBA checks AND before OR, so without parentheses, the condition might not test what you expect. In the following code, the message shows when the region is East or West and the sales are more than 1000.
Sub RegionSales()
Dim region As String, sales As Double
region = Range("A2").Value
sales = Range("B2").Value
If (region = "East" Or region = "West") And sales > 1000 Then
MsgBox "Target achieved."
End If
End Sub
VBA OR Checks All the Conditions
Unlike some other languages, VBA doesn’t stop at the first true condition. It always checks every condition in an OR, even when the first one is already true. So, if one of the conditions can give an error, the code stops with that error.
In the following code, when x is 0, the second condition divides by zero and you get the “Division by zero” error, even though the first condition is true:
Sub OrChecksBoth()
Dim x As Double
x = 0
If x = 0 Or 10 / x > 1 Then ' Error 11 when x is 0
MsgBox "OK"
End If
End Sub
To avoid this, test the risky condition separately with ElseIf, so it only runs when the first condition is false:
Sub OrWithElseIf()
Dim x As Double
x = 0
If x = 0 Then
MsgBox "OK"
ElseIf 10 / x > 1 Then
MsgBox "OK"
End If
End Sub
Use Select Case Instead of Many OR Conditions
When you test one value against a long list, Select Case is easier to read. Each value in the Case line, separated by commas, works like an OR:
Sub CheckDay()
Select Case Range("A1").Value
Case "Saturday", "Sunday"
MsgBox "Weekend"
Case Else
MsgBox "Weekday"
End Select
End Sub
Frequently Asked Questions
How many conditions can I use with IF OR?
There’s no small fixed limit, so you can add as many conditions as you need, each with its own Or. But when the list gets long, Select Case is easier to read and to change.
What is the difference between OR and AND in VBA?
OR returns true when at least one condition is true. AND returns true only when all the conditions are true. You can learn more about AND in the VBA IF And tutorial.
Can I use the Excel OR function in VBA?
You don’t need to. In VBA, Or is an operator that you write between the conditions, while OR(…) is the worksheet function you use in a cell formula.
Written by
Puneet Gogia
Microsoft MVP — Excel · Founder, Excel Champs
Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.