# IF function

You can learn here what IF function is and how to use it.

IF function is one which are used the most often in Excel. IF is a logical function. But you can not only check TRUE / FALSE values. Let's take a look at some IF function examples. 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 - IF function puts this value if logical test is true
3. Value if false - IF function puts this value if logical test is false

Here you have some examples:

## Example 1 IF exam is passed?

The simpliest example is to make a table with exam results. In this table Excel will show, if the Student passed the exam. Thanks to IF function you can automatically check, if the student passed the exam. The formula is:

=IF(\$C3>50,"PASSED","FAILED")

IF formula checks the logical test, which is if the student got more points than 50. If logical test is true, Excel writes PASSED. If student got less then 50 points Excel writes FAILED. Isn't it simple?

## Example 2 IF exam is passed? More difficult example

Let's do something more difficult. You want to check if the student passed the exam and you want to get the mark. A is more than 90 points. B is more than 75 points. C is more than 60 points. D is more than 50 points. It is not hard to do. You must to do more logical tests in Excel's formula. You check if it is more than 90 points. If it is more, mark is A. If it is not, check if more than 75 points... If all logical tests aren't true, the mark is E. Formula is:

=IF(\$C3>90,"A",IF(\$C3>75,"B",IF(\$C3>60,"C",IF(\$C3>50,"D","E")))) Formula seems to be complicated, but it is easy to get it. And the effect is magnificent.