AND & OR Functions: Build Complex Logic in IF Statements

AND & OR Formula in Excel Blogpost Feature Image
Learn how to use AND and OR in Excel IF statements to test multiple conditions. Covers nested logic, the NOT function, conditional formatting, and SUMPRODUCT patterns.

A single IF statement tests one condition. Many real-world tasks, however, require several conditions at once — approve a discount only if the customer is VIP and the order is above £500, or flag a shipment if it is late or damaged. The AND function returns TRUE only when every condition is met. The OR function returns TRUE when at least one condition is met.

By nesting AND or OR inside IF, you gain precise control over multi-condition decisions. Consequently, formulas that previously needed several nested IFs become a single, readable line.

Availability: AND and OR work in every Excel version from Excel 2000 onwards, including Microsoft 365, Excel 2024, 2021, 2019, and 2016. Each function accepts up to 255 conditions.

What Is the Syntax for AND and OR?

Both functions share the same repeating pattern — a list of conditions separated by commas.

=AND(logical1, [logical2], ...) → TRUE only if ALL conditions are TRUE =OR (logical1, [logical2], ...) → TRUE if ANY condition is TRUE
ArgumentRequired?What it does
logical1RequiredThe first condition to evaluate. This must be an expression that returns TRUE or FALSE — for example, A2>100 or B2="Active".
logical2…OptionalAdditional conditions. Up to 255 are allowed. Each is evaluated independently, and the results are combined according to the AND or OR rule.

How Do AND and OR Evaluate Conditions?

The key difference between the two functions is how they combine TRUE and FALSE results. AND is strict — one FALSE brings the whole result down to FALSE. OR is lenient — one TRUE is enough to produce TRUE.

AND Truth Table

Condition 1Condition 2AND result
TRUETRUETRUE
TRUEFALSEFALSE
FALSETRUEFALSE
FALSEFALSEFALSE

OR Truth Table

Condition 1Condition 2OR result
TRUETRUETRUE
TRUEFALSETRUE
FALSETRUETRUE
FALSEFALSEFALSE
Quick memory aid: Think of AND as a strict manager — everyone must agree. Think of OR as a lenient one — any agreement is enough. This mental model transfers directly to every formula you write with these functions.

Example 1: IF with AND — All Conditions Must Pass

Use IF(AND(...)) when every condition must be TRUE before the formula takes action. For instance, a sales bonus should only apply if the rep has hit both a revenue target and an account target. Meeting just one of the two is not enough.

1
Award a bonus only when both the revenue target AND account target are met
A — Rep
B — Revenue
C — Accounts
AND result
D — Bonus
Sarah
£52,000
12
TRUE ✓
£2,600
James
£48,000
14
FALSE ✕
£0
Ellen
£61,000
9
FALSE ✕
£0
Revenue target = £50,000 (in G1). Account target = 10 (in G2). Bonus = 5% of revenue if BOTH targets are met, otherwise zero: =IF(AND(B2>=$G$1, C2>=$G$2), B2*0.05, 0) Add a third condition — also check the rep is still "Active" (column D): All three must be TRUE for the bonus to apply. =IF(AND(B2>=$G$1, C2>=$G$2, D2="Active"), B2*0.05, 0)
James hits the account target (14) but misses the revenue target (£48k < £50k). Because AND requires both, the result is FALSE and the bonus is £0. Ellen is the opposite — great revenue, too few accounts. Consequently, she also receives nothing.

Example 2: IF with OR — Any Condition Triggers the Result

Use IF(OR(...)) when any one condition being TRUE is enough to trigger a result. This is ideal for exception flagging, eligibility checks, and alert systems — where several different situations all lead to the same action.

2
Flag an order as needing review if it is late OR damaged OR over the budget limit
A — Order
B — Late?
C — Damaged?
D — Cost
OR result
E — Flag
ORD-001
No
No
£800
FALSE
ORD-002
Yes
No
£400
TRUE ✓
Review
ORD-003
No
No
£1,200
TRUE ✓
Review
Flag if the order is late OR damaged OR over the £1,000 budget limit: =IF(OR(B2="Yes", C2="Yes", D2>1000), "Review", "—") Useful with status columns — flag if status is any of several values: =IF(OR(B2="Cancelled", B2="Returned", B2="Disputed"), "Closed", "Open") Simpler alternative for matching a list of values — use COUNTIF as OR: Returns "Match" if the cell value appears anywhere in the list G1:G5. =IF(COUNTIF($G$1:$G$5, B2)>0, "Match", "")

Example 3: Combine AND and OR in One Formula

Real scenarios often need both functions together. For instance, a discount might apply if the product is in a specific category AND (the customer is a VIP OR the order quantity is above 50). Nesting AND inside OR, or vice versa, handles these combined conditions cleanly.

How to Structure Nested AND and OR

