IF Function

The IF function is one of the most powerful and commonly used functions in Excel. It allows you to make logical decisions based on conditions.

It works like this:

If something is TRUE โ†’ do one thing
If something is FALSE โ†’ do another thing

Structure of IF Function

=IF(logical_test, value_if_true, value_if_false)

Explanation:

  • logical_test โ†’ The condition to check
  • value_if_true โ†’ Result if condition is true
  • value_if_false โ†’ Result if condition is false

Basic Example

If marks are in cell A1:

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

Meaning:

  • If A1 is 40 or more โ†’ Display “Pass”
  • Otherwise โ†’ Display “Fail”

Example with Numbers

If sales are in A1:

=IF(A1>1000, "Bonus", "No Bonus")

If sales are greater than 1000 โ†’ Bonus
Otherwise โ†’ No Bonus

Using IF with Comparison Operators

You can use:

  • Greater than
  • < Less than
  • = Greater than or equal to
  • <= Less than or equal to
  • = Equal to
  • <> Not equal to

IF with Calculations

=IF(A1>50, A1*10%, 0)

If A1 is greater than 50 โ†’ Calculate 10%
Otherwise โ†’ Return 0

Nested IF (Multiple Conditions)

You can combine multiple IF statements.

Example:

=IF(A1>=80,"A",
IF(A1>=60,"B",
IF(A1>=40,"C","Fail")))

This assigns grades based on marks.

Important Tips

  • Text values must be in quotation marks (” “).
  • Always check brackets carefully.
  • Avoid too many nested IFs (use other functions like IFS when available).

Why IF Function Is Important

It helps you:

  • Make decisions automatically
  • Categorize data
  • Create grading systems
  • Apply conditions in reports
  • Build smart spreadsheets

The IF function is the foundation of logical calculations in Excel and is essential for every beginner to master.

Home ยป Excel Essential Functions (EEF) > Logical Functions > IF Function