Quick answer
The IF formula tests a condition and returns one result when the condition is true and another result when it is false.
=IF(B2>=70,"Pass","Review")Syntax
Use this syntax as the pattern, then replace the sample arguments with your own cells, ranges, and criteria.
=IF(logical_test, value_if_true, value_if_false)When to use it
Logical formulas help a spreadsheet make decisions. They are useful when a report needs to say whether a target was met, whether a row needs attention, or which label should be shown based on one or more conditions.
- Mark invoices as paid or overdue
- Create pass/fail labels for scores
- Flag rows that need review
- Build status messages for dashboards
Example worksheet layout
Test the formula in a small worksheet first. This makes it easier to confirm the result before copying the formula down hundreds of rows.
| Column or range | What it represents |
|---|---|
| A | Item, person, or transaction |
| B | Score / status / amount |
| C | Formula result or decision label |
Copy-paste examples
These examples move from simple to more practical versions. Start with the beginner examples, confirm the result, then adapt the intermediate and advanced versions.
Pass or review a score
=IF(B2>=70,"Pass","Review")Use when a score, grade, or result must be converted into a simple label.
Mark an invoice as paid
=IF(C2="Paid","Closed","Open")Useful for invoice trackers where the status column controls the next action.
IF with blank handling
=IF(A2="","",IF(B2>=1000,"Large","Standard"))Return a blank result until the row has data, then classify the value.
IF with dates
=IF(TODAY()>D2,"Overdue","On time")Compare today to a due date to flag overdue tasks.
IF with AND
=IF(AND(B2>=1000,C2="Approved"),"Pay","Hold")Test more than one condition before returning the final label.
IF with XLOOKUP
=IF(XLOOKUP(A2,Products[SKU],Products[Stock],0)>0,"In stock","Out of stock")Look up a value first, then return a business-friendly result.
How to use it step by step
- Put your raw data in clear columns with headers such as Amount, Date, Status, Region, or Customer.
- Paste the starting formula into the first result cell, usually row 2.
- Replace sample references such as A2, B2, or $F$2:$F$100 with the cells in your own worksheet.
- Check the result on a few rows where you already know the expected answer.
- Copy the formula down only after the first row returns the right result.
Common mistakes and fixes
- Do not put text results without quotation marks, such as Pass or Review.
- Use absolute references like $G$2 when every row should compare to the same target.
- Check that numbers are stored as numbers, not text, before testing greater-than or less-than rules.
- Test the formula on a few known rows before using it across a full report.
Beginner tips
- Use IF for two outcomes. Use IFS or SWITCH when you have many outcomes.