Place the stricter gate — the AND — as the outer function, and put the alternatives — the OR — inside it. Alternatively, think of it in plain English first, then translate. Writing the logic in words before typing the formula prevents bracket errors and saves time.

3
Apply a 15% discount: product must be "Widget" AND customer must be VIP OR order qty > 50
A — Product
B — Customer tier
C — Qty
D — Price
E — Final price
Widget
VIP
30
£100
£85.00 (−15%)
Widget
Standard
60
£100
£85.00 (−15%)
Gadget
VIP
80
£100
£100.00 (no discount)
Plain English rule: "Apply 15% discount if product is Widget AND (customer is VIP OR qty > 50)" Translated to Excel — AND wraps the outer rule, OR handles the inner alternatives: =IF(AND(A2="Widget", OR(B2="VIP", C2>50)), D2*0.85, D2) Gadget row: AND fails immediately because A2 ≠ "Widget". OR is not evaluated. Discount does not apply. Reverse structure — OR wrapping AND: "Apply flag if (order is late AND from Region A) OR (order is over budget AND from Region B)" =IF(OR( AND(B2="Late", C2="A"), AND(D2>1000, C2="B") ), "Escalate", "")
Write the logic in plain English first: Before typing any formula, write the rule as a sentence: "X and (Y or Z)". Then translate each clause. This approach prevents bracket mistakes and makes the formula much easier to audit later.

Example 4: AND and OR Without IF — Standalone Use

AND and OR do not have to live inside IF. Both functions return TRUE or FALSE directly, which makes them useful on their own. Specifically, you can use the standalone result in conditional formatting rules, data validation, or as an input to SUMPRODUCT and other array-aware functions.

4
Use AND and OR directly in conditional formatting and data validation
Standalone — check if today falls on a weekday in Q1 (Jan–Mar): Used directly as a conditional formatting rule or helper cell. AND(MONTH(TODAY())<=3, WEEKDAY(TODAY(),2)<=5) Conditional formatting formula — highlight rows where region is East OR North: Apply to entire row; lock the column reference with $. OR($C1="East", $C1="North") Data validation — allow entry only when BOTH fields in B1 and C1 are filled: Set the custom validation formula on cell D1. AND(B1<>"", C1<>"") SUMPRODUCT with AND logic — sum sales where region is East AND amount > 500: In SUMPRODUCT, multiply Boolean arrays instead of using AND directly. =SUMPRODUCT((A2:A100="East")*(B2:B100>500)*B2:B100) SUMPRODUCT with OR logic — use + instead of * between conditions: Flag converts any non-zero result to 1 with MIN. =SUMPRODUCT(MIN((A2:A100="East")+(A2:A100="North"),1)*B2:B100)
In SUMPRODUCT, use multiplication (*) for AND logic and addition (+) for OR logic. Multiplication zeroes out any row where one condition fails. Addition keeps rows where either condition is met — exactly mirroring how AND and OR behave in IF formulas.

Example 5: The NOT Function — Invert a Condition

NOT is the third member of the logical family. It simply reverses TRUE to FALSE and FALSE to TRUE. This is useful when it is easier to define what you do not want than what you do. Additionally, NOT pairs naturally with AND and OR to express exclusion logic.

5
Use NOT to exclude a condition — flag rows that are NOT complete
NOT reverses the result of any logical expression. Flag tasks that are NOT complete: =IF(NOT(C2="Complete"), "Outstanding", "") Equivalent to: =IF(C2 <> "Complete", "Outstanding", "") NOT with AND — true when NOT (A2=1 AND B2=1): Flags rows where it is NOT the case that both conditions are true. =IF(NOT(AND(A2="Active", B2>0)), "Check needed", "") NOT with OR — true when NEITHER condition is true (neither late NOR damaged): This is equivalent to AND(B2 <> "Yes", C2 <> "Yes"). =IF(NOT(OR(B2="Yes", C2="Yes")), "Clear", "Flag") Conditional formatting: highlight rows that are NOT in a list of approved regions. Formula (applied to the whole row, column A locked with $): NOT(COUNTIF($G$1:$G$5, $A1)>0)
NOT(OR(...)) equals AND with all conditions reversed: NOT(OR(A, B)) is logically identical to AND(NOT(A), NOT(B)). However, NOT(OR(...)) is usually shorter and clearer when you want to express "neither of these is true". Choose the form that most closely matches how you think about the rule.

Example 6: Multi-Level Eligibility Check

A common real-world challenge is determining eligibility across several tiers. For example, premium support might be available to customers who are both on an Enterprise plan and have been active for over 12 months — OR to any customer who has spent over £10,000 regardless of their plan. Nesting AND and OR makes this kind of tiered logic straightforward to express and audit.

