VBA AND 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 all the conditions are TRUE. This function is used to combine more than one condition with using ‘AND’ keyword. This is one of the most used logical operator. It has minimum two conditional input parameters. It returns a Boolean value either True or False.

We can use this function as a worksheet function and also use in VBA. This function use in either procedure or function in a VBA editor window in Excel. We can use this VBA AND 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 AND function, where we can use this VBA AND function and real-time examples.

**Table of Contents:**

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

## Syntax of VBA AND Function

The syntax of the VBA AND function is

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

The VBA AND function returns Boolean value either True or False. It returns TRUE, if all conditions are TRUE. Otherwise returns FALSE.

#### Parameters or Arguments

The AND function has one input parameter or argument.

Where

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

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

We can use this VBA AND 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 two conditions are true or not(TRUE)

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

'Check two conditions are true or not Sub VBA_AND_Function_Ex1() If (A = A) And (1 = 1) Then MsgBox "Specified conditions are : TRUE ", vbInformation, "VBA AND Function" Else MsgBox "Specified conditions are : FALSE ", vbInformation, "VBA AND Function" End If End Sub

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

### Example 2: Check two conditions are true or not(FALSE)

Here is a another example of the VBA AND function. This below example code checks two specified conditions. The output of below macro is FALSE.

'Check two conditions are true or not Sub VBA_AND_Function_Ex2() If (A = A) And (1 = 2) Then MsgBox "Specified conditions are : TRUE ", vbInformation, "VBA AND Function" Else MsgBox "Specified conditions are : FALSE ", vbInformation, "VBA AND Function" End If End Sub

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

### Example 3: Check two conditions are true or not(TRUE)

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

'Check more than two conditions are true or not Sub VBA_AND_Function_Ex3() If (A = A) And (1 = 1) And (Z = Z) Then MsgBox "Specified conditions are : TRUE ", vbInformation, "VBA AND Function" Else MsgBox "Specified conditions are : FALSE ", vbInformation, "VBA AND 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