AND, OR and NOT functions in Excel
AND is true when every condition is true, OR when at least one is true, and NOT reverses a condition.
IF can test one condition. Real rules have several: pass in every subject, a discount if the customer is a member or the bill is large. AND, OR and NOT combine conditions into one answer that IF can use.
Syntax
=AND(logical1, [logical2], ...)=OR(logical1, [logical2], ...)=NOT(logical)| Argument | What it is |
|---|---|
logical1, logical2, ... | Conditions that are each true or false, such as C2>=33. |
Examples
Each result below is what Excel itself showed for the formula on the sample sheet.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Name | Class | Maths | Science | English |
| 2 | Asha | 8A | 78 | 85 | 91 |
| 3 | Ravi | 8B | 45 | 52 | 60 |
| 4 | Meena | 8A | 92 | 88 | 79 |
| 5 | Kabir | 8B | 33 | 41 | 38 |
| 6 | Tara | 8A | 67 | 72 | |
| 7 | Joy | 8B | 88 | 90 | 84 |
| 8 | Neha | 8A | 54 | 61 | 58 |
| 9 | Imran | 8B | 78 | 73 | 69 |
=AND(C2>=33,D2>=33,E2>=33)Result: TRUEAsha passed all three subjects, so every condition is true: TRUE.
=AND(C5>=33,D5>=33,E5>=33)Result: TRUEKabir has 33, 41 and 38. All three pass, TRUE.
=OR(C3>=90,D3>=90,E3>=90)Result: FALSEDid Ravi score 90 or more in any subject? No: FALSE.
=IF(AND(C4>=75,D4>=75,E4>=75),"Merit","")Result: MeritUsed inside IF: Meena has 92, 88 and 79, all at least 75, so Merit.
=IF(OR(C5<40,D5<40,E5<40),"Needs help","On track")Result: Needs helpKabir is below 40 in two subjects. One would be enough: Needs help.
=NOT(B2="8A")Result: FALSENOT turns TRUE into FALSE. Asha is in 8A, so the inner test is TRUE and the result is FALSE.
How they work
| Function | Returns TRUE when |
|---|---|
| AND | all of its conditions are true |
| OR | at least one of its conditions is true |
| NOT | its one condition is false |
Each returns only TRUE or FALSE. On their own those words are of limited use in a report. Their real job is to sit in the first slot of IF:
=IF(AND(condition1, condition2), result_if_both, result_otherwise)
Combining AND with OR
They can be nested. "A member, and either the bill is over 2,000 or it is a festival day" becomes AND(member="Yes", OR(bill>2000, festival="Yes")). Write the rule out in words first, with the brackets where you would pause, and then turn it into a formula.
A test on a whole range
AND and OR accept a range of conditions. =AND(C2:E2>=33) checks all three marks at once. In Excel 2021 and Microsoft 365 this works as typed. In older versions it must be entered with Ctrl, Shift and Enter together.
To count how many conditions are true, which AND and OR cannot do, use COUNTIF: =COUNTIF(C2:E2,">=33") gives the number of subjects passed.
NOT, and when to avoid it
NOT is useful for turning round a test that only exists one way, such as NOT(ISBLANK(A2)) for "the cell has something in it". For simple comparisons the opposite sign is clearer: B2<>"8A" says the same as NOT(B2="8A") and is easier to read.
Blank cells and text
An empty cell in a comparison such as D6>=33 counts as zero, so the test is FALSE. That may or may not be what you want. A student who was absent is not the same as a student who scored nothing. Test for the empty cell first: =IF(D6="","Absent",IF(D6>=33,"Pass","Fail")).
AND and OR do not work on rows inside SUM and COUNT formulas
A common wish is =SUM(IF(AND(A2:A10="North",B2:B10>100),C2:C10)). It gives the wrong answer, because AND squeezes the whole range into a single TRUE or FALSE. To add or count rows that meet several conditions, use SUMIFS and COUNTIFS, which are made for the job.
Common mistakes
- Writing the words between the conditions, as in
C2>=33 AND D2>=33. In Excel, AND is a function: the conditions go inside its brackets, separated by commas. - Using AND where OR is meant. "Region is North and South" can never be true of one row. In everyday speech we say "and" for a list of acceptable values. In a formula that is OR.
- Forgetting that OR is true when both are true. If you need "one or the other but not both", the function is XOR.
In Google Sheets
AND, OR and NOT are the same in Google Sheets.
Related functions
Every result on this page was calculated in Microsoft Excel (version 16.0, build 20326) on 12 November 2026, not typed by hand.
This is an independent help site. It is not connected with or approved by Microsoft. Excel and Microsoft 365 are trademarks of Microsoft Corporation, named here only to say which program a formula is for. The people and figures in the sample sheets are made up.