If you want Excel to check a condition and tell you whether it’s true or false, logical operators are what you use. For example, they can check whether a price is above a limit or a score has passed a cutoff.
They’re the small symbols and functions that let you compare values and build the yes/no logic behind formulas like IF.
Once you know the handful of operators and how they behave, you can write conditions for almost anything.
In this article, I’ll walk you through the comparison operators, the AND, OR, and NOT functions, and how to combine them inside an IF formula.
Follow along with the example file
Logical Operators in Excel.xlsx
What Logical Operators Do in Excel
A logical operator checks a condition and returns one of two values: TRUE or FALSE. That’s it.
So if you type =10>5 in a cell, Excel returns TRUE, because 10 is greater than 5. Type =10<5 and you get FALSE.
These TRUE and FALSE results are the building blocks. On their own they just answer a yes/no question, but you’ll usually feed them into a function like IF to decide what happens next.
There are two groups to know: the comparison operators (the symbols like > and =) and the logical functions (AND, OR, and NOT). We’ll cover both.
Comparison operators and the AND, OR, NOT, and IF functions work in all Excel versions, including 365, 2024, 2021, 2019, 2016, Mac, and the web. The single formulas that fill a whole column at once need Excel 365 or Excel 2021 and later.
Comparison Operators in Excel (= <> > < >= <=)
Comparison operators are the symbols you use to compare two values. Excel has six of them, and each one returns TRUE or FALSE.
Here is what each operator means:
| Operator | Name | Example | Result |
|---|---|---|---|
= | Equal to | =A2=100 | TRUE if A2 is 100 |
<> | Not equal to | =A2<>100 | TRUE if A2 is not 100 |
> | Greater than | =A2>100 | TRUE if A2 is above 100 |
< | Less than | =A2<100 | TRUE if A2 is below 100 |
>= | Greater than or equal to | =A2>=100 | TRUE if A2 is 100 or more |
<= | Less than or equal to | =A2<=100 | TRUE if A2 is 100 or less |
Notice that three of them are two-character symbols: >= (greater than or equal to), <= (less than or equal to), and <> (not equal to). You type the two characters one after the other with no space, with the greater or less sign first.
Let me show you how these work with real data.
Below I have a list of products and their prices, and I want to check in column C whether each price is above 500.

Enter this formula in C2, and it fills the whole column for you:
=B2:B10>500

For the Laptop at 850, this returns TRUE, because 850 is greater than 500. For a product priced at 500 or below, like the Monitor, it returns FALSE.
The > operator looks at each price on its left and the value on its right (500), and asks a simple question: is the left one bigger?
If yes, you get TRUE, and if no, you get FALSE. That’s the whole idea behind every comparison operator.
If you’re using Excel 2019 or earlier, enter this formula in C2 and copy it down to C10 instead:
=B2>500
Now let’s say you want to include 500 itself, not just prices above it. For that you use greater than or equal to:
=B2:B10>=500

The Monitor and the Headset, both priced at exactly 500, now return TRUE, because >= counts the value itself as a match. This small difference matters a lot when you’re setting cutoffs.
You can also compare text, not just numbers. Here is a formula that checks whether each product is a Laptop:
=A2:A10="Laptop"

This returns TRUE for the Laptop row and FALSE for the others.
One thing to keep in mind here is that text comparisons with = are not case-sensitive, so "Laptop", "laptop", and "LAPTOP" are all treated as equal.
If the case has to match too, use the EXACT function instead. =EXACT(A2,"Laptop") returns TRUE only when A2 has exactly that text, capital L included.
Since each comparison gives TRUE or FALSE, you can also count how many prices are above 500. Here, I want the count in B12, below the price list.

The easiest way is the COUNTIF function:
=COUNTIF(B2:B10,">500")

This returns 3, for the Laptop, the Printer, and the Docking Station.
Notice that inside the COUNTIF function (and the SUMIF function), the operator goes in quotes with the value, like ">500" or "<>East". This trips a lot of people up the first time, because everywhere else you type the operator without quotes.
The COUNTIF function is also safer than adding up the TRUE and FALSE results in C2:C10 from the first example. The SUM function skips TRUE and FALSE values inside a range, so =SUM(C2:C10) returns 0, not 3.
Using the AND, OR, and NOT Functions
The comparison operators check one condition at a time. When you need to test more than one condition together, Excel gives you three logical functions: AND, OR, and NOT.
Each of these also returns TRUE or FALSE, so they slot in wherever a comparison operator would.
Below I have students’ Math and English scores, where the passing mark is 40 in each subject, and I want to check their pass status in column D.

