ShareYourGroupShareYourGroupExcel Formulas

Logical functions

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)
ArgumentWhat 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.

Sample sheet: Marks of eight students in three subjects. One Science mark is missing (cell D6 is empty).
ABCDE
1NameClassMathsScienceEnglish
2Asha8A788591
3Ravi8B455260
4Meena8A928879
5Kabir8B334138
6Tara8A6772
7Joy8B889084
8Neha8A546158
9Imran8B787369

How they work

FunctionReturns TRUE when
ANDall of its conditions are true
ORat least one of its conditions is true
NOTits 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

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.