Logical Excel Formula

IF Formula in Excel: Examples, Syntax, Tips

Learn the IF formula in Excel with a beginner-friendly explanation, syntax, copy-paste examples, step-by-step instructions, and common mistakes.

Copy-paste examplesBeginner friendlyCommon mistakesStep-by-step

💡 Ideas for You

Helpful learning resources for IF formula.

4 useful links
📚 Step-by-step booksBeginner-friendly learning resources from Create & Learn.📘 Formula guideBooks and references for logical Excel formulas.🧮 Formula cheat sheetsQuick references for common spreadsheet formulas.📊 Reporting guidesResources for turning formula results into useful reports.

Quick answer

The IF formula tests a condition and returns one result when the condition is true and another result when it is false.

Starting formula
=IF(B2>=70,"Pass","Review")

Syntax

Use this syntax as the pattern, then replace the sample arguments with your own cells, ranges, and criteria.

Syntax
=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 rangeWhat it represents
AItem, person, or transaction
BScore / status / amount
CFormula 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.

Beginner

Pass or review a score

Example formula
=IF(B2>=70,"Pass","Review")

Use when a score, grade, or result must be converted into a simple label.

Beginner

Mark an invoice as paid

Example formula
=IF(C2="Paid","Closed","Open")

Useful for invoice trackers where the status column controls the next action.

Intermediate

IF with blank handling

Example formula
=IF(A2="","",IF(B2>=1000,"Large","Standard"))

Return a blank result until the row has data, then classify the value.

Intermediate

IF with dates

Example formula
=IF(TODAY()>D2,"Overdue","On time")

Compare today to a due date to flag overdue tasks.

Advanced

IF with AND

Example formula
=IF(AND(B2>=1000,C2="Approved"),"Pay","Hold")

Test more than one condition before returning the final label.

Advanced

IF with XLOOKUP

Example formula
=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

  1. Put your raw data in clear columns with headers such as Amount, Date, Status, Region, or Customer.
  2. Paste the starting formula into the first result cell, usually row 2.
  3. Replace sample references such as A2, B2, or $F$2:$F$100 with the cells in your own worksheet.
  4. Check the result on a few rows where you already know the expected answer.
  5. 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.

Related formula examples