The OR function in Excel checks if *any* of the conditions you provide are true and returns TRUE or FALSE accordingly. It’s used primarily inside other functions like IF to create flexible logical tests, such as awarding bonuses when sales exceed a target *or* when a customer is premium-tier. No special setup is required—just know the data structure and condition logic you want to evaluate.
What You'll Need
- Microsoft Excel (any modern version: Excel 2010, 2013, 2016, 2019, 2021, or Microsoft 365)
- A cell with data you want to test (e.g., text, numbers, dates)
- Clear criteria for each condition (e.g., "A1 > 100", "B1 = "Premium"")
Step-by-Step
- Click the cell where you want the result of the OR test to appear.
- Type
=OR((include the opening parenthesis). - Enter your first condition. For example, if you want to test whether cell A2 is greater than 50, type
A2>50. Note: Excel treats text comparisons as case-insensitive and uses exact matches unless wildcards are used in other functions like SEARCH. - After the first condition, type a comma (,).
- Enter the second condition—e.g.,
A2<10orB2="Full". You can include up to 255 conditions in modern Excel versions. - Close the function with a parenthesis
)and press Enter. - If you plan to use OR inside an IF statement, wrap the OR function as the logical_test argument. For instance:
=IF(OR(A2>100,B2="Gold"),"Eligible","Not Eligible"). This returns "Eligible" if either sales exceed 100 *or* the tier is "Gold".
Common Mistakes
- Mixing up AND and OR logic: OR returns TRUE if *at least one* condition is true. If you need *all* conditions to be true, use AND instead.
- Forgetting to quote text values:
=OR(A1=Red)will cause an error because "Red" is text and must be quoted:=OR(A1="Red"). - Using OR directly as a cell value: OR only returns TRUE/FALSE; to display custom text, embed it in IF:
=IF(OR(...),"Yes","No"). - Incorrect cell references: Copying formulas without locking references (e.g., using A1 instead of $A$1) can cause conditions to shift unexpectedly. Use F4 to toggle absolute references.
- Overlooking data type mismatches: Comparing a number to a date (e.g.,
A1=30when A1 contains a date) may yield false results. Ensure data types align (use DATEVALUE or VALUE functions if needed).
Tips
- Combine with AND for layered logic: Use
=IF(OR(AND(A2>100,B2="Gold"),C2="VIP"),"Discount")to test compound conditions—e.g., either high sales *and* Gold tier, *or* VIP status. - Leverage named ranges for readability: Select your data range, then define a name (Formulas > Define Name). Replace cell references with names:
=OR(Sales>100,Tier="Platinum"). - Use OR in conditional formatting: Go to Home > Conditional Formatting > New Rule > Use a formula. Enter
=OR($A2>100,$B2="Urgent")and set a fill color to highlight rows meeting either condition. - Test conditions separately first: Enter each condition in its own column (e.g., column C:
=A2>100, column D:=B2="Gold") to verify they work before combining them. - Check for hidden spaces: Text like "Gold " (with a trailing space) won’t match "Gold". Use TRIM() inside OR:
=OR(TRIM(A1)="Gold",B1>100).
Troubleshooting
If your OR statement returns #NAME?, #VALUE!, or unexpected FALSE values, follow these steps:
- Check for typos in function names: OR must be capitalized correctly only if you’re in a locale where Excel doesn’t auto-capitalize functions—but Excel usually accepts lowercase. However, mistyping "ORR" or "O R" causes #NAME?.
- Verify parentheses balance: Every opening ( must have a closing ). Mismatched parentheses cause syntax errors.
- Ensure all referenced cells contain valid data: If A2 contains an error (e.g., #N/A), OR may propagate it. Wrap comparisons in IFERROR if needed:
=OR(IFERROR(A2>100,FALSE),B2="Gold"). - Confirm formula is in a cell, not text: If the formula appears as plain text (e.g., in a comment or as a string), Excel won’t evaluate it. Make sure the cell format is General or Number, not Text.
- Check regional settings: In some locales, commas separate arguments and semicolons are used instead (e.g., Excel in German uses
=OR(A1>100;B1="Gold")). If your formula shows #NAME? with commas but semicolons work, go to File > Options > Language and adjust the list separator. - Restart Excel: Rarely, Excel’s calculation engine may stall. Save, close, and reopen the file to refresh.
Frequently Asked Questions
Can I use OR with text, numbers, and dates in the same formula?
Yes. For example: =OR(A1="Active", B1>500, C1>DATE(2023,1,1)) checks if the status is "Active", the value exceeds 500, *or* the date is after January 1, 2023.
How do I make OR case-sensitive?
OR itself is case-insensitive. To force case sensitivity, wrap comparisons with EXACT: =OR(EXACT(A1,"Gold"),EXACT(A1,"GOLD")). Note: EXACT returns TRUE only if both text strings match *and* have identical casing.
Can I use OR in a filter or a pivot table?
Direct OR logic isn’t supported in Excel’s built-in AutoFilter or pivot filters. However, you can create a helper column using OR, then filter or group by that column. For example, add =IF(OR(A2>100,B2="Gold"),1,0) and filter for 1.
What’s the maximum number of conditions OR can handle?
In Excel 2016 and later (including Microsoft 365), OR supports up to 255 arguments. In older versions (e.g., Excel 2007), it’s limited to 30 conditions. Check your version under File > Account > About Excel.
Why does OR return TRUE when all conditions seem false?
This usually happens when one condition evaluates to TRUE unexpectedly. Common causes: blank cells (empty text "" or 0 may satisfy comparisons like A1="" or A1>0), or partial matches if used with functions like SEARCH. Double-check each condition in isolation.
Can I nest OR inside another OR?
Yes, and it’s often useful. Example: =OR(OR(A1>100,A1<10),B1="Standard") tests if A1 is either very high or very low *or* if B1 is "Standard". However, for readability, rewrite it as =OR(A1>100,A1<10,B1="Standard")—OR accepts multiple independent conditions without nesting.