A logical test in Excel (logical expression) returns only two types of values: TRUE or FALSE.
What is a logical test
For example, if you want to test that the cell B3 is equal to the string “Product”, use the following formula:
The formula has two outputs: TRUE or FALSE.
Steps to create a logical test
- Type an equal sign (=)
- Enter the first value or use a cell reference
- Select a logical symbol that you want to use for comparison
- Select the cell that contain the second value
Logical operators in logical test
List of the logical operators:
- = equal to
- > greater than
- >= greater than or equal to
- < less than
- <= less than or equak to
- <> not equal
Sometimes we use multiple logical tests in Excel formulas. Depending on your task, your formula may contain different logical tests. For example, to test if cell B8 is greater than 10 AND less than 20, you can use a formula like this: =AND(B8>10, B8<20). In this case, the formula returns TRUE or FALSE also.
Conditional formatting formulas
A logical test plays an important role in working with conditional formatting to highlight cells or ranges. In the example below, you want to highlight cells based on criteria. If the value in a range is greater than 40, apply the green fill.
Al logical tests work based on Boolean logic. Take a closer look at it!