IF Function in Excel

IF condition in Excel is a logical function that is used to satisfy the user's given condition.

It means using the IF condition function we can return one value if a condition is true and another value if it's false.

In other words, the IF Excel function checks whether a condition has been met, and then it returns one value if true and another value if false.

IF function in Excel plays a major role in logical conditions.

IF Condition Syntax:- =IF(logical_test, value_if_true, [value_if_false])

Ex: =IF(A1>=70,"First Class","Second Class")

How to use IF function in Excel?

In the below given example, we have discussed multiple IF conditions for better understanding.

IF Greater Than:

In the below given example, we have student names with their percentage of marks. and we need to find the grades of the students depending upon their percentage.

Using the IF condition function, it is easy to find the grades of the students.

If Condition Example

Condition:- If any student marks % is greater than 70 then it considered as "First Class" Or it considered as "Second Class".

Execute the below steps to get a result,

1. Put the cursor on cell C2.

2. Apply the IF function.=IF(B2>70,"First Class","Second Class").

Explanation: if cell B2 is > (greater than) 70, then First Class or Second Class.

3. Drag the formula to all remaining cells.

Result:

IF Greater Than Function

IF Equal To:

let's take one more example, in the below example we have state name and demo name columns with data.

Here the task is, using the IF function we need to find whether the state name is equal to the demo name or not.

Condition:- State name and Demo name is equal or not.

IF Condition in Excel

Execute the below steps to get a result,

1. Put the cursor on cell C9.

2. Apply the IF function.=IF(B9=A9,"Name Matched","Not Matching").

Explanation: if cell B9 is=(equal to) cell A9, then "Name Matched" or "Not Matching".

3. Drag the formula to all remaining cells.

Result:

IF Function in Excel

IF Less Than or Equal to:

In the below example, we have the Product name, MRP columns with data, here the task is, using the IF function we need to find Best Price and High Price.

Condition:- Any product has MRP less than or equal to 35 then it considered as Best Price or High Price.

Execute the below steps to get a result,

1. Put the cursor on cell C18.

2. Apply the IF function.=IF(B18<35,"Best Price","High Price").

Explanation: if cell B18 is < (less than) or=(equal to) 35, then it considered as a "Best Price" or "High Price".

3. Drag the formula to all remaining cells.

Result:

IF Less Than Function

Note: Always use the double quotes to Specify text in if condition.

Download


Get Your FREE Excel Shortcut Keys e-BOOK