To show OR in Excel, you use the OR function or the OR operator inside formulas. The OR function returns TRUE if any of its conditions are true, and FALSE only if all are false. For example, =OR(A1>10, B1="Yes") returns TRUE if either A1 is greater than 10 or B1 equals "Yes". You can also use the OR operator in conditional formatting, data validation, and IF statements to display custom results like "Pass" or "Fail". No add-ins are required; the function is built into every modern version of Excel, including Excel for Microsoft 365, Excel 2019, 2021, and Excel for the web.
What You'll Need
- A computer or tablet with Excel installed (desktop, web, or mobile app).
- A spreadsheet with at least two columns or cells to test conditions against.
- Basic familiarity with typing formulas into the formula bar.
Step-by-Step
- Open your workbook and click the cell where you want the OR result to appear. This can be any empty cell.
- Type the OR function starting with an equals sign:
=OR(. Excel will show a tooltip listing the arguments: logical1, logical2, and so on. Each argument is a condition that evaluates to TRUE or FALSE. - Enter your first condition, for example
A2>100. This checks whether the value in A2 is greater than 100. - Add a comma and enter a second condition, such as
B2="Paid". You can add up to 255 conditions, but two or three are typical. - Close the parenthesis and press Enter. The cell now shows TRUE or FALSE. If you see an error like #VALUE!, one of your conditions is not a logical test (for example, you typed text without quotes).
- Wrap OR inside IF to show custom text instead of TRUE/FALSE. For example:
=IF(OR(A2>100, B2="Paid"), "Flag", "OK"). This displays "Flag" when either condition is met, otherwise "OK". - Use OR in conditional formatting to highlight rows. Select your data range, go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format, and enter a formula like
=OR($A2>100, $B2="Paid"). Choose a fill color and click OK. Note that menu labels can differ slightly by Excel version and region. - Use OR in data validation (optional). Select a cell, go to Data > Data Validation, choose Custom, and enter a formula such as
=OR(A1="Yes", A1="No")to restrict input to those two values. - Copy the formula down by dragging the fill handle. Relative references adjust automatically; use absolute references ($A$2) if you want a condition to stay fixed.
Common Mistakes
- Forgetting quotes around text.
=OR(A1=Yes)returns #NAME? because Excel looks for a named range called Yes. Use=OR(A1="Yes"). - Using OR where AND is needed. OR returns TRUE if any condition is true; AND requires all conditions to be true. Mixing them up gives wrong flags.
- Not anchoring references in conditional formatting. If you select A2:B10 and write
=OR(A2>100, B2="Paid")without dollar signs, the rule shifts incorrectly across columns. Use$A2and$B2to lock the columns. - Expecting OR to return a number. OR returns only TRUE or FALSE. Wrap it in IF, SUM, or another function to produce numbers or text.
- Typing OR as text in a cell. If you type OR without the equals sign, Excel treats it as plain text, not a formula.
Tips
- Use OR inside SUMPRODUCT or COUNTIF with array formulas for counting rows that meet any of several conditions. For example,
=SUMPRODUCT(--((A2:A100>100)+(B2:B100="Paid")>0))counts rows where either condition is true. - Combine OR with ISBLANK to flag missing data:
=OR(ISBLANK(A2), ISBLANK(B2)). - For readability, name your ranges (Formulas > Define Name) and use those names in OR conditions.
- Test each condition separately in its own cell before combining them; this isolates which part is failing.
- Remember that OR ignores text and empty cells in logical tests unless you explicitly compare them.
Troubleshooting
- #VALUE! error: One argument is not a logical test. Check that comparisons use operators like =, >, <, and that text is in quotes.
- #NAME? error: Excel does not recognize a name. Likely missing quotes around text or a misspelled function name.
- Formula shows as text: The cell is formatted as Text, or the formula lacks the leading equals sign. Change the format to General and retype the formula.
- Conditional formatting not applying: Check the rule order and that "Stop If True" is not blocking it. Also confirm the formula uses relative references correctly for the top-left cell of the selected range.
- OR returns TRUE unexpectedly: One condition may be evaluating as text that looks like a number, or a blank cell is being compared. Use ISTEXT or ISNUMBER to inspect.
- If that did not work: Rebuild the formula one condition at a time in separate cells, then combine them. Save a backup before making bulk changes.
Frequently Asked Questions
What is the difference between OR and the OR operator?
The OR function is written as =OR(condition1, condition2). The OR operator is not a standalone symbol in Excel; instead, you use the plus sign (+) in array formulas to simulate OR logic, or you use the OR function inside other functions. There is no "||" operator in standard Excel formulas.
Can I use OR with more than two conditions?
Yes. OR accepts up to 255 arguments. Separate each condition with a comma: =OR(A1>10, B1<5, C1="Yes").
How do I show "Yes" or "No" instead of TRUE/FALSE?
Wrap OR in an IF function: =IF(OR(A1>10, B1="Yes"), "Yes", "No").
Does OR work in Excel for the web and mobile?
Yes, the OR function is supported in Excel for the web, Excel for iPad/iPhone, and Excel for Android. The formula syntax is the same; menu locations for conditional formatting may differ slightly.
Why does my OR formula return #VALUE!?
At least one argument is not a logical test. Common causes include missing quotes around text, comparing a range instead of a single cell, or using an operator like & instead of =.
Can OR check if a cell contains any of several words?
Yes, but you need wildcards with COUNTIF or SEARCH. For example, =OR(ISNUMBER(SEARCH("apple", A1)), ISNUMBER(SEARCH("pear", A1))) returns TRUE if A1 contains either word.