IF STATEMENTS – Microsoft Excel

One of the most important functions in MS-Excel is the IF Statement.

It evaluates a certain condition and based on the logical comparison made, if the result of the comparison comes to be true then a particular statement is executed. And if it is false then you can either return the default “false” or nest another if statement to be more precise with your comparison.

Default Syntax of IF Statement in Excel:

=IF(CONDITION, VALUE_IF_TRUE, VALUE_IF_FALSE)

Now from the above syntax it is clear that the if statement takes 3 arguments.

The last 2 arguments are optional by the way. If the last 2 arguments are not explicitly mentioned the if function will return TRUE or FALSE as the result of the comparison.

The first argument takes the condition to be evaluated. If the condition is true then it executes the 2nd argument, if no argument is passed then returns TRUE or if the condition is false then the 3rd argument’s value is returned. If no argument is given default valueFALSE” will be returned.

When using the IF function to compare values, you can use the following logical operators:

  • = (equal to)
  • > (greater than)
  • >= (greater than or equal to)
  • < (less than)
  • <= (less than or equal to)
  • <> (not equal to)

Let us see a practical example to understand this:

  • Click on the desired cell and inside the formula bar write your if function as shown below:

In the formula bar you can see the formula i.e. if B2<B1, then return “B1 is Greater”.

Notice we don’t have the 3rd argument for else. In this case if the condition is FALSE it will return “FALSE” as the result.

See for yourself,

You can customize the formula as per your need. Just keep the syntax in mind.

In this way you can easily create different scenarios for your worksheet by implementing IF functions.Hope you find this article to be useful.

Leave a Comment

Your email address will not be published. Required fields are marked *