**If the given condition is met, the cell will be filled with the value given as the second argument. In other cases, the cell will be filled with the value given as the third argument.**

## If syntax

**=IF(**`Logical test`

**,** `Value if true`

**, **`Value if false`

**)**

Argument | Argument description | |
---|---|---|

1 | Logical test | The condition that is checked to be True or False. |

2 | Value if True | The output that will be returned by Excel if the logical test is True. |

3 | Value if False | The output that will be returned by Excel if the logical test is False. |

### Try it for yourself

Take a look at the formulas in cells **C2**:**C5** and try to do it yourself in cell **C6**.

## Explanation

If the score of a student is higher than 60, the function returns the value for True, which is ‘Pass’. If the value is lower than 60 or equal to 60, it will return the value for False, which is ‘Fail’.

Certainly the best way to understand what a condition is and how they can be useful is by looking at some examples.

## Questions

#### What type of conditions are there?

The most often used way of creating conditions is by combining any sort of data (numbers, text, dates, etc) with a *comparison operator*. For example:

1. `5 < 6`

, 5 is indeed less than 6, so `True`

.

2. `10 < 8`

, 10 is not less than 8, it is greater than 8, so this is `False`

.

3. `"Textual data1" = "Textual data2"`

, the two texts are not the same, therefore the statement is `False`

.

4. `1-1-2000 <> 2-1-2000`

, the dates are unequal, which is exactly what the operator says, so the statement is `True`

.

Here’s an overview of the operators you can use to form conditions:

Operator | Meaning |
---|---|

= | Equal to |

<> | NOT equal to |

> | Greater than |

< | Less than |

>= | Greater than or equal to |

<= | Less than or equal to |

However, conditions do not *have* to be from comparison operators, there are other functions that evaluate to `True`

or `False`

that can be used as a condition. For example:

`=IF(ISBLANK(A1), "A1 is blank", "A1 is not blank") `

You can see this one in action down at the examples.

**Can If functions be nested?**

Yes they can. The second and third argument of an if function can, in turn, be if functions themselves. And if the result is True or False, even the first argument can be an if function. You can see an example of this in our Complete Guide on If.

**What does a ‘0’ in the cell mean?**

You probably did not fill in the second or third argument of the function. Add arguments two and three.

**What does ‘#NAME?’ in the cell mean?**

This means that the formula name was not recognized. It was probably misspelled. Make sure the function name is spelled correctly and try again.

## If examples

#### Using functions as condition

Instead of regular conditions, you can also use functions that evaluate to `True`

or `False`

as conditions for an If function. In this example the `ISBLANK`

function is used as a condition. `ISBLANK`

is True when the cell is empty and False when the cell is not.

Try typing anything in cell **A1 **to see **B1 **change.