0% found this document useful (0 votes)
11 views

Excel Logical Operators and Functions

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Excel Logical Operators and Functions

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Excel Logical Operators

and Functions
Logical Operators
A logical operator is used in Excel to compare two values. Logical operators are
sometimes called Boolean operators because the result of the comparison in any
given case can only be either TRUE or FALSE.

Formula
Condition Operator Description
Example

The formula returns TRUE if a value in cell A1 is equal to the values in cell B1;
Equal to = =A1=B1
FALSE otherwise.

The formula returns TRUE if a value in cell A1 is not equal to the value in cell
Not equal to <> =A1<>B1
B1; FALSE otherwise.

The formula returns TRUE if a value in cell A1 is greater than a value in cell B1;
Greater than > =A1>B1
otherwise it returns FALSE.

The formula returns TRUE if a value in cell A1 is less than in cell B1; FALSE
Less than < =A1<B1
otherwise.

The formula returns TRUE if a value in cell A1 is greater than or equal to the
Greater than or equal to >= =A1>=B1
values in cell B1; FALSE otherwise.

The formula returns TRUE if a value in cell A1 is less than or equal to the values
Less than or equal to <= =A1<=B1
in cell B1; FALSE otherwise.
Excel IF function
The syntax for IF is as follows:

As you see, the IF function has 3 arguments, but only the first one is obligatory, the other two are
optional.
• logical_test (required) - a value or logical expression that can be either TRUE or FALSE. In this
argument, you can specify a text value, date, number, or any comparison operator.
• value_if_true (optional) - the value to return when the logical test evaluates to TRUE, i.e. if the
condition is met.
• value_if_false (optional) - the value to be returned if the logical test evaluates to FALSE, i.e. if the
condition is not met.
Condition Operator Formula Example Description

If the number in cell A2 is greater than 5, the formula


Greater than > =IF(A2>5, "OK",)
returns "OK"; otherwise 0 is returned.

If the number in cell A2 is less than 5, the formula


Less than < =IF(A2<5, "OK", "")
returns "OK"; an empty string otherwise.

If the number in cell A2 is equal to 5, the formula


=IF(A2=5, "OK", "Wrong
Equal to = returns "OK"; otherwise the function displays "Wrong
number")
number".

=IF(A2<>5, "Wrong number", If the number in cell A2 is not equal to 5, the formula
Not equal to <>
"OK") returns "Wrong number "; otherwise - "OK".

Greater than If the number in cell A2 is greater than or equal to 5,


>= =IF(A2>=5, "OK", "Poor")
or equal to the formula returns "OK"; otherwise - "Poor".

Less than or If the number in cell A2 is less than or equal to 5, the


<= =IF(A2<=5, "OK", "")
equal to formula returns "OK"; an empty string otherwise.
Logical Functions: AND, OR, XOR, and NOT
Function Description Formula Example Formula Description

The formula returns TRUE if a value in cell A2 is


Returns TRUE if all of the
AND =AND(A2>=10, B2<5) greater than or equal to 10, and a value in B2 is
arguments evaluate to TRUE.
less than 5, FALSE otherwise.

The formula returns TRUE if A2 is greater than or


Returns TRUE if any argument equal to 10 or B2 is less than 5, or both conditions
OR =OR(A2>=10, B2<5)
evaluates to TRUE. are met. If neither of the conditions it met, the
formula returns FALSE.

The formula returns TRUE if either A2 is greater


Returns a logical Exclusive Or of than or equal to 10 or B2 is less than 5. If neither
XOR =XOR(A2>=10, B2<5)
all arguments. of the conditions is met or both conditions are
met, the formula returns FALSE.

Returns the reversed logical value


of its argument. I.e. If the The formula returns FALSE if a value in cell A1 is
NOT =NOT(A2>=10)
argument is FALSE, then TRUE is greater than or equal to 10; TRUE otherwise.
returned and vice versa.

You might also like