Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

XL2000: Error Message with Formula Containing More Than Seven Embedded IF Statements


View products that this article applies to.

This article was previously published under Q214154

↑ Back to the top


Summary

Microsoft Excel has a limit of seven levels of embedded, or "nested," IF statements. Eight or more IF statements embedded in the same formula cause Microsoft Excel to return the following error message:
Error in Formula.

↑ Back to the top


More information

When more than seven levels of embedded IF statements are required, you need to create a function macro, which allows you to break your IF statement over several lines (or formulas).

Example of Correct Formula

A total of eight IF statements are allowed, but only seven may be embedded.

NOTE: The following example operates correctly; it consists of one IF statement, which has seven embedded within it (for a total of eight).
   =IF(A1=1,0,IF(A1=2,2,IF(A1=3,3,IF(A1=4,4,IF(A1=5,5,IF

       (A1=6,6,IF(A1=7,7,IF(A1=8,8,0))))))))
				

Example of an Incorrect Formula

NOTE: The following example consists of one IF statement, which has eight embedded within it (for a total of nine).
   =IF(A1=1,0,IF(A1=2,2,IF(A1=3,3,IF(A1=4,4,IF(A1=5,5,IF

       (A1=6,6,IF(A1=7,7,IF(A1=8,8,IF(A1=9,9,0)))))))))
				
It is the last occurrence that causes the formula to fail.

↑ Back to the top


Keywords: KB214154, kbhowto

↑ Back to the top

Article Info
Article ID : 214154
Revision : 5
Created on : 11/5/2003
Published on : 11/5/2003
Exists online : False
Views : 272