## How to write an if statement in excel?

The IF function in Excel is one of the most popular conditional formula functions, and it allows you to make logical comparisons between a value and what you expect.

Syntax:

[vtftable cols=”{0}0:fff2cc;{/}”]

=if(Condition , Result when matched, result when not matched);nn;

[/vtftable]

For Example:

Meaning:

If A2 is less than 10, (exclude 10), then the value for B2 is “<10”, else the value for B2 is “>=10”.

As now A2 is nothing, in Excel, it will be considered as 0. Therefore, the result for B2 is “<10”.

Note:

This is a very simple example of the if function. However, the power of an if function can be far more than this. It can formed in a nested if style.

A nested if means an if function with another if function.

Following is an example of an nested if function.

From this example, you can see that we have added another if function between the first comma (“,”) and the second comma (“,”)

**Meaning**

If A2 is less then 10 (exclude 10), then if A2 is less then or equal to 0 then B2 is “<=0”. However, if A2 is less than 10, but larger than 0, than B2 is “<10”. Otherwise, B2 is “>=10”

Normally Excel can handle up to 7 levels of nested if function. However, the less level you have the easier to mange the file and also a better performance result.