Description
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.
Syntax
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
=IF(A1="10x12",120,IF(A1="8x8",64,IF(A1="6x6",36)))
Parameters or Arguments
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.
Note
- This Nested IF function syntax demonstrates how to nest two IF functions. You can nest up to 7 IF functions.
Applies To
The Nested IF function can be used in the following versions of Microsoft Excel:
- Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Excel Function
The Nested IF function can be used in Microsoft Excel as the following type of function:
- Worksheet function (WS)
Example (as Worksheet Function)
Let's look at an example to see how you would use a Nested IF examples and explore how to use the Nested IF function as a worksheet function in Microsoft Excel:
Based on the spreadsheet above, the following Excel Nested IF examples would return:
=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 |