Friday 17 February 2017

How to Use IF Function Formula in Excel

​Sagar Guide - How to Use IF Function Formula in Excel

IF Formula is one of the Excel's logical function Formula that evaluates a certain condition and returns the value you specify if the condition is TRUE, and another value if the condition is FALSE.

The syntax for Excel IF Function Formula is as follows:

IF(logical_test, [value_if_true], [value_if_false])

As you see, the IF function has 3 arguments, but only the first one is obligatory, the other two are optional.

Some List of Example :

​Example : 1

* logical_test - a value or logical expression that can be either TRUE or FALSE. Required.In this argument, you can specify a text value, date, number, or any comparison operator. For example, your logical test can be expressed as or A1="Yes", A1<200, A1=5000 or A1>500.

* value_if_true - the value to return when the logical test evaluates to TRUE, i.e. if the condition is met. Optional.For example, the following formula will return the text "Yes" if a value in cell A1 is greater than 5000: =IF(A1>5000, "Yes").

* value_if_false - the value to be returned if the logical test evaluates to FALSE, i.e. if the condition is not met. Optional.For example, if you add "No" as the third parameter to the above formula, it will return the text "Yes" if a value in cell A1 is greater than 5000, otherwise, it will return "No": =IF(A1>5000, "Yes", "No").

Here the Below Screenshot Image : -

How to Use IF Function Formula in Excel


Example : 2

* logical_test - a value or logical expression that can be either TRUE or FALSE. Required.In this argument, you can specify a text value, date, number, or any comparison operator. For example, your logical test can be expressed as or  A1=5000, B1=5000.

* value_if_true - the value to return when the logical test evaluates to TRUE, i.e. if the condition is met. Optional.For example, the following formula will return the text "TRUE" if a value in cell A1 And B1 Equal  5000: =IF(A1=B1,"TRUE","FALSE").

* value_if_false - the value to be returned if the logical test evaluates to FALSE, i.e. if the condition is not met. Optional.For example, if you add "FALSE as the third parameter to the above formula, it will return the text "TRUE" if a value in cell A1 And B1 Equal  5000, otherwise, it will return "FALSE": =IF(A1=B1,"TRUE","FALSE").

Here the Below Screenshot Image : -

how to work if formula in excel


Example : 3

​* logical_test - a value or logical expression that can be either TRUE or FALSE. Required.In this argument, you can specify a text value, date, number, or any comparison operator. For example, your logical test can be expressed as or  A1=Saree, A2=Saree Blouse.

* value_if_Without Blouse Piece - the value to return when the logical test evaluates to Without Blouse Piece, i.e. if the condition is met. Optional.For example, the following formula will return the text "Without Blouse Piece" if a value in cell A1 is Saree: ==IF(A1="Saree Blouse","With Blouse Piece",IF(A1="Saree","Without Blouse Piece")).

* value_if_With Blouse Piece - the value to return when the logical test evaluates to With Blouse Piece, i.e. if the condition is met. Optional.For example, the following formula will return the text "With Blouse Piece" if a value in cell A1 is Saree Blouse :=IF(A1="Saree Blouse","With Blouse Piece",IF(A1="Saree","Without Blouse Piece")).


Here the Below Screenshot Image : -

if fumction formula in excel


Combining the IF function Formula with Other Logical Functions Formula

Need to specify more complex conditions when writing your formula in Excel. You can combine the IF function Formula  with other logical functions Formula such as AND, OR, etc. Let's explore this further.

Combining the IF Function With AND function Formula

​The IF function can be combined with the AND function Formula to allow you to test for multiple conditions. When using the AND function Formula, all conditions within the AND function Formula must be TRUE for the condition to be met. This Function Formula comes in very handy in Excel formulas.

Here the Below Screenshot  : 1

if function formula in excel

IF((AND Formula 1 is ​=IF(AND(A2>="Saree",B2>40000), "Party", "Casual)

Here the Below Screenshot : 2

if formula in excel


IF((AND Formula 2 is ​=IF(AND(B2>=25000,B2<=50000), "Great", "Average")

Combining the IF Function With OR function Formula : - 

The IF function Formula can be combined with the OR function Formula to allow you to test for multiple conditions. But in this case, only one or more of the conditions within the OR function needs to be TRUE for the condition to be met.

Here the Below Screenshot : 1

if formula in excel


​IF(OR Formula 1 is =IF(OR(A2="Saree",A2="Dress Material"), "Ethnic Wear", "Western Wear").

Here the Below Screenshot : 2

if with OR formula in excel

​​
IF(OR Formula 2 is ​==IF(OR(A2="Saree",B2>=5000), 999, "N/A")​.

No comments:

Post a Comment