Intermediate 8 min read

IF with AND and OR in Google Sheets

Learn how to use IF with AND and OR in Google Sheets to test multiple conditions. Step-by-step examples for combining logical functions in one formula.

SB

Sheets Bootcamp

February 25, 2026

IF with AND and OR in Google Sheets lets you test multiple conditions in a single formula. The basic IF function checks one condition. AND and OR extend it so you can check two, three, or more conditions at once. We’ll cover both functions with step-by-step examples, then show you how to combine them.

In This Guide

How AND Works

AND returns TRUE only when every condition inside it is TRUE. If any single condition is FALSE, AND returns FALSE.

Formula
=AND(condition1, condition2, condition3, ...)

You can include up to 30 conditions. Every one of them must be TRUE for AND to return TRUE. For example, =AND(10>5, 3<7) returns TRUE because both comparisons are true. Change either one to a false comparison and AND returns FALSE.

How OR Works

OR returns TRUE when at least one condition inside it is TRUE. OR only returns FALSE when every condition is FALSE.

Formula
=OR(condition1, condition2, condition3, ...)

For example, =OR(10>5, 3>7) returns TRUE because the first comparison is true, even though the second is false. OR is useful when meeting any one of several criteria is enough to trigger an action.

Important

AND and OR by themselves return only TRUE or FALSE. To get a custom result like “Priority” or “Standard”, nest AND or OR inside an IF formula as the logical test.

Sample Data

We’ll use a sales records table with 10 rows of data in columns A through G.

Sales records table with 10 rows of date, salesperson, region, product, units, revenue, and commission data

DateSalespersonRegionProductUnitsRevenueCommission
1/5/2026Fred WeasleyDiagon AlleyExtendable Ears12$239.88$24.00
1/7/2026Ginny WeasleyHogsmeadeSelf-Stirring Cauldron8$360.00$36.00
1/8/2026Lee JordanDiagon AlleyRemembrall15$525.00$52.50
1/10/2026Fred WeasleyDiagon AlleyOmnioculars5$325.00$32.50
1/12/2026George WeasleyHogsmeadeSneakoscope20$570.00$57.00
1/14/2026Ginny WeasleyHogwartsNimbus 200025$624.75$62.50
1/15/2026Lee JordanHogsmeadeExtendable Ears10$199.90$20.00
1/18/2026Fred WeasleyDiagon AlleyInvisibility Cloak3$269.97$27.00
1/20/2026George WeasleyHogwartsFirebolt8$336.00$33.60
1/22/2026Ginny WeasleyHogsmeadeDeluminator6$330.00$33.00

IF with AND: Step-by-Step

We want to label each sale as “Priority” when the region is Diagon Alley and the revenue exceeds $300. Both conditions must be true.

Step 1: Review Your Conditions

The two conditions are:

  • Column C (Region) equals “Diagon Alley”
  • Column F (Revenue) is greater than $300

If you tested =AND(C2="Diagon Alley", F2>300) by itself in a cell, it would return TRUE or FALSE. We’ll wrap this in IF to get a label instead.

Step 2: Enter the IF + AND Formula

Select cell H1 and enter the header Status. Then select cell H2 and enter:

Formula
=IF(AND(C2="Diagon Alley", F2>300), "Priority", "Standard")

This checks both conditions. If C2 is “Diagon Alley” and F2 is greater than 300, the cell returns “Priority”. If either condition fails, it returns “Standard”.

IF AND formula in cell H2 with formula bar showing both conditions

Step 3: Copy Down and Review Results

Copy the formula from H2 down through H11. Two rows return “Priority”:

  • Row 3 (Lee Jordan, Diagon Alley, $525.00) — both conditions met
  • Row 4 (Fred Weasley, Diagon Alley, $325.00) — both conditions met

The remaining eight rows return “Standard”. Row 1 (Fred Weasley, Diagon Alley, $239.88) fails because the revenue is under $300. Rows in Hogsmeade or Hogwarts fail the region check regardless of revenue.

IF AND results showing Priority for rows 3 and 4, Standard for all others

IF with OR: Step-by-Step

Now we want to label each sale as “Campus” when the region is Hogwarts or Hogsmeade. Either condition is enough.

Step 1: Enter the IF + OR Formula

Clear column H or use column I. In H2 (with “Location” as the header in H1), enter:

Formula
=IF(OR(C2="Hogwarts", C2="Hogsmeade"), "Campus", "Off-Campus")

This checks whether C2 matches either region. If at least one comparison is true, the formula returns “Campus”. If neither matches (meaning the region is Diagon Alley), it returns “Off-Campus”.

IF OR formula in cell H2 with formula bar showing two region conditions

Step 2: Copy Down and Review Results

Copy H2 down through H11. Six rows return “Campus”:

  • Row 2 (Hogsmeade), Row 5 (Hogsmeade), Row 6 (Hogwarts), Row 7 (Hogsmeade), Row 9 (Hogwarts), Row 10 (Hogsmeade)

The four Diagon Alley rows (1, 3, 4, 8) return “Off-Campus”.

