Mastering IF, AND, and OR Conditions (Complete Practical Examples)

A step-by-step guide to creating accurate conditions with Excel IF, AND, and OR functions. Includes practical examples for single and multiple conditions, score grades, commission tiers, and shipping-fee calculations, along with IFS, IFERROR, and SWITCH combinations, common mistakes, and performance tips. Complete IF, AND, and OR function guide.
Mastering IF, AND, and OR Conditions (Complete Practical Examples)

Excel · Logic

Mastering IF, AND, and OR Conditions (Complete Practical Examples)

Eighty percent of a report depends on its conditional formulas. Master IF/AND/OR fundamentals, IFS, IFERROR, and SWITCH combinations, tiered calculations, grade calculations, and exception handling all at once.

Basic Syntax Summary

FunctionSyntaxDescription
IF=IF(condition, value_if_true, value_if_false)Returns value_if_true when the condition is TRUE; otherwise returns value_if_false
AND=AND(condition1, condition2, ...)Returns TRUE only when all conditions are TRUE
OR=OR(condition1, condition2, ...)Returns TRUE when at least one condition is TRUE
IFS=IFS(condition1, result1, condition2, result2, ...)Returns the result for the first TRUE condition

Single Condition – IF

Example 1) Pass/Fail

=IF(B2>=60, "Pass", "Fail")

Example 2) Handling Blank Cells

=IF(B2="", "", B2*1.1)

Skipping calculations when there is no input keeps the report clean.

Multiple Conditions – AND/OR

Example 3) Bonus Payment (tenure ≥3 years AND rating A)

=IF(AND(C2>=3, D2="A"), "Bonus Paid", "Not Eligible")

Example 4) Free Shipping (VIP status OR purchase amount ≥ 50,000)

=IF(OR(E2="VIP", F2>=50000), "Free Shipping", "Shipping Fee Charged")
  • TIP Group conditions with AND/OR first rather than using complex nested IF statements for better readability and performance.

Improved Readability – IFS

Example 5) Score → Grade

=IFS(B2>=90,"A", B2>=80,"B", B2>=70,"C", B2>=60,"D", TRUE,"F")

TRUE,"F" serves as a default value. Adding it at the end covers all exceptions.

Example 6) Nested IF vs. IFS

MethodFormula
Nested IF=IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C","D")))
IFS=IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C",TRUE,"D")

Tiered Calculations (Fees, Commissions, and Grades)

Example 7) Commission Rates by Sales Tier

Sales (Cumulative)Rate
02%
10,000,0003%
30,000,0005%

Keep it simple with LOOKUP:

=LOOKUP(H2, {0,10000000,30000000}, {0.02,0.03,0.05}) * H2

Example 8) Shipping Fee (Free for VIPs or purchases of 50,000 or more)

=IF(OR(G2="VIP", H2>=50000), 0, 3000)

Example 9) Shift Differential (Night Shift AND Weekend)

=IF(AND(I2="Night", WEEKDAY(J2,2)>=6), 15000, 0)

10 Common Patterns

  1. Whether text is included=IF(ISNUMBER(SEARCH("VIP",A2)),"Special Price","Regular")
  2. Date range=IF(AND(A2>=DATE(2025,8,1), A2<=DATE(2025,8,31)),"August","Other")
  3. Handling blanks/zeros=IF(A2="","",A2), =IF(A2=0,"-",A2)
  4. Error safeguard=IFERROR(formula,"Check Required")
  5. Boolean → number--(condition) or N(condition)
  6. Map codes with SWITCH=SWITCH(K2,"A","Excellent","B","Average","C","Needs Improvement","Other")
  7. Return multiple results (365)=IF(condition, range1, range2) (dynamic array)
  8. Conditional formatting formula=AND($C2="Delayed",$D2>TODAY())
  9. Data validation rule → In Custom, use =AND(A2>=0, A2<=100)
  10. Shorten multiple OR conditions=ISNUMBER(MATCH(A2,{"Gold","VIP","Admin"},0))

Errors, Pitfalls, and Solutions

  • Numbers stored as text vs. numbers → Convert with VALUE() and check cell formatting
  • Date comparison failure → Use DATE() and watch for regional-format mismatches
  • Whitespace characters → Clean up with TRIM() and CLEAN()
  • Unreadable nesting → Refactor with IFS, LOOKUP, or tables
  • Precedence mistakes → Use parentheses to clarify the intended logic so AND is evaluated before OR

Performance and Maintenance Tips

  • Move conditions and thresholds into an Excel table → formulas only need references
  • Avoid unnecessary full-column references (X:X); specify exact ranges
  • When the same logic is used across multiple sheets, reuse it with defined names
  • Documentation: Place a Rules Summary text box at the top of the worksheet

Summary

Key PointChecklist
Cover all conditional formulas with IF/AND/OR combinationsMake parentheses and precedence clear
Improve readability with IFS/LOOKUPUse tables + LOOKUP for tiers and grades
Handle exceptions and errors firstUse IFERROR and blank-cell handling

FAQ

My nested IF formula is too long. How can I shorten it?

Replace it with IFS, LOOKUP, or CHOOSE, and put the thresholds in a table to shorten the formula.

What is the precedence when mixing AND and OR?

Because AND tends to be evaluated before OR, use parentheses to make your intended logic clear: IF(OR(AND(...), AND(...)), ...)

My comparisons are incorrect because numbers and numbers stored as text are mixed.

Convert with VALUE() or standardize the format in the data source.

Write your worksheet rules as sentences, create a truth table, and then turn them into IFS/AND/OR formulas. Easy-to-read logic directly reduces maintenance costs.

Leave a Reply

Your email address will not be published. Required fields are marked *