IF + OR: either condition

Lesson 10 of 54

Put OR inside IF when any one of several conditions is enough: =IF(OR(test1, test2), value_if_true, value_if_false). It returns the "true" value as soon as one test passes.

Orders ship free when the Total is over 100 OR the customer is a "Member". In cell D2, write a formula that shows "Free" or "Paid".

D2
ABCD
1OrderTotalCustomerShipping
2#501140Guest
3#50260Member
4#50345Guest
5#504210Member

Type in the formula bar above and press Enter to check.

Skip

How IF with OR works

Syntax

=IF(OR(test1, test2, ...), value_if_true, value_if_false)
OR(test1, test2, ...)
TRUE if at least one test is TRUE.
value_if_true
What to show when any test passes.
value_if_false
What to show when every test fails.

Example

A task is flagged when its status in B2 is "Blocked" or its due date in C2 has passed.

=IF(OR(B2="Blocked", C2<TODAY()), "Flag", "")

Shows "Flag" when either is true, and leaves the cell empty otherwise.

Common mistakes

  • Writing =IF(B2="Blocked" OR C2<TODAY(), ...). Spreadsheets have no OR operator; use the OR() function.
  • Checking one cell against several values the long way. OR(B2="A", B2="B") works; so does OR(B2={"A","B"}) in Excel.
  • Using OR when all conditions must be met. That is AND.

Questions people ask

How do I check if a cell equals one of several values?

List them in OR: =IF(OR(A2="Mon",A2="Tue"),"Early week","Later"), or use COUNTIF against a list.

Does OR work in Google Sheets?

Yes, OR and AND work the same in Google Sheets and Excel.

Practice it above: type the formula in the formula bar and press Enter to check.