This Excel tutorial explains to you how to use Excel IF function with syntax and some examples.

Excel Function **IF performs a logical test and returns** one value if conditions are true and return another value if the condition is false.

In Other Words, when we want to test something and show one result if the test result is true or correct and different results if the test result is false **if Function** is used.

### IF Function :

Table of Contents

**Syntax : **=IF (logical_test, [value_if_true], [value_if_false])

There are 3 parts (arguments) in the function:

i: Logical Test something, such as the value in a cell.

ii : Return Value when logical test result is TRUE.

iii: Return Value when logical test result is FALSE.

The IF function is used to run a logical test and reacts differently depending on whether the result is TRUE or FALSE.

The first part, logical_test, is an expression that returns either TRUE or FALSE. Both value if_true and value if false are optional, but at least one of them must be provided.

The result from IF Function can be a value, a cell reference, or even another formula.

Now let’s Understand with an example.

In the example shown above Image, we want to know the Result of students either “Pass” or “Fail” based on a score. A passing score is Higher than 80. The formula in C4 cell, write down, is:

**=IF(B4<=80,”Fail”,”Pass”)**

Interpretation: If the value in B4 is Less than or equal to 80, return Result “Fail”. Otherwise, return “PASS”.

The logical flow of this formula can be reversed. The formula below returns the same result:

**=IF(B4>80,”Pass”,”Fail”)**

Interpretation: If the value in B4 is greater than 80 then return “Pass” else “Fail”.

### Return Another Formula As a Result:

Sometimes we required to calculate something based on result or score. Like if an employee achieves a target of 100 % then give a 5 % incentive or if more than 100 % Incentive is 10 %.

For Such scenario, we required to return a formula as a test result.

**=IF(B3>=100,A1*10%,A1*5%)**

### Logical operators

When you are constructing a test with IF, you can use any of the following logical operators:

Comparison operator |
Meaning |
Example |

= | equal to | A1=B1 |

> | greater than | A1>B1 |

>= | greater than or equal to | A1>=D1 |

< | less than | A1<B1< td=””></d1<> |

<= | less than or equal to | A1<=B1 |

<> | not equal to | A1<>B1 |

You May Also Like to Read :

**How to Rotate Text in Excel Header And Cell**