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.
OR
Returns TRUE if any argument is TRUE.
NOT
Reverses the logic of its argument.
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 1 | Condition 2 | Result |
|---|---|---|
| TRUE | TRUE | TRUE |
| TRUE | FALSE | FALSE |
| FALSE | TRUE | FALSE |
| FALSE | FALSE | FALSE |
OR Logic
| Condition 1 | Condition 2 | Result |
|---|---|---|
| TRUE | TRUE | TRUE |
| TRUE | FALSE | TRUE |
| FALSE | TRUE | TRUE |
| FALSE | FALSE | FALSE |
NOT Logic
| Condition | Result |
|---|---|
| TRUE | FALSE |
| FALSE | TRUE |
Best Practices
- Use Parentheses - Make complex logic clear
- Test All Combinations - Verify all logical paths
- Document Complex Logic - Comment business rules
- Consider Short-Circuit - AND/OR stop at first definitive result
- 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
Related Operations
- Conditional Transforms - IF with combined conditions
- Validating Data - ISBLANK, ISNUMBER with logic
- Handle NULL - COALESCE with conditions
Additional Formula References
Additional examples will be added soon.