How to Use IF Function in Excel

Learn what the Excel IF function is, why it’s essential for conditional logic, and how to implement it in real-world scenarios.

IF Function Basics in Excel

IF function is one which are used the most often in Excel. IF is a logical function. In Excel, IF can return more than TRUE/FALSE.

Excel if function logical test true false

IF Function contains from 3 parts:

  1. Logical test – IF function checks if this test is true or false in the cell
  2. Value if true – you can use it if logical test is true
  3. Value if false – put the argument here for the failed test

Excel IF pass/fail evaluation

Consider a scenario where you have a table of exam results, and you want Excel to determine if a student passed or failed the exam automatically.

Excel IF function exam results table

You can use the IF function for this purpose. Here’s the formula:

=IF($C3>50,”PASSED”,”FAILED”)

Excel IF function simple formula example

In this formula:

  • $C3 represents the student’s score.
  • The logical test checks if the score is greater than 50.
  • If the score is greater than 50, Excel displays “PASSED”; otherwise, it shows “FAILED.”

Grading System

Now, let’s tackle a more complex scenario where you want to assign grades to students based on their scores.

Excel IF function table more difficult

The grading criteria are as follows:

  • A: >90 points
  • B: >75 points
  • C: >60 points
  • D: >50 points
  • E: ≤50 points

You can use nested IF functions to achieve this. Here’s the formula:

=IF($C3>90,”A”,IF($C3>75,”B”,IF($C3>60,”C”,IF($C3>50,”D”,”E”))))

Excel IF function logical test

This formula checks multiple logical tests sequentially to determine the appropriate grade for the student based on their score.

See also  How to do a Vlookup Using Text

Excel 2016 and later support the IFS function, which simplifies multiple conditions without deep nesting:

=IFS($C3>90,”A”,$C3>75,”B”,$C3>60,”C”,$C3>50,”D”,TRUE,”E”)

Switching to IFS reduces formula complexity and improves readability.