What is the use of AND function?
AND Function in Excel tests two or more conditions to see if they are all true.It returns TRUE if all conditions are TRUE, returns FALSE if any of the conditions is FALSE. AND function would be used in conjunction with another function such as IF function.
What is the syntax of AND function?
AND(condition1,condition2,..)
AND Function in Excel – Examples
Example 1: Returns TRUE as both conditions are satisfying
Example 2: Returns False asthe second condition is not satisfying
Example 3: Returns FALSE as both conditions are not satisfying
Example 4: Returns TRUE as both conditions are satisfying
Example 5: Returns TRUE as all 3 conditions are satisfying
Example on AND function in conjunction with IF Function
Example 6: AND Returns TRUE as both conditions are satisfying, IF retuns ‘Correct’ as the condition is TRUE
Example 7: AND Returns FALSE as the second condition is not satisfying, IF retuns ‘Not Correct’ as the condition is FALSE
VBA example on AND function
AND function is also available in VBA, following is the example code:
Dim sOutout As String
Dim iVal1 As Integer
Dim iVal2 As Integer
iVal1 =2100
iVal1 =3500If iVal1 > 2000 AND iVal2 >= 3000 then
sOutout=”Correct”
Else
sOutout=”Incorrect”
End If
Output: as both the conditons are TRUE value of sOutout will be “Correct”
Reference:
Please refer the below article for more Logical Excel functions.
Logical Excel Formulas
Please refer the below article for more Excel Functions.
Excel Formulas | Home