Skip to content
ArumSoft Learning
KO

    The 20 Most-Used Excel Functions · Tutorial 10 of 20

    How to Use AND and OR in Excel

    Test several conditions at once with AND and OR, reverse a test with NOT, and use them inside IF to label, flag and calculate rows.

    Level
    Beginner
    Time
    12 min read
    Updated:
    Applies to:
    Excel for Microsoft 365, Excel 2021, Excel 2019, Excel for the web
    OR flags Ben (attendance under 75%) and Eli (score under 60). Either condition alone is enough.
    Example: OR flags Ben (attendance under 75%) and Eli (score under 60). Either condition alone is enough.

    What you'll learn

    • Check that every condition is met with AND, or at least one with OR
    • Put AND and OR inside IF to return words, numbers or calculations
    • Reverse a test with NOT and combine AND with OR in one rule
    • Test a whole range at once and avoid the 50 < B2 < 100 trap

    Function Playground

    Try these functions in a live sheet

    Type formulas in an Excel-style grid and watch each step of the calculation. Free, no sign-up.

    AND and OR check several conditions at once. AND returns TRUE only when every condition is true; OR returns TRUE when at least one of them is. On their own they show TRUE or FALSE, so most of the time you'll put them inside IF, which turns that answer into a label, a number or a calculation.

    The syntax

    =AND(logical1, [logical2], ...)
    =OR(logical1, [logical2], ...)
    • logical1 is required: the first condition. It's usually a comparison such as B2>=70, but it can also be a cell or a range that holds TRUE and FALSE values.
    • logical2, … are optional extra conditions, separated by commas, up to 255 in all.
    • Both functions return a single TRUE or FALSE. Numbers count as conditions too: 0 is FALSE and any other number is TRUE. Text and empty cells inside a range are skipped, and a range with no TRUE, FALSE or number values at all returns #VALUE!.
    Reading an AND formula
    =AND(B2>=70,C2>=80%)
    1. ANDReturns TRUE only if every condition inside is TRUE
    2. B2The exam score to test
    3. >=70Condition 1: at least 70
    4. C2The attendance to test
    5. >=80%Condition 2: at least 80% (the same as 0.8)

    Here's how the two functions answer for every combination of two conditions:

    Condition 1Condition 2AND givesOR gives
    TRUETRUETRUETRUE
    TRUEFALSEFALSETRUE
    FALSETRUEFALSETRUE
    FALSEFALSEFALSEFALSE

    Check two conditions with AND

    The sheet below lists five trainees on a course. To earn a certificate, a trainee needs an exam score of at least 70 and attendance of at least 80%.

    1. Click the first result cell

      Click D2, next to Ana's attendance.

      ABCDEF
      1TraineeExamAttendanceBoth met?CertificateFollow-up
      2Ana Reyes8295%
      3Ben Cho9170%
      4Chloe Kim6888%
      5Dev Rao7580%
      6Eli Park5560%
      Five trainees with their exam score and attendance. The AND check goes in column D.
    2. Type the AND formula and press Enter

      Type the formula below and press Enter. Each condition is a comparison, and the comma separates them. Typing 80% in a formula is the same as typing 0.8, which is how Excel stores the percentage in C2.

      =AND(B2>=70,C2>=80%)

      The result is TRUE: Ana's 82 is at least 70, and her 95% is at least 80%. Both conditions are TRUE, so AND is TRUE.

      ABCDEF
      1TraineeExamAttendanceBoth met?CertificateFollow-up
      2Ana Reyes8295%TRUE
      3Ben Cho9170%
      4Chloe Kim6888%
      5Dev Rao7580%
      6Eli Park5560%
      AND checks B2 and C2, the two cells outlined in the formula's colours, and returns TRUE.
    3. Fill the formula down

      Double-click the fill handle at the bottom-right corner of D2 to copy the formula down to D6. Each copy checks its own row.

      ABCDEF
      1TraineeExamAttendanceBoth met?CertificateFollow-up
      2Ana Reyes8295%TRUE
      3Ben Cho9170%FALSE
      4Chloe Kim6888%FALSE
      5Dev Rao7580%TRUE
      6Eli Park5560%FALSE
      Only Ana and Dev meet both conditions. Dev's 75 and exactly 80% pass because >= includes the boundary.

      Ben scored 91 but attended only 70%, Chloe attended 88% but scored 68, and Eli misses both. One FALSE is enough to make AND return FALSE.

    4. Turn TRUE and FALSE into words with IF

      TRUE and FALSE are useful for checking, but a report usually needs words. Put the AND test in IF's first argument. In E2:

      =IF(AND(B2>=70,C2>=80%),"Certified","Not yet")

      Fill it down to E6. Ana and Dev show Certified; Ben, Chloe and Eli show Not yet.

      ABCDEF
      1TraineeExamAttendanceBoth met?CertificateFollow-up
      2Ana Reyes8295%TRUECertified
      3Ben Cho9170%FALSENot yet
      4Chloe Kim6888%FALSENot yet
      5Dev Rao7580%TRUECertified
      6Eli Park5560%FALSENot yet
      IF reads the AND result: Certified when both conditions are met, Not yet otherwise.

    Accept either condition with OR

    The course coordinator calls anyone who looks at risk: an exam score under 60 or attendance under 75%. One warning sign is enough, so this is a job for OR. In F2, then filled down:

    =IF(OR(B2<60,C2<75%),"Call","")

    Ben and Eli show Call; the other three cells stay empty. Ben passed the exam easily, but his 70% attendance is under 75%, and that one TRUE is all OR needs. The "" at the end returns empty text, so rows without a warning look blank.

    ABCDEF
    1TraineeExamAttendanceBoth met?CertificateFollow-up
    2Ana Reyes8295%TRUECertified
    3Ben Cho9170%FALSENot yetCall
    4Chloe Kim6888%FALSENot yet
    5Dev Rao7580%TRUECertified
    6Eli Park5560%FALSENot yetCall
    OR flags Ben (attendance under 75%) and Eli (score under 60). Either condition alone is enough.

    Reverse a test with NOT

    NOT takes one condition and returns its opposite: =NOT(C2>=80%) returns FALSE for Ana, because her attendance is at least 80%. For a single comparison it's usually clearer to flip the operator instead (C2<80%), but NOT is handy around a whole AND or OR. This returns TRUE for everyone who did not earn a certificate, which here is Ben, Chloe and Eli:

    =NOT(AND(B2>=70,C2>=80%))

    Another common use is NOT(ISBLANK(B2)), which is TRUE when B2 has something in it.

    FunctionReturns TRUE whenExample for Ana (row 2)Result
    ANDevery condition is TRUEAND(B2>=70,C2>=80%)TRUE
    ORat least one condition is TRUEOR(B2<60,C2<75%)FALSE
    NOTits one condition is FALSENOT(C2>=80%)FALSE

    Combine AND with OR

    Rules often mix the two. Suppose the course changes its rule: anyone who scores 90 or more no longer needs 80% attendance. A trainee now needs a score of at least 70 and either 80% attendance or a score of 90 or more:

    =AND(B2>=70,OR(C2>=80%,B2>=90))
    AND with OR inside
    =AND(B2>=70,OR(C2>=80%,B2>=90))
    1. B2>=70Must be TRUE: a score of at least 70
    2. OR(C2>=80%,B2>=90)Must also be TRUE: attendance of at least 80% or a score of at least 90

    Excel works out the inner OR first and hands its TRUE or FALSE to AND, just like brackets in arithmetic. Filled down, the results are TRUE, TRUE, FALSE, TRUE and FALSE: Ben now qualifies because his 91 makes the OR part TRUE. Chloe still doesn't, because her 68 fails the first condition.

    Test a whole range at once

    AND and OR accept a range comparison, which checks every cell in one go:

    =AND(B2:B6>=60)

    That returns FALSE, because Eli's 55 is under 60. =OR(B2:B6>=90) returns TRUE, because Ben scored 91. In Excel for Microsoft 365 and Excel 2021, press Enter as usual. In Excel 2019 and earlier, confirm a range comparison like this with Ctrl+Shift+Enter, or use a version that works everywhere: =MIN(B2:B6)>=60 or =COUNTIF(B2:B6,"<60")=0.

    If a range already holds TRUE and FALSE values, point AND or OR straight at it. With column D filled in, =AND(D2:D6) returns FALSE (not everyone qualified) and =OR(D2:D6) returns TRUE (at least one person did).

    Real-world scenarios

    HR

    Bonus only when both targets are hit

    A rep earns a 500 bonus when sales reach the target and the manager's rating is at least 4. Everyone else gets 0.

    ABCDE
    1RepSalesTargetRatingBonus
    2Maya52,00050,0004500
    3Tom61,00055,00030
    4Sara47,50050,00050
    5Leo40,00040,0004500
    Each row compares Sales with its own Target and checks the Rating.
    =IF(AND(B2>=C2,D2>=4),500,0)

    Maya and Leo get 500. Leo's sales exactly equal his target, and >= counts that. Tom beat his target but has a rating of 3, and Sara has a 5 but missed her target, so both get 0.

    Sales

    Free shipping for big orders or members

    An online shop ships free when the order total is 50 or more or the customer is a member. Other orders pay 5.

    ABCD
    1OrderTotalMemberShipping
    2100164No0
    3100238Yes0
    4100322No5
    5100450No0
    Shipping is 0 when either condition is TRUE.
    =IF(OR(B2>=50,C2="Yes"),0,5)

    Orders 1001 (64), 1002 (a member) and 1004 (exactly 50) ship free. Only order 1003, a non-member spending 22, pays 5. Text comparisons ignore capitals, so "yes" would match too.

    School

    Honor roll: every subject 85 or above

    A student makes the honor roll only if all three scores are at least 85. A range comparison inside AND checks the whole row at once.

    ABCDE
    1StudentMathEnglishScienceHonor roll
    2Hana928895Yes
    3Jun978490
    4Mia858585Yes
    5Omar789189
    AND checks all three scores in the outlined range.
    =IF(AND(B2:D2>=85),"Yes","")

    Hana and Mia (exactly 85 in each subject) show Yes. Jun's 84 in English and Omar's 78 in Math keep them off the list. =IF(MIN(B2:D2)>=85,"Yes","") gives the same answers and works in every version of Excel.

    Budget

    Flag big weekend purchases

    To spot weekend splurges in a spending log, flag purchases over 100 made on a Saturday or Sunday. WEEKDAY(A2,2) numbers the days from Monday (1) to Sunday (7), so a result above 5 means the weekend.

    ABCD
    1DateItemAmountCheck
    22026-03-06Concert tickets140
    32026-03-07Groceries85
    42026-03-08Dinner out120Review
    52026-03-11Phone bill60
    62026-03-14New shoes135Review
    The date and the amount must both pass for a row to be flagged.
    =IF(AND(WEEKDAY(A2,2)>5,C2>100),"Review","")

    Dinner out on Sunday, March 8 (120) and new shoes on Saturday, March 14 (135) show Review. The concert tickets cost more but were bought on a Friday, and Saturday's groceries were only 85.

    Common mistakes

    • Writing 50 < B2 < 100. =50 < B2 < 100 looks like "between 50 and 100" but returns FALSE for every value, with no error to warn you. Excel compares left to right: 50 < B2 gives TRUE or FALSE, and then Excel compares that TRUE or FALSE with 100. TRUE and FALSE always rank above numbers in comparisons, so the second step is always FALSE. Write =AND(B2>50,B2<100) instead.
    • OR with "not equal" tests. =OR(C2<>"Paid",C2<>"Waived") is always TRUE, because every value differs from at least one of the two. To mean "neither Paid nor Waived", use AND(C2<>"Paid",C2<>"Waived").
    • Expecting words from AND alone. =AND(…) only ever shows TRUE or FALSE. Wrap it in IF to show "Certified", a number or a calculation.
    • Putting TRUE in quotes. =IF(D2="TRUE",…) compares D2 with the text "TRUE", which never equals the logical value TRUE, so the test fails. Write =IF(D2,…) or =IF(D2=TRUE,…).
    • Using AND for row-by-row tests in FILTER or SUMPRODUCT. AND(B2:B6>=70,C2:C6>=80%) returns one TRUE or FALSE for the whole block, not one per row (here FALSE). Inside those functions, multiply conditions for "and" and add them for "or": =FILTER(A2:A6,(B2:B6>=70)*(C2:C6>=80%)) returns Ana Reyes and Dev Rao.
    • #VALUE! from a range of text. =AND(A2:A6) on a column of names returns #VALUE!, because the range holds no TRUE, FALSE or number values. Point AND at comparisons or at TRUE/FALSE cells.

    Practice

    Practice

    Check the trainees

    Use the sheet below. Click a highlighted cell, type a formula in the bar above the sheet and press Enter. Afterwards, try it in Excel itself:

    1. List five people with two numbers each, such as a test score and attendance, or sales and a rating.
    2. Add a column with AND that shows TRUE only when both numbers clear their limits, and fill it down.
    3. Wrap the test in IF so the column shows words instead of TRUE and FALSE.
    4. Add a second column with IF and OR that flags anyone below either limit.

    Try it0 of 4 done

    1. In D2, use AND to check whether Ana scored at least 70 on the exam (B2) and attended at least 80% of classes (C2).
    2. In E3, show Certified if Ben meets both conditions, otherwise Not yet.
    3. In F6, show Call if Eli scored under 60 or attended less than 75% of classes, otherwise leave the cell empty with "".
    4. In B7, check with one AND formula whether every exam score in B2:B6 is 60 or more.

    Click a dashed cell, type a formula in the bar and press Enter.

    ABCDEF
    1TraineeExamAttendanceBoth met?CertificateFollow-up
    2Ana Reyes8295%
    3Ben Cho9170%
    4Chloe Kim6888%
    5Dev Rao7580%
    6Eli Park5560%
    7All 60 or more?

    Related

    Was this guide helpful? Spot a mistake? Send feedback · admin@arumsoft.com