1. Computing

Discuss in my forum

Performing Calculations with the IF Function

Using the IF Function to Carry Out Calculations on Data

By , About.com Guide

What the IF function does

The IF function is one of Excel’s most useful and most used functions. What it does, basically, is test to see whether a certain condition is true or false. If the condition is true, the function will do one thing, if the condition is false, the function will do something else.

The basic form or syntax of the function is:

=IF(logic test, value if true, value if false)

The logic test is always a comparison between two values. Comparison operators are used, for example, to see if the first value is greater than or less than the second, or equal to it.

While the logic test section is limited to answering a true or false question, you have greater flexibility in what you place in the last two arguments.

Performing calculations

The IF function can perform different calculations depending on whether the function returns a true value or not.

The example below uses different deduction rates in its calculations based on employee income.

=IF(A5 < 29701, A5 * 15%, A5 * 25%)

If employees earn above a certain level, one deduction rate will be used in the calculation, if their income is below this level, a different deduction rate will be used.

What the above example does is test to see if the value in cell A5 is less than 29,701. If it is, the function multiplies the value in cell A5 by 15%(the "value if true" argument). If the value in A5 is greater than or equal to 29,701, then the amount in cell A5 is multiplied by 25% (the "value if false" argument).

Note: There is no comma separator used for the number in 29,701 in the above example. This is because the IF function uses the comma to separate the three sections of the IF function contained within the round brackets.

If you use a comma as a separator in numbers greater than a thousand, Excel will give you an error message saying you have too many arguments in your function.

Related Articles on the IF Function:

©2013 About.com. All rights reserved.