How to use the IF function in Excel: multiple conditions with IF, AND and OR
Use the Excel IF function to show a different result depending on a condition. Multiple conditions with AND, OR and NOT, nested IF and common mistakes, based on Microsoft Support.

If you want a cell to show "Pass/Fail", "Yes/No" or a different calculation depending on the value of another cell, the IF function is the tool for it. When one condition is not enough, combine IF with AND (all conditions must be true) or OR (at least one must be true). The syntax and examples below follow Microsoft Support's pages for the IF, AND and OR functions; the cell addresses are examples, so change them to match your own table.
- Time15 minutes
- DifficultyEasy
- Steps10
๐งฐ What you need
- A computer with Excel installed (in the Turkish interface the function names are written EฤER, VE, YADA and DEฤฤฐL)
- A small sample table (for example names in column A, scores in column B, days absent in column C)
- An empty column for the formula (for example column D)
Steps
- Learn the syntax and the separatorThe structure of the IF function is: =IF(logical_test, value_if_true, [value_if_false]). The first two arguments are required and the third is optional. The character that separates arguments depends on your regional settings: according to Microsoft, the most common list separators are the comma and the semicolon. With English (US) settings it is usually a comma, which is what this guide uses; Turkish regional settings usually use a semicolon.๐ก If a formula gives an error, try the other separator; using the wrong one breaks the formula.
- Prepare a sample tableType Name in A1, Score in B1, Absences in C1 and Result in D1. In A2:C2 enter a student's name, score (for example 72) and number of days absent (for example 4). You will write the formula in D2.
- Write a single-condition IFSelect D2 and type =IF(B2>=50,"Pass","Fail"), then press Enter. If B2 is 50 or more, D2 shows Pass; otherwise it shows Fail. The comparison operators are > greater than, < less than, >= greater than or equal to, <= less than or equal to, = equal to and <> not equal to.๐ก Similar examples from Microsoft's page: =IF(C2="Yes",1,2) and =IF(C2>B2,C2-B2,0).
- Put text in quotation marksWhen you use text in a formula, enclose it in double quotation marks: "Pass", "Fail", "Yes". Write numbers and cell references without quotes. If you forget the quotes, Excel treats the text as a function name and returns an error.๐ก According to Microsoft, missing quotes and typos show up as a #NAME? error.
- Use AND when all conditions are requiredIf both conditions must be met, put the AND function in the first argument of IF: =IF(AND(B2>=50,C2<=10),"Pass","Fail"). Here the student gets Pass only if the score is 50 or more AND absences are 10 days or fewer; if either condition fails, the result is Fail. AND accepts up to 255 conditions.๐ก The structure of AND is =AND(logical1, [logical2], ...). It returns TRUE if all conditions are TRUE and FALSE if any one is FALSE.
- Use OR when one condition is enoughIf meeting any one condition is enough, use the OR function. Example: if column D holds Student and column E holds Retired as "Yes"/"No", write =IF(OR(D2="Yes",E2="Yes"),"Discount","Full price"). Anyone who is a student or retired gets Discount; if both are No, the result is Full price.๐ก The structure of OR is =OR(logical1, [logical2], ...). It returns TRUE if any condition is TRUE and FALSE only if all are FALSE; it accepts up to 255 conditions.
- Use NOT to reverse a conditionTo test the opposite of a condition, use NOT: =IF(NOT(D2="Yes"),"Full price","Discount"). If D2 is not "Yes", it shows Full price. You can get the same result with =IF(D2<>"Yes",...).
- Combine AND and ORYou can combine the conditions. Example: the score must be 50 or more AND either absences must be 10 days or fewer or F2 must say Excused = "Yes": =IF(AND(B2>=50,OR(C2<=10,F2="Yes")),"Pass","Fail"). Count the closing parentheses; every opening parenthesis needs a matching closing one.๐ก Microsoft does not recommend using more than a few functions nested together, because complex formulas are hard to build, test and audit.
- Use nested IFs for three or more resultsIf there are more than two possible results, put another IF in the value_if_false position: =IF(B2>89,"A",IF(B2>79,"B",IF(B2>69,"C",IF(B2>59,"D","F")))). Excel tests in order and stops at the first TRUE condition, so sort your conditions from highest to lowest. If you reverse the order (for example testing B2>59 first), high scores are caught by the first condition and you get wrong results.๐ก According to Microsoft, Excel allows up to 64 nested IFs but this is not recommended. In Excel 2019 and later, the IFS function does the same job in one function without a stack of parentheses.
- Fill the formula down and check the resultsSelect D2 and drag the fill handle at the bottom-right corner of the cell down to the last row of the table. In each row the formula adjusts to that row's cells (B3, C3 and so on). Check a few rows by hand, especially boundary values (a score of exactly 50, exactly 10 days), to make sure you get the result you expect.
โ This guide is general information. Yudum cannot be held responsible for the outcome of following it; for official procedures always rely on the institution's own statement. Steps and fees change over time.
๐ฌ Comment on this articleShare what you think and join the comments below.Write a comment โ