6
Determine premium support eligibility across two independent qualifying paths
A — Customer
B — Plan
C — Months active
D — Lifetime spend
E — Eligible?
Acme Ltd
Enterprise
18
£6,000
Yes (path 1)
Globex
Starter
6
£12,000
Yes (path 2)
Initech
Pro
8
£4,000
No
Path 1: Enterprise plan AND active for 12+ months. Path 2: Lifetime spend over £10,000 (any plan, any tenure). Eligible if EITHER path is satisfied: =IF(OR( AND(B2="Enterprise", C2>=12), D2>10000 ), "Yes", "No") Add a third disqualifier — exclude customers with open disputes (column F): Eligible if (path 1 OR path 2) AND no open dispute. =IF(AND( OR(AND(B2="Enterprise", C2>=12), D2>10000), F2<>"Disputed" ), "Yes", "No")
Acme qualifies via Path 1 (Enterprise + 18 months). Globex qualifies via Path 2 (£12k spend). Initech qualifies for neither — Pro plan with insufficient tenure and spend. The outer OR confirms eligibility as soon as one path is satisfied.

How to Fix Common AND and OR Errors

#VALUE! error in AND or OR

This error appears when a condition inside AND or OR evaluates to something that is neither TRUE nor FALSE — for example, a text string or an empty cell used in a numeric comparison. Check each condition individually by typing it into a spare cell. If it returns an error, fix that condition before rebuilding the full formula.

Formula returns the wrong result

Often this is a logic order issue. AND and OR do not short-circuit in the same way as some programming languages — Excel evaluates all conditions. Also check operator precedence: AND evaluates before OR when both appear at the same nesting level. Consequently, use parentheses to make your grouping explicit.

Text comparisons fail despite matching values

IF, AND, and OR are not case-sensitive — "Active" and "ACTIVE" match equally. However, trailing spaces cause silent failures. A cell containing "Active " (with a trailing space) does not match "Active". Wrap the cell reference in TRIM to clean it before comparing: =AND(TRIM(B2)="Active", C2>0).

AND and OR cannot test ranges directly: =AND(A2:A10>0) does not check each cell. In most Excel versions, it evaluates only the first cell. To check all cells in a range, use SUMPRODUCT: =SUMPRODUCT((A2:A10>0)*1)=9 confirms all nine cells are positive. In Excel 365, array-entered AND and OR work differently — but SUMPRODUCT remains the most compatible approach.

Frequently Asked Questions

  • What is the difference between AND and OR in Excel?+
    AND returns TRUE only when every condition is TRUE. If even one condition is FALSE, AND returns FALSE. OR, by contrast, returns TRUE as soon as any single condition is TRUE. OR only returns FALSE when every condition is FALSE. Use AND when all criteria must pass simultaneously — for example, approving a loan. Use OR when any qualifying condition is sufficient — for example, flagging an issue.
  • How do I use AND or OR inside an IF statement?+
    Place AND or OR as the first argument of IF — the logical test: =IF(AND(condition1, condition2), value_if_true, value_if_false). For OR, replace AND with OR. Excel evaluates the inner function first, gets TRUE or FALSE, and then uses that result to decide which value to return. You can also nest AND inside OR, or OR inside AND, to express more complex rules.
  • Can I use AND and OR in SUMPRODUCT?+
    Yes, but the syntax is different. In SUMPRODUCT, AND logic uses multiplication (*) between conditions, and OR logic uses addition (+). For example, =SUMPRODUCT((A2:A100="East")*(B2:B100>500)*C2:C100) sums column C where both conditions are met (AND). Addition handles OR: =SUMPRODUCT(((A2:A100="East")+(A2:A100="North")>0)*C2:C100). This approach works in all Excel versions without Ctrl+Shift+Enter.

More Questions About Logical Functions

  • How many conditions can AND and OR handle?+
    Both AND and OR accept up to 255 arguments in Excel 2007 and later. In practice, however, formulas with more than five or six conditions become difficult to read and maintain. For large lists of conditions, consider alternatives — for instance, IFS for sequential tests, SWITCH for exact matches, or COUNTIF for checking whether a value appears in a list. These options are often more readable for complex rules.
  • What does the NOT function do?+
    NOT reverses a logical value — TRUE becomes FALSE and FALSE becomes TRUE. It takes exactly one argument: =NOT(logical). For example, =NOT(A2="Complete") returns TRUE when A2 does NOT contain "Complete". NOT is especially useful in conditional formatting rules where it is clearer to state what you want to exclude rather than what you want to include. It also combines naturally with AND and OR for complex exclusion logic.
  • Which Excel versions support AND, OR, and NOT?+
    All three functions are available in every Excel version from Excel 2000 onwards, including Microsoft 365, Excel 2024, 2021, 2019, 2016, 2013, 2010, 2007, and earlier versions. They also work in Excel for the web and Google Sheets. No special version, add-in, or setting is needed to use them.