IF Function in Excel: Make Decisions in a Formula

IF Function in Excel: Make Decisions in a Formula featured illustration

πŸ“Ž This article includes 1 downloadable practice file ↓

⏱ 2 min readUpdated 28 September 2026

LogicalLevel: BeginnerAvailable in: Excel 2007+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Example 2
  5. Example 3
  6. Common errors and fixes
  7. IF in practice
  8. Where you will use it
  9. Worked example
  10. Mistakes people make
  11. Related functions
  12. Continue learning

IF checks a condition and returns one value if it is TRUE and another if it is FALSE.

Advertisement

Syntax

=IF(logical_test, value_if_true, [value_if_false])
Argument What it means
logical_test Anything that is TRUE or FALSE, e.g. B2>=40.
value_if_true Result when TRUE.
value_if_false Result when FALSE (FALSE is shown if omitted).

Examples

Example 1

=IF(C2>=40, "Pass", "Fail")

A simple pass mark.

Example 2

=IF(D2="", "", D2*18%)

Leave the GST cell blank until an amount is entered.

Example 3

=IF(AND(B2="Sales", C2>100000), C2*2%, 0)

Bonus only for Sales above β‚Ή1 lakh.

Common errors and fixes

You see Why, and the fix
#NAME? Text in the formula without quotes: use “Pass”, not Pass.
πŸ’‘ More than three nested IFs? Use IFS (Excel 2019+) or a small lookup table β€” easier to read and change.

IF in practice

Where you will use it

  • Pass/Fail, Met/Missed labels
  • Bonus only when target is met
  • Show blank until data is entered

Worked example

RepSalesTargetFormulaResult
Neha420000400000=IF(B2>=C2,"Met","Missed")Met
Arjun310000350000=IF(B3>=C3,"Met","Missed")Missed
Simran450000450000=IF(B4>=C4,"Met","Missed")Met

Results calculated in Excel.

Mistakes people make

MistakeWhat to do instead
Text without quotesWrite "Met", not Met
Nested IFs in the wrong orderTest the strictest condition first, or use a lookup table

IFS Β· AND Β· OR Β· IFERROR

πŸ“š Part of the free Excel course: Beginner β†’ Expert Β· Try it in the Formula Lab or ask the AI Helper.

⚑ Interactive Practice Lab & Formula Tester:

Test formulas dynamically in our web formula laboratory or download the companion Excel workbook.

πŸ“Ž Practice files for this article

  • πŸ“—
    Practice workbook: Logic, LET & LAMBDA17 tasks on realistic sales data β€” type your formula, the Check column turns green when it is right. Answers sheet included.
    ⬇ XLSX Β· 35 KB

Free to use for learning. Files with macros (.bas) are plain text β€” import them with Alt+F11 β†’ File β†’ Import File, and always test on a copy.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free Β· AI can be wrong