IF FUNCTION

Posted by ICT Corner of SMAGA | 12:53 PM | 0 comments »

In Excel, the If function returns one value if a specified condition evaluates to TRUE, or another value if it evaluates to FALSE.

The syntax for the If function is:

If( condition, value_if_true, value_if_false )

condition is the value that you want to test.

value_if_true is the value that is returned if condition evaluates to TRUE.

value_if_false is the value that is return if condition evaluates to FALSE.

For example:

Let's take a look at an example:


Based on the Excel spreadsheet above:

=If(A1>10, "Larger", "Smaller") would return "Larger".
=If(A1=20, "Equal", "Not Equal") would return "Not Equal".
=If(A2="Tech on the Net", 12, 0) would return 12
NESTED IF
It is possible to nest multiple IF functions within one Excel formula. You can nest up to 7 IF

functions to create a complex IF THEN ELSE statement.

The syntax for the nesting the IF function is:

IF( condition1, value_if_true1, IF( condition2, value_if_true2, value_if_false2 ))

This would be equivalent to the following IF THEN ELSE statement:

IF condition1 THEN
value_if_true1
ELSEIF condition2 THEN
value_if_true2
ELSE
value_if_false2
END IF

This syntax example demonstrates how to nest two IF functions. You can nest up to 7 IF functions.

condition is the value that you want to test.

value_if_true is the value that is returned if condition evaluates to TRUE.

value_if_false is the value that is return if condition evaluates to FALSE.


Applies To:

  • Excel 2007, Excel 2003, Excel XP, Excel 2000

For example:

Let's take a look at an example:


Based on the Excel spreadsheet above:

=IF(A1="10X12",120,IF(A1="8x8",64,IF(A1="6x6",36))) would return 120
=IF(A2="10X12",120,IF(A2="8x8",64,IF(A2="6x6",36))) would return 64
=IF(A3="10X12",120,IF(A3="8x8",64,IF(A3="6x6",36))) would return 36

0 comments

Copyright@2011 SMA 3 Semarang