The Excel AND function returns TRUE if all conditions are TRUE. It returns FALSE if any of the conditions are FALSE.
To determine whether the return will be TRUE or FALSE, the function evaluates at least one mathematical expression located in another cell in the spreadsheet.
The syntax for the AND function is:
=AND (Condition1, Condition2, ...)
condition is something that you want to test that can either be TRUE or FALSE.
Note: In Excel 2007, the AND function can contain a maximum of 255 conditions. For earlier versions of Excel, the limit is 30 conditions.
To use the AND() function (an example)
· Type in the text in Excel A1 and A2 as follow:
· Click on any cell that you wish the result to appears. Type the functions below, the AND function will return the following results:
=AND(A1>10, A1<100)>would return TRUE.
=AND(A1=88, A2="Microsoft") would return FALSE.
=AND(A1>=50, A1<=88, A2="Microsoft Excel") would return TRUE.
To combine the AND function with IF function
· Let’s look at the following example that shows nesting the AND function inside the IF function.
· In the spreadsheet, type-in the following values accordingly:
Cell C1: 75
Cell C2: 95
Cell C3: 85
· Click on the cell C5 and enter the function below.
=IF(AND(B1>80,B2>80,B3>80),"Good","Not Good")
· If all three of these cells (C1,C2 and C3) contains a value greater than 80, the IF function will show the statement Good in cell C5.
· If any of these three cells contain a number less than or equal to 80, the IF function shows the statement Not Good in cell C5.
· So, the result in cell C5 will be Not Good since the cell C1 contains value that is less that 80.