Knowledge base / Excel

OR in Excel: alternatives, boundaries and conditional formatting

I explain why two true conditions still produce TRUE and how to avoid accidentally accepting every number when checking an interval.

Kajo RudzińskiPublished Updated 5 min read

Two channels meet in a basin illuminated by one active stream.

I use OR when at least one condition is enough. For example, an order enters a review queue if its amount exceeds a threshold or its quantity is large. I write that rule in words first. Then I choose comparisons that preserve the distinction between at least one, exactly one and all conditions. Those requirements can sound similar in conversation while producing different classifications in a spreadsheet.

Syntax and truth values

The OR documentation defines TRUE when any condition is true and FALSE when all are false, with up to 255 conditions. Its basic syntax is:

=OR(logical1, [logical2], ...)

Square brackets identify optional arguments in syntax descriptions; omit them from an actual formula. I use commas in the English examples and semicolons in Polish. List separators depend on regional settings, so translating a function name may not be the only adjustment needed when copying a formula between environments.

First condition Second condition OR AND
FALSE FALSE FALSE FALSE
TRUE FALSE TRUE FALSE
FALSE TRUE TRUE FALSE
TRUE TRUE TRUE TRUE

The last row matters: both conditions being true still produces TRUE. OR does not mean exactly one condition. Meanwhile, AND requires all conditions to hold. I compare these four cases before using a formula in a larger report, because each represents a different combination the business rule needs to handle.

Example: amount or quantity

The following data is synthetic. Column A contains amounts and B contains quantities. Both contain valid numbers, without blanks or errors. I want to flag a row when the amount exceeds 1000 or quantity exceeds 50. In C2, copied down, I use:

=OR(A2>1000,B2>50)
Row A: amount B: quantity Result C
2 1200 20 TRUE
3 900 60 TRUE
4 1000 50 FALSE
5 1200 60 TRUE

The first criterion is enough in row two, and the second is enough in row three. Row four sits exactly at both boundaries, so neither strict comparison passes. Both conditions pass in row five. To include the boundaries, deliberately choose >= instead of >. Changing an operator merely to obtain the expected color can conceal a disagreement about the actual requirement.

For a label, I use the documented combination of IF and OR:

=IF(OR(A2>1000,B2>50),"Review","Not flagged")

“Not flagged” says only that these criteria did not match. It does not establish that the order is correct or free of other problems. I prefer it to “All good,” which would imply a broader check than the formula performs.

The interval trap

Suppose a number should be outside the inclusive interval from 10 to 20. For a valid numeric value in A2, I write:

=OR(A2<10,A2>20)

This gives TRUE for 9, FALSE for 10, 15 and 20, and TRUE for 21. The conditions describe separate regions outside the interval. In contrast, =OR(A2>=10,A2<=20) accepts every ordinary number. Below 10, the second comparison is true; above 20, the first is true; inside the interval, both are true. To check membership in that interval, use AND. The choice changes the meaning of the rule, even though each formula is syntactically valid.

Three trays containing different sets of objects lead to a shared container while an empty tray stays separate.

Highlight an entire row

Select A2:C5 and create a conditional formatting rule based on a formula. With A2 active, use:

=OR($A2>1000,$B2>50)

The dollar signs fix columns A and B, while the row remains relative. Each row therefore checks the appropriate order. Microsoft explains logical results and references in conditional formatting. Also inspect the rule’s Applies to range: a correct formula cannot format rows outside that selection.

I treat color as an aid to inspection. If someone will filter or reuse the report, I also retain the result column. This makes the rule visible without requiring the reader to infer a color’s meaning. When the first row changes, I check whether the references still point to the intended records instead of assuming the formatting moved correctly with the surrounding layout.

Ranges, missing inputs and errors

=OR(A2,B2) can be valid when those cells contain logical values. Missing comparison operators do not automatically make it wrong. For amounts, I prefer explicit comparisons because they expose the business criterion. A raw cell reference does not communicate the same requirement as “amount greater than the threshold,” even when the resulting formula happens to return a logical value.

The documentation states that text and empty cells in a supplied range are ignored, and a range with no logical values can return #VALUE!. Do not apply that statement indiscriminately to comparisons involving blank cells: a comparison is evaluated before OR combines its result. That is why the numeric examples assume checked input types. Missing data requires a separate decision about meaning. A logical classification is not a substitute for validating the underlying fields.

OR produces one result. Applied to logical cells, =OR(C2:C5) asks whether any of them is TRUE. It does not return four independent classifications or count matching orders. Keep a formula in each row for separate assessments. For counting a prepared result column, consider COUNTIF with an appropriate criterion. Choose the operation based on whether your question concerns existence, classification or a count.

Practice with boundaries

Change the rule to include an amount equal to 1000 and a quantity equal to 50. Write the expected result for row four before changing the operators. Then consider an order with no quantity recorded. Does that prevent classification, or is a confirmed amount enough? Agree on what the missing value means before building the formula. Additional conditions cannot supply a business decision that has never been made.

Key takeaways

Does OR return FALSE when both conditions are true?

No. OR is inclusive: it also returns TRUE when both conditions are true.

Does OR count matching rows?

No. It returns one logical result. Use a formula in each row for separate assessments and an appropriate counting function for counts.

Does OR validate my source data?

No. The numeric examples assume numeric inputs. Missing values, text and errors need separate checks and an explicit interpretation.

AI was used in an automated way while working on this article. If you want to learn how to do it too, check out this project.

Kajo Rudziński

Newsletter KajoData

Let’s keep in touch.

I write about data analysis, learning and changing careers. My newsletter and the sign-up form are in Polish. If that works for you, I’d be glad to see you there.