Click here for great value web hosting.








Search for



Using IF Functions

The IF function is a very useful Logical Function which can enter a value or text in a cell depending on whether a condition is met. For instance, if more than 140mm of rain fell in a month we might want to write the words “Very Wet” on that row but otherwise leave the cell blank. The IF function has three arguments – the condition to test, the value if it is True and the value if it is False:

=IF(condition,value if True,value if False)

For our rainfall example we might use an expression like:

=IF(B5>140,”Very Wet”,””)

This will write “Very Wet” in the current cell if cell B5 is greater than 140, otherwise it will enter nothing (a null string “”) in the cell. It is important to use a null string if you want a blank in the cell as entering nothing in that argument will give the number 0 in the cell instead of a blank.

It is also possible to ‘nest’ IF functions, i.e. to put one IF function inside another.  Here is an example:

=IF(B5>140,IF(B5>150,”Floods”,”Very Wet”),””)

This uses another IF function within the True section of the function to further test whether the value was greater than 150, if it was then the result “Floods” would be returned but if the value was greater than 140 but not greater than 150 then the result “Very Wet” would be returned.  Take care if you are trying to construct nested IF functions, it is important to ensure that you put your brackets and commas in the right place and that you have a closing bracket for every bracket you open.

Click here to return to the Excel index.