?:Beginner

IF function practice exercises (with AND, OR and IFS)

IF is the formula that makes decisions: pass or fail, over or under budget, yes or no. Practice IF on its own, then combine it with AND and OR, and finish with IFS for grading-style rules with several outcomes.

11 exercises0/11
Start practicing →

Try it yourself

A live spreadsheet. Type a formula and press Enter to check it.

Exercise 1 of 11IF

Did Emma pass Math? The pass mark is 50. Return "Pass" or "Fail".

Write your formula in the green cell, H2.

class-results.xlsx
fx
1StudentMathEnglishScienceAttendance
2Emma82917796%Emma, Math
3Liam45625881%
4Olivia93889599%
5Noah67497288%
6Ava58746192%
7Ethan39554770%
8Mia76816994%
9Lucas88599085%
10
11

Click a cell to add it to your formula, drag to select a range, or click a column letter for the whole column.

All 11 logic exercises

  1. 1

    Pass or fail

    Free

    Did Emma pass Math? The pass mark is 50. Return "Pass" or "Fail".

  2. 2

    Needs a retake

    Free

    If Liam scored below 50 in Math, return "Retake". Otherwise return "OK".

  3. 3

    Attendance warning

    Premium

    Return "Warning" if Ethan's attendance is below 75%, otherwise "OK".

  4. 4

    Strong in every subject

    Premium

    Did Olivia score 85 or more in all three subjects? Return TRUE or FALSE.

  5. 5

    IF that returns a number

    Premium

    Add 5 bonus points to Liam's Science score if his attendance is 80% or more. Otherwise keep his score as it is.

  6. 6

    Flag students for support

    Premium

    Return "Support" for Noah if any score is below 50 or attendance is under 90%. Otherwise return "On track".

  7. 7

    Average inside IF

    Premium

    Return "Top of class" if Olivia's average across Math, English and Science is 90 or more. Otherwise return "-".

  8. 8

    Nested IF

    Premium

    Give Noah a Science band using nested IFs: "High" for 80+, "Mid" for 60 to 79, otherwise "Low".

  9. 9

    Letter grades

    Premium

    Give Mia a letter grade for Math: A for 85+, B for 70+, C for 50+, otherwise F.

  10. 10

    Add up TRUEs

    Premium

    Did Lucas score 80 or more in at least two subjects? Return TRUE or FALSE.

  11. 11

    AND with an average

    Premium

    Return "Scholarship" if Mia averages 75 or more across her three subjects and her attendance is 90% or more. Otherwise return "No".

The logic functions, with examples

Every example runs on class-results.xlsx, the same sheet the exercises use, and the results are calculated from that data.

  • Checks a condition and returns one value if it's TRUE and another if it's FALSE.

    IF(logical_test, value_if_true, [value_if_false])

    Example

    =IF(B2>=50, "Pass", "Fail")returnsPass
  • Returns TRUE only when every condition is TRUE. Usually used inside IF.

    AND(logical1, [logical2], …)

    Example

    =AND(B3>=50, C3>=50)returnsFALSE
  • Returns TRUE when at least one condition is TRUE.

    OR(logical1, [logical2], …)

    Example

    =OR(B3<50, C3<50, D3<50)returnsTRUE
  • Tests conditions in order and returns the value for the first one that's TRUE. Cleaner than nesting several IFs, for example for grade bands.

    IFS(logical_test1, value_if_true1, …)

    Example

    =IFS(B4>=90, "A", B4>=80, "B", B4>=70, "C", TRUE, "D")returnsA

Common mistakes

  1. 1

    Quoting the wrong things

    Text results need quotes: =IF(B2>=50,Pass,Fail) gives #NAME? because Excel reads Pass as a name. Numbers don't: B2>="50" compares the score with the text "50" and gives the wrong answer.

  2. 2

    Testing conditions in the wrong order

    IFS and nested IFs stop at the first TRUE condition. If B2>=50 comes before B2>=90, a score of 95 stops at the first test and never reaches the top band. Start with the strictest condition.

  3. 3

    Leaving IFS without a fallback

    When none of its conditions is TRUE, IFS returns #N/A. End it with TRUE, "value" so every row gets an answer.