Logical Functions

You are here:
< Back

IF( ) function

The IF() function gives the us the feature to perform  two different calculations based on a certain condition, in other words we could tell excel as to which of the two calculation that it has to perform based on some condition.

The syntax for IF function in excel is :

=IF(condition, calculate this if condition is true, calculate this if condition is false)

If the condition mentioned in the first argument is true, Excel will perform the calculation specified in the second argument, otherwise Excel will perform the calculation available in the third argument.

To understand this better let us take an example of below dataset, in the below data we would like to calculate salesman commission based on the product type, so if the product type is TV then the salesman commission would be 2% of price ,otherwise the salesman commission would be 1% of the price for any other products.

Table demonstarting if formula

n the data above you could see that we have defined the IF condition in excel formula to calculate 2% as commission if the product is TV and 1 % otherwise.

We have written IF condition as =IF(H2=”TV”,I2*0.02,I2*0.01) , where I2*0.02 is basically calculating 2 % and similarly I2*0.01 is calculating 1 % based on the price of the product which is in column I.

If you want to specify more than one condition use AND or OR operator in excel which are explained in a different section.

AND() Function

The syntax for AND function is = AND(condition 1, condition 2, …condition n),we could specify multiple condition in AND function.

AND function returns true if all the conditions evaluate to TRUE, if any of them calculates to FALSE the output of the AND function is FALSE.

Table demonstrating AND formula

As you could see the AND formula has returned TRUE in the first case as all the conditions are true whereas in second case the AND function has returned FALSE as the last condition 6>7 in the 3rd argument is false.

OR() Function

The syntax for OR function is = OR(condition 1, condition 2, …condition n),we could specify multiple condition in OR function.

OR function returns true if any of the specified conditions evaluate to TRUE, it returns FALSE only when all of the conditions evaluate to FALSE .

table demonstrating OR formula

As you could see the OR formula has returned TRUE in the first case as all the conditions are true whereas in second case the OR function has again returned TRUE as except the last condition 6>7 in the 3rd argument other two are true.

OR has returned FALSE only in the third case where all the argument are evaluating to FALSE.

ISBLANK()

ISBLANK( ) function checks if a certain cell is blank or not. ISBLANK function returns TRUE if the cell is

blank and FALSE if it is not blank.

It has a very simple syntax, you could just provide the cell reference inside the formula as shown below.

Table showing ISBLANK formula

As you could see in the example above , cell Q2 has a value of 2 and hence ISBLANK has returned FALSE whereas cell Q3 is blank and ISBLANK has returned TRUE for this cell.

 

Random Posts

  • Extract URL Before Question Mark In Excel

    If we see the structure of URL we see that along with the domain name there are some other metrics associated […]

    Share The Knowledge
  • Add Time To A DateTime Value In Excel

    add minute to a date time value in excel, add hour to a date time value in excel, add second to a date time value in excel, add time value to a datetime in excel
    ,excel formula to add time to a datetime value

    Share The Knowledge
  • Arabic Function In Excel

    Let’s see how to use Arabic function in excel. Arabic function was introduced in excel 2013. Arabic function is used […]

    Share The Knowledge
  • Random Letter/Character Generator In Excel

    This post demonstrates how to generate random letter in excel for some random assigning purpose. Let’s understand how to generate […]

    Share The Knowledge