Excel Logical Operators and Functions
Excel Logical Operators and Functions
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(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".