IF OR results showing Campus for Hogwarts and Hogsmeade rows

Tip

OR works well when you have a short list of values to check. If you have more than three or four values, consider using REGEXMATCH or MATCH instead for cleaner formulas: =IF(MATCH(C2, {"Hogwarts","Hogsmeade"}, 0), "Campus", "Off-Campus").

Combining AND and OR in One Formula

You can nest AND inside OR (or OR inside AND) to build more precise conditions. Here we want to label a sale as “Bonus” when either of these groups is true:

  • Diagon Alley and revenue over $300
  • Hogwarts and units over 10
Formula
=IF(OR(AND(C2="Diagon Alley", F2>300), AND(C2="Hogwarts", E2>10)), "Bonus", "Standard")

The OR function wraps two AND functions. If either AND group returns TRUE, the IF formula returns “Bonus”. Three rows qualify:

  • Row 3 (Diagon Alley, $525.00) — first AND group
  • Row 4 (Diagon Alley, $325.00) — first AND group
  • Row 6 (Hogwarts, 25 units) — second AND group

Combined AND OR formula in H2 checking two groups of conditions

Row 9 (Hogwarts, 8 units) does not qualify because 8 is not greater than 10.

Multiple AND Conditions

AND accepts more than two conditions. Here we add a third: Diagon Alley, revenue over $300, and units over 10.

Formula
=IF(AND(C2="Diagon Alley", F2>300, E2>10), "Top Performer", "Standard")

Only Row 3 (Lee Jordan, Diagon Alley, $525.00, 15 units) meets all three conditions. Row 4 (Fred Weasley, Diagon Alley, $325.00, 5 units) fails the units check.

Each new condition narrows the result further. AND with three conditions is stricter than AND with two.

Common Mistakes

Putting Conditions as Separate IF Arguments

A common error is writing conditions as separate arguments to IF instead of wrapping them in AND or OR.

Wrong:

Formula
=IF(C2="Diagon Alley", F2>300, "Standard")

This looks like two conditions, but Google Sheets reads three arguments: the logical test is C2="Diagon Alley", the value_if_true is F2>300 (which returns TRUE or FALSE), and the value_if_false is “Standard”. When C2 is “Diagon Alley”, you get TRUE or FALSE instead of “Priority”.

Correct:

Formula
=IF(AND(C2="Diagon Alley", F2>300), "Priority", "Standard")

Always wrap multiple conditions inside AND() or OR() before passing them to IF.

Important

IF takes exactly three arguments: logical_test, value_if_true, value_if_false. You cannot add extra conditions by adding more arguments. Use AND or OR to combine conditions into a single logical test.

Confusing AND with OR

AND means “all must be true.” OR means “any can be true.” Mixing them up produces the wrong results with no error message. Before writing a formula, state the rule in plain language: “I need both conditions” means AND. “I need at least one” means OR.

Missing Commas Between Conditions

Forgetting the comma between conditions inside AND or OR produces a formula parse error. Each condition must be separated by a comma:

=AND(C2="Diagon Alley" F2>300) — missing comma, formula breaks.

=AND(C2="Diagon Alley", F2>300) — correct.

Tips

  1. Test AND/OR standalone first. Before nesting inside IF, enter =AND(C2="Diagon Alley", F2>300) in a blank cell. Confirm it returns TRUE or FALSE as expected. Then wrap it in IF. This makes debugging faster.

  2. Use ARRAYFORMULA for column-wide application. Instead of copying the formula down, wrap it in ARRAYFORMULA: =ARRAYFORMULA(IF(AND(C2:C11="Diagon Alley", F2:F11>300), "Priority", "Standard")). This fills the entire column with one formula.

  3. Apply AND/OR logic visually. Conditional formatting formula-based rules use the same AND/OR syntax. You can highlight Diagon Alley rows with revenue over $300 using =AND(C2="Diagon Alley", F2>300) as a custom formula rule.

  4. QUERY WHERE uses similar logic. If you work with large datasets, QUERY supports WHERE clauses with AND and OR operators. The syntax is different, but the logic is the same.

FAQ

How do you use IF with AND in Google Sheets?

Nest AND inside IF as the logical test. The syntax is =IF(AND(condition1, condition2), value_if_true, value_if_false). AND returns TRUE only when every condition is met, so IF returns the true value only when all conditions pass.

How do you use IF with OR in Google Sheets?

Nest OR inside IF as the logical test. The syntax is =IF(OR(condition1, condition2), value_if_true, value_if_false). OR returns TRUE when at least one condition is met, so IF returns the true value when any condition passes.

Can you combine AND and OR in one IF formula?

Yes. Place AND and OR together inside the IF logical test using the structure =IF(OR(AND(cond1, cond2), AND(cond3, cond4)), value_if_true, value_if_false). This checks whether either group of conditions is met.

What is the difference between AND and OR in Google Sheets?

AND returns TRUE only when all conditions are TRUE. OR returns TRUE when at least one condition is TRUE. Use AND when every condition must be met. Use OR when meeting any one condition is enough.

Frequently Asked Questions

Next Steps

Continue learning with these related tutorials: