Excel If Else

MS Excel IF ELSE is logical function in which performs logical test. We check multiple conditions with IF ELSE in a single formula which is also known as NESTED IF ELSE. Seven IF could be used in a single IF function.

Using If Else

Syntax:

=IF(CONDITION, value if true, value if false)

Example# 1:

 =IF(10<20,"Correct 20 is greater than 10","20 is not greater than 10")

Result: Correct 20 is greater than 10

Example# 2 (IF ELSE With Reference):

Here now we can use IF ELSE logical test between the values in cells by giving references of cells instead of values itself. This way could be used to perform logical test with multiple cells at a time.

AB
110 
220 
3=IF(A1<A2, "Value in cell A2 is greater than A1", "Value in cell A1 is greater than A2") 
4Result ->Value in cell A2 is greater than A1

Nested If Else

Nested IF ELSE is nothing but more complex structure of IF ELSE functions wherein we can add logic inside a logic. You can use seven IF in a single IF function

Syntax:

=IF(CONDITION, value if true, value if false)

Example:

=IF(A1>A2,"Value in cell A1 is greater than A2", IF(A2>A1,"Value in cell A2 is greater than A1","Value in cell A2 and A1 are equal"))

Referring to the Excel table above we are comparing values in cell A1 and A2. Here we are checking two conditions with nested If Else function:.

  1. If value in cell A1 is greater than value in cell A2
  2. If value in cell A2 is greater than value in cell A1
  3. If both condition not true and values in A1 and A2 are equal

Extra Tips:

  • If Else could not be used more than seven IF
  • IF ELSE functions could be used in almost all versions like: Excel 2013, Excel 2010, Excel 2007, Excel 2003 and Excel 2000
Was this article helpful?
YesNo