
IF checks a condition and returns one value if it is TRUE and another if it is FALSE.
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.
Related functions
IFS · AND · OR · IFERROR
📚 Part of the free Excel course: Beginner → Expert · Try it in the Formula Lab or ask the AI Helper.
✨ Ask AI about this article
Stuck on a step? Ask a question and the AI answers using this article.
Free · AI can be wrong