Excel function

IF in Excel: return one result or another

IF lets a spreadsheet make a decision. It checks a logical test and returns one value when the test is true and another when the test is false.

What IF does

IF checks whether a condition is true or false. The syntax is `=IF(logical_test, value_if_true, value_if_false)`.

For example, `=IF(B2>=70,"Pass","Fail")` checks whether the score in B2 is at least 70. If it is, Excel returns Pass. If not, Excel returns Fail. This is the core pattern behind status labels, eligibility checks, alerts, and simple classification formulas.

IF can return text, numbers, dates, blanks, or even another formula. The important thing is to make the test clear and make both possible results intentional.

Arguments explained

`logical_test` is the condition Excel evaluates, such as `B2>=70`, `C2="Paid"`, or `D2<>"Complete"`. A logical test returns TRUE or FALSE.

`value_if_true` is what Excel returns when the test is true. `value_if_false` is what Excel returns when the test is false. Text outputs must be in quotation marks, like `"Review"`. Numeric outputs do not need quotation marks, like `0` or `100`.

Nested IF formulas can handle several outcomes, but they become hard to read quickly. If a formula has many layers, consider IFS, a lookup table, or a cleaner structure.

For learning, keep each IF formula focused on one decision. Once that feels natural, combine IF with AND or OR to test multiple requirements, such as score and attendance, quantity and shipping method, or budget and approval status.

Practical examples

A beginner school example is grading pass or fail. If B2 contains a test score, `=IF(B2>=60,"Pass","Fail")` returns a text label.

A business example is flagging orders for review. If D2 contains order quantity, `=IF(D2>=100,"Review","OK")` returns Review for large orders and OK otherwise. This kind of formula helps create simple dashboards or operational checks.

IF can also return numbers. `=IF(C2="Yes",D2*0.9,D2)` applies a 10% discount when C2 says Yes and keeps the original price otherwise.

When to use it

Use IF when each row needs a decision: eligible or not, pass or fail, discount or full price, reorder or OK, late or on time. It is one of the most important Excel functions because it teaches logical thinking.

Do not use IF when a lookup table would be easier to maintain. Avoid long nested IF chains when categories change often. Do not put numbers in quotation marks if later formulas need to treat them as numbers.

Practical examples

Pass or fail

=IF(B2>=70,"Pass","Fail")

Checks whether B2 is at least 70 and returns a text result.

Conditional discount

=IF(C2="Yes",D2*0.9,D2)

Applies a 10% discount to D2 only when C2 contains Yes.

Recommended Excel functions

IFIFSANDORIFERRORCOUNTIF

Common mistakes

  • 01Forgetting quotation marks around text outputs.
  • 02Putting numbers in quotation marks when they should remain numeric.
  • 03Building long nested IF formulas that are hard to audit.
  • 04Writing a logical test that does not match the business rule.

Practice

Practice this skill with interactive exercises on Calcu.

Use Calcu to practice IF in realistic spreadsheet exercises with instant feedback.

FAQ

What are the three parts of an IF formula?

An IF formula has a logical test, a value if true, and a value if false.

Can IF return text and numbers?

Yes. IF can return text, numbers, blanks, dates, or another formula.

Are nested IF formulas bad?

Not always, but long nested IF formulas are hard to read. IFS or a lookup table may be cleaner.