How to Use IF Statements in Excel

IF Statement in Excel: Quick Example
The Excel IF function tests a condition and returns one result when the condition is TRUE and another when it is FALSE.
=IF(logical_test, value_if_true, value_if_false)
For example, =IF(A2>=50,"Pass","Fail") returns Pass when A2 is 50 or higher and Fail when it is below 50.
Introduction
Excel is packed with powerful tools, but few are as useful as the IF function. With IF statements, you can apply logic to a spreadsheet so that Excel returns different results depending on whether a condition is true or false.
Think of an IF statement as Excel saying: “If this condition is true, return this result. Otherwise, return something else.”
In this guide, you’ll learn the basic IF formula, then see how to use IF with text, AND/OR conditions, dates, calculations and error handling. We’ll also introduce nested IFs and the IFS function, with links to a more detailed guide when you need several possible outcomes.
What Is an IF Statement in Excel?
The IF function checks whether a condition is true or false, then returns one value if it is true and another if it is false.
The basic syntax is:
=IF(logical_test, value_if_true, value_if_false)
- logical_test: the condition you want to check, such as A1>50.
- value_if_true: what Excel should return when the condition is TRUE.
- value_if_false: what Excel should return when the condition is FALSE.
Example: Pass or Fail
=IF(A2>=50, "Pass", "Fail")
If the score in A2 is 72, the formula returns “Pass”. If the score is 43, it returns “Fail”.
Step 1: Creating Your First IF Statement
Imagine you have sales data and want to show whether each salesperson reached a £1,000 target.
- Enter the sales values in column A.
- In column B, enter:
=IF(A2>=1000,"Target Met","Below Target")
- Copy the formula down.
Each row is now labelled automatically according to the sales value.
Step 2: Using IF for More Than Two Outcomes
A single IF has two possible results. If you need three or more outcomes, you can place another IF inside the false result. This is called a nested IF.
Example: Grading System
- 70 or above = Distinction
- 50 to 69 = Pass
- Below 50 = Fail
=IF(A2>=70,"Distinction",IF(A2>=50,"Pass","Fail"))
For more complex examples, see our guide to multiple and nested IF statements in Excel.
Step 3: Combining IF with AND and OR
Sometimes one result depends on more than one condition. You can combine IF with AND or OR.
Example: Bonus Eligibility with AND
Suppose sales must exceed £1,000 and customer satisfaction must exceed 80:
=IF(AND(A2>1000,B2>80),"Bonus","No Bonus")
Example: Bonus Eligibility with OR
If either condition is enough:
=IF(OR(A2>1000,B2>80),"Bonus","No Bonus")
Step 4: Using IF with Text
IF statements can test text as well as numbers.
Example: Department Check
=IF(A2="HR","Human Resources","Other")
IF comparisons are not case-sensitive, so “HR”, “hr” and “Hr” are treated the same.
Step 5: Handling Errors with IFERROR
IFERROR is a separate function that is useful when a calculation may return an error such as #DIV/0!.
Example: Safe Division
=IFERROR(A2/B2,"Check denominator")
If B2 is zero or the calculation otherwise returns an error, Excel displays “Check denominator” instead of the error value.
Step 6: The IFS Function
In Excel 2019 and later, including Microsoft 365, the IFS function can make formulas with several conditions easier to read than a long series of nested IFs.
Example: Grading with IFS
=IFS(A2>=70,"Distinction",A2>=50,"Pass",TRUE,"Fail")
IFS checks conditions in order and returns the value associated with the first TRUE condition.
Step 7: Real-World Examples of IF Statements
1. Overtime Status
If hours worked are above 40, return “Overtime”; otherwise return “Standard”:
=IF(A2>40,"Overtime","Standard")
2. Discount Calculation
If a purchase is above £500, apply a 10% discount:
=IF(A2>500,A2*0.9,A2)
3. Check an Expiry Date
If a date has already passed:
=IF(A2<TODAY(),"Expired","Valid")
Step 8: Best Practices for IF Statements
- Keep formulas readable — if you have many possible outcomes, consider IFS, SWITCH or a lookup table rather than a very long nested IF.
- Reference cells where practical instead of repeatedly hard-coding thresholds into formulas.
- Test boundary values — for example, test 49, 50 and 51 when your threshold is 50.
- Use AND or OR when several tests belong to the same decision.
- Use IFERROR for genuine error handling rather than hiding every error without understanding its cause.
Step 9: Common Mistakes to Avoid
- Mismatched brackets — each nested function needs the correct closing parenthesis.
- Missing quotation marks — text results such as "Pass" must be enclosed in quotation marks.
- Testing conditions in the wrong order — with multiple thresholds, check the logic carefully so earlier conditions do not capture values intended for later ones.
- Over-nesting — complex IF formulas can be difficult to test and maintain.
Conclusion
The IF function is one of Excel’s most useful logical functions. It can turn simple spreadsheets into responsive models that classify values, calculate different outcomes and react to changing data.
This guide covered the basic IF syntax, IF with AND/OR, text, calculations, dates, IFERROR and an introduction to nested IF and IFS. If you need several outcomes in one formula, continue with our Nested IF and Multiple IF Statements guide.
Want to Develop Your Excel Formula Skills?
Our Excel Advanced course explicitly covers IF, AND, OR and IFERROR, alongside lookup functions, data validation, formula auditing, PivotTables and other advanced Excel techniques.
For more advanced formula work, our Excel Advanced Functions & Data Modelling course includes IFS and other advanced functions.
Not sure which level is right for you? Take our free Excel Skills Assessment, or compare the full Excel training pathway.
Want to develop your Excel formula skills? Our Excel Advanced course covers IF, AND, OR and IFERROR. Or compare the full Excel training pathway.
Need a quick explanation of a Power BI term, feature or concept?
Browse our free Power BI GlossaryFound this guide useful? Add ExperTrain as a Preferred Source on Google to help surface more of our training guides, articles and learning resources.




