मुख्य घटकावर जा
LogicalBasic LevelBasic Excel (Foundations & Core Formulas)

How to Use IF in Excel

The foundation of every decision formula in Excel: returns one value when a condition is TRUE and another when it is FALSE.

Direct Answer (Quick Summary)

What is IF in Microsoft Excel?

IF evaluates a condition and returns a value you choose for each outcome. It is the most used function in Excel because almost every real report needs a decision — pass or fail, target met or missed, discount or no discount. You can nest IF inside IF, but modern Excel prefers IFS for readability.

Pro Tip: Always write the most common outcome first and the exception second. Reading =IF(B2>=40,"Pass","Fail") is easier to audit than its reverse, and it keeps nested logic predictable.

Formula Syntax

=IF(logical_test, value_if_true, value_if_false)

Arguments Breakdown

ArgumentRequirementPurpose & Details
logical_testRequiredAny expression that evaluates to TRUE or FALSE, such as B2>=40 or A2="North".
value_if_trueRequiredWhat to return when the test is TRUE. Can be text, a number, a cell reference or another formula.
value_if_falseOptionalWhat to return when the test is FALSE. If omitted, Excel returns FALSE.

When to Use IF (Real-World Business Scenarios)

  • 1

    Flagging rows that need attention, such as orders over 30 days old or invoices above a credit limit.

  • 2

    Converting raw numbers into business labels like Pass/Fail, High/Medium/Low, or On Track/At Risk.

  • 3

    Calculating conditional values such as a 10% discount only when the order value crosses a threshold.

Step-by-Step Practical Business Example

Suppose you have the following dataset in Excel cells A1:D4:

StudentMarksResult
Rahul78Pass
Pooja34Fail
Aman56Pass
Applied Formula:Result: Pass
=IF(B2>=40,"Pass","Fail")

How it works: Checks whether Marks in B2 is 40 or more. Since 78 passes the test, the formula returns 'Pass'. Dragging it down evaluates every row independently.

Common Errors & How to Fix Them

#VALUE!

Why it happens: Text was used in a numeric comparison, for example comparing a number to "40" written with invisible spaces.

Fix: Compare like with like: =IF(B2>=40,...) for numbers and =IF(A2="North",...) for text. Wrap text comparisons in quotes.

Wrong result / always FALSE

Why it happens: The logical test was written as text instead of an expression, such as =IF("B2>=40","Pass","Fail").

Fix: Remove the quotes around the test so Excel evaluates the cell value rather than the literal string.

Interactive Formula Lab

Try IF Live in Your Browser

No need to launch desktop Excel. Practice formulas with real-time feedback in our HyperFormula sandbox.

Open Practice Lab

Frequently Asked Questions (IF)

What does the IF formula do in Excel?

IF evaluates a condition and returns a value you choose for each outcome. It is the most used function in Excel because almost every real report needs a decision — pass or fail, target met or missed, discount or no discount. You can nest IF inside IF, but modern Excel prefers IFS for readability.

What is the syntax for IF?
=IF(logical_test, value_if_true, value_if_false)
What are common mistakes when using IF?

#VALUE!: Text was used in a numeric comparison, for example comparing a number to "40" written with invisible spaces. (Compare like with like: =IF(B2>=40,...) for numbers and =IF(A2="North",...) for text. Wrap text comparisons in quotes.) Wrong result / always FALSE: The logical test was written as text instead of an expression, such as =IF("B2>=40","Pass","Fail"). (Remove the quotes around the test so Excel evaluates the cell value rather than the literal string.)

Keep building your formula toolkit with these logical functions.

Browse all 41 Excel formulas
Ready to Master Microsoft Excel?

Master IF in Basic Excel

Learn IF along with our formula library, practice files, and verifiable certificates in our complete curriculum.

Strictly necessary