ExcelTool.io

IF OR Generator

Return one value when any of your conditions is true, using IF with a nested OR.

IF OR

Return one value when any of your conditions is true, using IF with a nested OR.

Logic

A test that returns TRUE or FALSE. Text you compare against needs quotes.

The alternative test. Either one being true is enough.

Returned when at least one condition is true. Text needs quotes.

Returned only when every condition is false. Text needs quotes.

=IF(OR(B2="Overdue", C2>30), "Follow up", "OK")

Worked Example

Chase an invoice if it is either flagged Overdue or more than 30 days old.

=IF(OR(B2="Overdue", C2>30), "Follow up", "OK")

Returns: Returns "Follow up" when B2 reads Overdue OR C2 is greater than 30 (or both); returns "OK" only when neither is true.

Checks Before You Paste

  • OR is inclusive: it returns TRUE when one, several, or all of the tests pass. For exactly one of two conditions, use XOR instead, which exists in Excel 2013 and later and in Google Sheets - but note that with three or more arguments XOR returns TRUE when an odd number of them are true, not when precisely one is.
  • Testing one cell against a long list of values gets unreadable fast. =IF(COUNTIF($E$2:$E$20, A2)>0, "Follow up", "OK") replaces a dozen OR arguments and lets you edit the list on the sheet instead of in the formula.
  • When you mix AND with OR, the parentheses decide the logic - there is no operator precedence to fall back on. AND(A2="North", OR(B2>100, C2="VIP")) is a completely different rule from OR(AND(A2="North", B2>100), C2="VIP").

Frequently Asked Questions

Related Tools