The Excel nested If is generally used to specify further conditions within an Excel If function. This is illustrated in the following examples.
Imagine you want to write a function to do the following calculations with the contents of cells A1 and B1:
This calculation can be performed by the following Excel nested if:
In the above example, the nested If function is shown in red, inside the outer If function. It is seen that the nested If provides further conditions, to be applied if the condition of the outer If function (i.e. the condition B1=0) is FALSE.
Now imagine that if the value in cell A1 is greater than 100, you want to count this as the value 100. The conditions that we want to apply are now:
This can be done by introducing a further nested if function within the formula:
In the above example, the first nested If is shown in red and the second level of nesting is shown in green.
The above example shows 3 if functions, with 2 levels of nesting. You can take this further by repeatedly nesting functions within functions. However, there is a limit to the depth of nesting that Excel can handle. Excel 2003 can only handle 7 levels of nesting but Excel 2007 & Excel 2010 can both handle up to 64 levels of nesting.