Top Header ADS

IF Function in Excel

What is the IF function in Excel?

→ The IF function returns one value if the condition is TRUE, or another value if the condition is FALSE.

→ We can use the IF function when we want an answer on the condition base.

→ We can put the IF function in Logical Function category because this function works based on logic if the condition is true then return X value or the condition is false then return Y value.

→ We can put If Function into the Logical Function Category


How to use the IF function in Excel?

→ We can use the IF function in MS Excel just by entering the formula in the spreadsheet.

What is the return value of the IF function?

→ The IF function will return a True or False value based on the result of the logical test.

→ If the logical test's condition is true then the IF function returns value_if_true (you can refer to the syntax).

→ If the logical test's condition is false then the IF function returns value_if_false (you can refer to the syntax).


What is the syntax of the IF function?

→ The syntax for the IF function in Microsoft Excel is:

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

Note: If you are running Excel 2016 or higher, try the new IFS function (to specify up to 127 conditions).

The Syntax Parameter or Syntax Arguments are:

 logical_test - A value that we want to test or It is a logical expression that will say us true or false.

→ value_if_true - This value will return if the logical_test will return True or Pass.

→ value_if_false - This value will return if the logical_test will return False or Fail.


Examples of IF Function:

→ For a better understanding of the IF function, we can take below examples that are related to students and their marks in the exam.

→ We will check the condition if the marks are greater than 35 then pass otherwise fail.

→ In the below excel sheet, we can see the students and their marks in the exam.

Example1:

→ We will check the if conditions such as if the students are getting marks greater than 35 then pass otherwise fail.

→ As we know that the syntax of IF function is =IF(logical_test, [value_if_true], [value_if_false])

→ So from the below picture, we use this function in the cell no C3 and the syntax will be =IF(B3>40,"Pass","Fail") for the below sheet.

→ Here we can understand the syntax as below,

  1. logical_test = B3>40,
  2. value_if_true = "Pass"
  3. value_if_false = "Fail"

→ From the excel sheet, we can show that the value of B3=32 so B3<40. Hence the condition is false.

→ So the function will return the second part of formula = value_if_false = "Fail".

Example of IF Function in MS Excel

Example2:

→ Now for better clarity, we are taking one more example as explained below.

→ Similarly, refer to the below photo for the second example.

→ So our formula is =IF(B4>40,"Pass","Fail").

→ From the excel sheet, we can show that the value of B4=80 so B3>40. Hence the condition is true.

→ So the function will return the first part of formula = value_if_true = "Pass".

→ So, the IF function will return the answer =Pass.

Example 2 of IF Function


👉 For a regular update:

➨ Join us (Telegram Channel)

➨ Join us (LinkedIn Page)


👉 Also Navigate Our Popular Category:

➨ Statistical Functions

➨ Date & Time Functions

➨ Logical Functions

➨ Lookup & Reference Functions

➨ Math Functions

➨ MS Excel Sitemap

➨ 7 QC Tools Excel Templates

➨ Lean Six Sigma Excel Templates

➨ MS Excel Templates

Post a Comment

Previous Post Next Post