The AND Function
The AND function checks whether all the conditions you give it are true. You get TRUE only when every condition is true, and FALSE if even one fails.
Here is the formula to enter in D2 and copy down, which checks whether a student passed both Math and English:
=AND(B2>=40,C2>=40)

Priya scored 75 in Math and 60 in English, so this returns TRUE, because both scores are 40 or higher.
Rahul scored 55 in English but only 30 in Math, so he gets FALSE. AND only gives TRUE when everything passes.
Since AND is a function, the conditions go inside its parentheses, separated by commas. You can’t write B2>=40 AND C2>=40 the way you would in plain English.
The OR Function
The OR function is the more relaxed version of AND. It returns TRUE if at least one of the conditions is true, and only returns FALSE when every condition fails.
Here is a formula that checks whether a student passed at least one of the two subjects:
=OR(B2>=40,C2>=40)

Rahul failed Math with 30 but passed English with 55, so OR returns TRUE for him. One passing subject is enough.
The only FALSE is Emma, who scored 38 in Math and 35 in English. You’d only get FALSE if a student failed both subjects.
The NOT Function
The NOT function is the simplest of the three. It takes a single condition and flips it, so TRUE becomes FALSE and FALSE becomes TRUE.
Here is a formula that checks whether a student did not pass Math:
=NOT(B2>=40)

For Priya, who scored 75 in Math, the condition B2>=40 is TRUE, so NOT flips it to FALSE (she did pass, so “did not pass” is false).
For a single comparison like this, =B2<40 gives the same result and is shorter. NOT earns its place when you wrap a whole function like OR or AND, which you’ll see in the next section.
Combining Logical Operators Inside IF
On their own, TRUE and FALSE are useful, but most of the time you want Excel to actually do something based on the result. That’s where the IF function comes in.
IF takes a condition, and returns one value when it’s true and another when it’s false. Drop a comparison operator or a logical function into that condition, and you can build almost any rule you want.
Below I have an orders dataset with each customer’s order amount and region, and I want to apply a few business rules to it, with the result in column D.

Using IF with a Comparison Operator
Let’s start with the simplest case, a single condition.
Say any order of 1000 or more qualifies for free shipping. Here is the formula to enter in D2 and copy down:
=IF(B2>=1000,"Free Shipping","Standard")

Rahul’s order is 1200, so this returns Free Shipping, because 1200 is 1000 or more. An order below 1000 returns Standard.
The condition B2>=1000 is the logical operator doing its job. IF just reads the TRUE or FALSE it produces and picks the matching text.
Using IF with AND
Now let’s add a second condition. Say a customer qualifies for a bonus only if the order is 1000 or more and they’re in the East region.
Since both conditions must be true, you use AND inside IF:
=IF(AND(B2>=1000,C2="East"),"Bonus","No Bonus")

Rahul is in the East region with an order of 1200, so this returns Bonus, because both conditions are true.
Emma’s order is 1500, but she’s in the West region, so she gets No Bonus. The AND makes sure nothing slips through unless every part checks out.
Using IF with OR
Say you want to flag an order for review if it’s either very large (2000 or more) or it comes from the West region.
Only one of the two needs to be true, so you use OR:
=IF(OR(B2>=2000,C2="West"),"Review","OK")

Rahul’s order is 1200 and he’s in the East region, so this returns OK, because neither condition is met.
Priya’s order of 800 from the West region returns Review instead, because the West condition alone is enough to satisfy OR.
Using IF with NOT
Finally, let’s use NOT to flip a whole condition. Say standard delivery covers only the East and West regions, and every other order gets an extra charge.
Here, OR checks whether the region is East or West, and NOT flips that answer:
=IF(NOT(OR(C2="East",C2="West")),"Extra Charge","Standard")

Maria is in the North region, so OR returns FALSE, NOT flips it to TRUE, and the formula returns Extra Charge. Rahul is in the East region, so he gets Standard.
You could get the same result without NOT by swapping the two results: =IF(OR(C2="East",C2="West"),"Standard","Extra Charge"). NOT is handy when the rule in your head starts with “everything except”, because the formula then reads the same way.
In this article, I covered the six comparison operators, the AND, OR, and NOT functions, and how to combine them inside an IF formula to build real conditions.
I hope you found this article helpful.
Other Excel Articles You May Also Like: