Let’s use the mobile phone sales table below as an example. You can download the example file here.

IF Function

with Single Condition

Consider a scenario where you need to calculate the Commission Fee for each sales row, depending on where the sales was made (Column D). If the sales was made in the USA, the Commission Fee is 10%, otherwise the remaining locations will have Commission Fee of 5%. The first formula that you need to enter on Cell F2 is as shown below: Formula breakdown: Then you can copy down the formula from Cell F2 to the rest of the rows in Column F and it will calculate the Commission Fee for each line, either by 10% or 5% dependent on whether the IF logical test returns TRUE or FALSE on each row.

IF Function with Multiple Conditions

What if the rules were a bit more complicated where you need to test for more than one logical condition with different results being returned for each condition? Excel has an answer to this! We can combine multiple IF functions within the same cell, which is sometimes known as a Nested IF. Consider a similar scenario where the Commissions are different for each Sales Location as below:

USA 10%Australia 5%Singapore 2%

In Cell F2 (which later will be copied to the rest of the rows in the same column F), enter the formula as follow: Formula breakdown: As Excel will assess the formula from the left to the right, when a logical test is met (e.g. D2=“USA”, the function will stop and return the result, ignoring any further logical test after (e.g. D2=“Australia”.) So if the first logical test returns FALSE (i.e. location is not USA), it will continue to assess the second logical test. If the second logical test returns FALSE as well (i.e. location is not Australia), we do not need to test further as we know the only possible value on Cell D2 is Singapore hence it should return a result of E2*2%.  If you prefer for clarity, you can add the third logical test IF(D2=”Singapore”, “value if TRUE” , “value if FALSE”). Therefore, the full extended formula is as shown below: As mentioned earlier, the above will return the same result as the initial formula that we had.

Quick Tips

For every single IF( function, there needs to be an opening and closing round bracket. When there are three IF functions as per one of the examples above, the formula will need three closing brackets “)))”, each marking the ending of a corresponding opening IF( statement.If we do not specify the second outcome of the logical test (when the logical test resulted in FALSE), the default value assigned by Excel will be the text “FALSE”. So formula =IF(D2=”USA”,E2*10%) will return the text “FALSE” if D2 is not “USA”.If you have several different logical tests each with its own different outcome, you can combine/nest the IF function multiple times, one after another, similar to the example above. How to Use If and Nested If Statements in Excel - 18How to Use If and Nested If Statements in Excel - 81How to Use If and Nested If Statements in Excel - 38How to Use If and Nested If Statements in Excel - 89