A to Z of Excel Functions: the AND Function
3 August 2016
Welcome back to our regular A to Z of Excel Functions blog. Today we look at the AND Function.
The AND function
My old English teacher said you should never start or finish a sentence with the word “and”. AND is one of several Excel logic functions (others include NOT, OR and XOR). It returns TRUE if all of its arguments evaluate to TRUE; it returns FALSE if one or more arguments evaluate to FALSE.
One common use for the AND function is to expand the usefulness of other functions that perform logical tests. For example, the IF function performs a logical test and then returns one value if the test evaluates to TRUE and another value if the test evaluates to FALSE. By using the AND function as the logical_test argument of the IF function, you can test many different conditions instead of just one.
For example, imagine you are in New York on a Monday. Consider the expression
=AND(condition1, condition2, condition3)
- condition1 is the condition, “today is Monday”
- condition2 is the condition, “you are in New York” and
- condition3 is the condition, “this author is the best looking guy you have ever seen”.
This would clearly be FALSE as not everywhere in the world it would be Monday (i.e. condition1 would be breached)…
As alluded to above, the syntax for AND is as follows:
AND(logical1, [logical2], …)
- logical1: the first condition that you want to test that can evaluate to either TRUE or FALSE
- logical2: additional conditions that you want to test that can evaluate to either TRUE or FALSE, up to a maximum of 225 conditions. logical2 is optional and is not needed in the syntax.
It should be noted that:
- The arguments must evaluate to logical values, such as TRUE or FALSE, or the arguments must be arrays or references that contain logical values
- If an array or reference argument contains text or empty cells, those values are ignored
- If the specified range contains no logical values, the AND function returns the #VALUE! error values.
Please see my example below:
We’ll continue our A to Z of Excel Functions soon. Keep checking back – there’s a new blog post every other business day.