Today I will discuss about a logical function ‘AND’ which is
widely used in Microsoft Excel with other Logical functions like ‘IF’ as well
as other functions.
We had already discussed
about this function while discussing IF function, i.e., nested IF with AND
function but we will discuss it here in detail.
Sometimes you may face situations
where you should take decision based on the output of two or more conditions return
TRUE otherwise the decision will be another.
Let’s take an example of
an Examination in three subjects, if any student gets the pass marks (50) in
all (three) subject in a test then only he will be declared as ‘PASSED’ else he
would be declared as ‘FAILED’.
So normally we say that
if Harry, a student, gets 50 marks in Subject 1 and 50 marks in Subject 2 and
50 marks in Subject 3 then he has ‘PASSED’ the test.
What we are doing here is
we are testing each subject one after another whether the marks obtained is
greater than 50 or not, if marks of any subject are less than 50 then the student
will be called ‘FAILED’.
Here we can use AND
function.
So, let’s discuss about
AND function.
The Microsoft Excel AND
function returns TRUE if all conditions are TRUE. It returns FALSE if any of
the conditions are FALSE.
The AND function is a
built-in function in Excel that is categorized as a Logical Function.
Syntax
The syntax for the AND
function in Microsoft Excel is very simple
=AND(logical1, logical2, ... )
Parameters or Arguments
logical1
The first condition to
test whether it is TRUE or FALSE.
logical2,
Returns
The AND function returns
TRUE if all conditions are TRUE.
The AND function returns
FALSE if any of the conditions are FALSE.
The below image will make
it more clear.
How AND function Works |
Example :
It is very easy to use
AND function, type =AND( and then write the conditions separated by comma.
Suppose we have two
numbers 101 & 111 in two cells C4 & D4, now if we write AND function
the formula will be =AND(C4>100,C5>100)
which will return TRUE because both the numbers are greater than 100.
If we write any number less
than 100, the output will be FALSE.
This was simple,
now we will use this
function with IF function, suppose we need to print “OK”, if both the values
are greater than 100 and “Not OK” if any of the value is less than 100.
We will do it in simpler
way, we will add IF function in the beginning of the above formula
=AND(C4>100,C5>100)
and the formula will be
=IF(AND(C4>100,C5>100),"OK","Not
OK").
In same way, you can use
AND function in other function (like SEARCH, FIND etc.) to make more complex formula
as per requirement.
In the next article, we
will discuss about OR function and there will make some more complex formula
using AND & OR functions.
I hope you have
enjoyed this article. Take care…
Thank you for reading….
No comments:
Post a Comment