Skip to main content

Combining Conditions (AND/OR/NOT)

Build complex logical conditions by combining multiple criteria using AND, OR, and NOT formulas.

Relevant Formulas

AND

Returns TRUE if all arguments are TRUE.

View AND Formula Reference →

OR

Returns TRUE if any argument is TRUE.

View OR Formula Reference →

NOT

Reverses the logic of its argument.

View NOT Formula Reference →

Basic Usage

AND - All Conditions Must Be True

=AND([age] >= 18, [has_license] = TRUE)
Result: TRUE only if both conditions are met

=IF(AND([quantity] > 0, [price] > 0), "Valid", "Invalid")

OR - Any Condition Can Be True

=OR([status] = "shipped", [status] = "delivered")
Result: TRUE if either condition is met

=IF(OR([priority] = "high", [amount] > 1000), "Priority", "Standard")

NOT - Reverse the Condition

=NOT([is_cancelled])
Result: TRUE if is_cancelled is FALSE

=IF(NOT(ISBLANK([email])), "Has Email", "No Email")

Common Use Cases

Eligibility Checks

// Check multiple requirements
=IF(AND([age] >= 21, [country] = "US", [verified] = TRUE),
"Eligible",
"Not Eligible")

Status Validation

// Check if order is in final state
=OR([status] = "completed", [status] = "cancelled", [status] = "returned")

Data Quality Flags

// Flag incomplete records
=IF(OR(ISBLANK([email]), ISBLANK([phone]), ISBLANK([address])),
"Incomplete",
"Complete")

Access Control

// Check multiple permissions
=AND([is_active] = TRUE, [role] = "admin", NOT([is_locked]))

Advanced Techniques

Combining AND/OR

// Premium customer: High value OR frequent purchaser AND active
=IF(AND(
OR([total_purchases] > 10000, [order_count] > 50),
[is_active] = TRUE
), "Premium", "Standard")

Nested Logic

// Complex business rules
=IF(AND(
[category] = "electronics",
OR([brand] = "Apple", [brand] = "Samsung"),
[price] > 500
), "High-End Electronics", "Other")

Multiple NOT Conditions

// Exclude certain states
=AND(
NOT([state] = "CA"),
NOT([state] = "NY"),
NOT([state] = "TX")
)

Common Patterns

Range Checking

// Check if value is within range
=AND([value] >= [min_value], [value] <= [max_value])

// Check if outside range
=OR([value] < [min_value], [value] > [max_value])

Status Combinations

// Active and not expired
=AND([is_active] = TRUE, NOT([is_expired] = TRUE))

// Any problematic status
=OR([status] = "error", [status] = "failed", [status] = "pending")

Multiple Field Validation

// All required fields present
=AND(
NOT(ISBLANK([name])),
NOT(ISBLANK([email])),
NOT(ISBLANK([phone]))
)

Truth Tables

AND Logic

Condition 1Condition 2Result
TRUETRUETRUE
TRUEFALSEFALSE
FALSETRUEFALSE
FALSEFALSEFALSE

OR Logic

Condition 1Condition 2Result
TRUETRUETRUE
TRUEFALSETRUE
FALSETRUETRUE
FALSEFALSEFALSE

NOT Logic

ConditionResult
TRUEFALSE
FALSETRUE

Best Practices

  1. Use Parentheses - Make complex logic clear
  2. Test All Combinations - Verify all logical paths
  3. Document Complex Logic - Comment business rules
  4. Consider Short-Circuit - AND/OR stop at first definitive result
  5. Break Down Complex Conditions - Use intermediate columns for clarity

Performance Considerations

  • Order Matters - Put most selective conditions first in AND
  • Avoid Redundancy - Simplify logical expressions
  • Use Appropriate Operator - AND for restrictive, OR for inclusive

Additional Formula References


Additional examples will be added soon.