VBA OR function in Excel is categorized as a logical function in VBA. It is a built-in function in MS Office Excel VBA. This function returns true, if any of the conditions are TRUE. This function is used to combine more than one condition with using ‘OR’ keyword. This is one of the most used logical operator. It has minimum two conditional input parameters to check. It returns a Boolean value (True or False).

We can use this function as a worksheet function and also can be used in VBA. This function can be used in either procedure or function in a VBA editor window in Excel. We can use this VBA OR function any number of times in any number of procedures or functions. In the following section we learn what is the syntax and parameters of the OR function, where we can use this VBA OR function and real-time examples.

**Table of Contents:**

- Objective
- Syntax of VBA OR Function
- Parameters or Arguments
- Where we can apply or use VBA OR Function?
- Example 1: Check any of the conditions are true or not(TRUE)
- Example 2: Check any of the conditions are true or not(FALSE)
- Example 3: Check any of the conditions are true or not(TRUE)
- Instructions to Run VBA Macro Code
- Other Useful Resources

## Syntax of VBA OR Function

The syntax of the VBA OR function is

Condition1 OR Condition2 'or Condition1 OR Condition2 [...OR ConditionN]

The VBA OR function returns Boolean value either True or False. It returns TRUE, if any of the conditions are TRUE. Otherwise returns FALSE.

#### Parameters or Arguments

The OR function has one input parameter or argument.

Where

**Condition1 & Condition2:** Both are required parameters. Here we evaluate specified any of the conditions are true or not.

### Where we can apply or use VBA OR Function?

We can use this VBA OR function in MS Office 365, MS Excel 2016, MS Excel 2013, 2011, Excel 2010, Excel 2007, Excel 2003, Excel 2016 for Mac, Excel 2011 for Mac, Excel Online, Excel for iPhone, Excel for iPad, Excel for Android tablets and Excel for Android Mobiles.

### Example 1: Check any of the conditions are true or not(TRUE)

Here is a simple example of the VBA OR function. This below example macro checks any of the specified conditions. The output of below macro is TRUE.

'Check two conditions are true or not Sub VBA_OR_Function_Ex1() If (1 = 1) Or (5 = 5) Then MsgBox "Specified conditions are : TRUE ", vbInformation, "VBA OR Function" Else MsgBox "Specified conditions are : FALSE ", vbInformation, "VBA OR Function" End If End Sub

**Output:** Here is the screen shot of the first example output.

### Example 2: Check any of the conditions are true or not(FALSE)

Here is a another example of the VBA OR function. This below example macro checks any of the specified conditions. The output of below macro is FALSE.

'Check two conditions are true or not Sub VBA_OR_Function_Ex2() If 11 > 12 Or 12 > 13 Then MsgBox "Specified conditions are : TRUE ", vbInformation, "VBA OR Function" Else MsgBox "Specified conditions are : FALSE ", vbInformation, "VBA OR Function" End If End Sub

**Output:** Here is the screen shot of the second example output.

### Example 3: Check any of the conditions are true or not(TRUE)

Here is a simple example of the VBA OR function. This below example macro checks any of the specified conditions. The output of below macro is TRUE.

'Check more than two conditions are true or not Sub VBA_OR_Function_Ex3() If (1 = 1) Or (2 = 2) Or (3 = 3) Then MsgBox "Specified conditions are : TRUE ", vbInformation, "VBA OR Function" Else MsgBox "Specified conditions are : FALSE ", vbInformation, "VBA OR Function" End If End Sub

**Output:**Here is the screen shot of the third example output.

#### Instructions to Run VBA Macro Code or Procedure:

You can refer the following link for the step by step instructions.

Instructions to run VBA Macro Code

#### Other Useful Resources:

Click on the following links of the useful resources. These helps to learn and gain more knowledge.

VBA Tutorial VBA Functions List VBA Arrays in Excel Blog

VBA Editor Keyboard Shortcut Keys List VBA Interview Questions & Answers