OR() – Checks multiple conditions and returns a value

The OR() function evaluates multiple conditions. If at least one of the conditions is true, it returns a specified trueValue. If all conditions are false, it returns a specified falseValue.

Syntax

OR(condition1, condition2, ..., trueValue, falseValue)

  • condition1, condition2, ...: Two or more logical expressions that can be evaluated as TRUE or FALSE (e.g., T1A1 > 10, T1B1 < 5).
  • trueValue: The value that is returned if any of the specified conditions evaluate to TRUE.
  • falseValue: The value that is returned if all of the specified conditions evaluate to FALSE.

Basic example

OR(T1A1 > 10, T1B1 < 5, "Yes", "No")

This example checks two conditions: if the value in cell T1A1 is greater than 10, OR if the value in cell T1B1 is less than 5.

  • If T1A1 = 15 (true) and T1B1 = 3 (true), it returns "Yes" (because at least one condition is true).
  • If T1A1 = 15 (true) and T1B1 = 10 (false), it returns "Yes" (because T1A1 > 10 is true).
  • If T1A1 = 5 (false) and T1B1 = 10 (false), it returns "No" (because both conditions are false).

Supported operators for conditions

Conditions use standard comparison operators:

  • > (greater than)
  • >= (greater than or equal to)
  • < (less than)
  • <= (less than or equal to)
  • == (equal to)
  • != (not equal to)

Key features

  • Multiple condition evaluation: Allows checking several logical statements at once.
  • "Any true" logic: Returns the trueValue if even one of the conditions is met.
  • Built-in branching: Directly specifies the outcomes (trueValue, falseValue) within the function, similar to an IF structure combined with OR logic.
  • Variable number of conditions: Can take multiple conditions before the trueValue and falseValue arguments.

Practical uses

  • Checking if a product is eligible for a discount based on several alternative criteria: OR(category == "Electronics", price > 1000, "Discount Applies", "No Discount").
  • Determining eligibility for a special offer: OR(IsMember == "Yes", PurchaseAmount > 100, HasCouponCode == "Valid", "Eligible for Offer", "Not Eligible").
  • Flagging entries that meet at least one of several warning conditions, such as an item being low in stock OR past its expiry date.

Common mistakes

  • Argument order: Ensuring all conditions are listed before the trueValue and falseValue arguments.
  • Text values not in quotes: The trueValue and falseValue, if text, must be enclosed in double quotes.
  • Confusing with AND logic: This function triggers trueValue if any condition is true, not necessarily all of them. For "all true" logic, use the AND() function.
  • Insufficient conditions: At least one condition must be provided before the true/false values.

Report issue

Features, Pricing, Documentation, Support, Login

MathGrid ©

Features,
Pricing,
Documentation,
Support,
Login

MathGrid ©

Back to top Arrow