fx Core Formulas

IF — the basic building block of conditions

⏱ 13 min

What you'll learn

  • Use IF to return text or calculations.
  • Choose comparison operators and test exact boundaries.
  • Keep thresholds in fixed cells and handle missing input.

Concept

1. What does IF do?

IF asks a question: "Is this condition true or not?" If true, it returns one answer; if false, another.

=IF(logical_test, value_if_true, value_if_false)

Simple example: =IF(B2>=40, "Pass", "Fail") — if B2 is 40 or more, "Pass"; otherwise "Fail".

2. Comparison operators

Operator Meaning Example
= equal to B2=100
<> not equal to B2<>0
> greater than B2>50
< less than B2<50
>= greater than or equal to B2>=40
<= less than or equal to B2<=40

3. Practice sheet

A B C D
1 Salesperson Target Sales Status
2 Amit 50000 62000
3 Neha 50000 48000
4 Ravi 40000 40000

In D2 type =IF(C2>=B2, "Achieved", "Missed") and drag down. Result: Achieved, Missed, Achieved.

Ravi's sales are exactly 40000, which is why we used >=. With just >, he would get "Missed". Always think about the boundary case when choosing an operator.

4. Calculations inside IF

IF can return numbers, not just text. Incentive in column E: 5% of sales if the target is achieved, otherwise 0.

=IF(C2>=B2, C2*5%, 0)

Amit gets 3100, Neha 0, Ravi 2000.

5. Comparing text

Always put text in double quotes: =IF(A2="Amit", "Manager", "Staff"). Text comparison in IF is case-insensitive — "amit" and "AMIT" are treated the same.

6. Checking for blank cells

If sales haven't been entered yet, show nothing:

=IF(C2="", "", IF(C2>=B2, "Achieved", "Missed"))

"" means empty. (This is a small nested IF; the full concept is in the next lesson.)

Common mistakes

Forgetting quotes around text (=IF(B2>40, Pass, Fail) gives a #NAME? error). Putting numbers in quotes ("40" becomes text and the comparison can go wrong). And choosing the wrong operator (> vs >=) for the boundary case.

Exercises

mediumCreate a "Bonus Eligible" column in F: "Yes" if sales are above 60000, otherwise "No". Then put the limit in cell H1 and change the formula to =IF(C2>$H$1, "Yes", "No"). Change H1 and check that everything updates.
On IF Targets, put 60000 in H1 and =IF(C2>$H$1,"Yes","No") in F2; fill down to F4. Results: Yes, No, No. Change H1 to 40000: Yes, Yes, No; exactly 40000 does not pass a strict > test. The target-status formula =IF(C2>=B2,"Achieved","Missed") does include equality.

Quiz

What does =IF(10>10, "A", "B") return?
B
=IF(A1="", "Empty", "Filled") — what if A1 contains just a space?
Filled — a space is content too
How many arguments does IF have?
3
IF — the basic building block of conditions · Foundations | ExcelWalaa