Maximum number of times an IF function can be nested

时间:2015-07-28 22:25:30

标签: excel excel-formula nested

I am getting ready to create an abnormally long IF function with other IF functions nested in it and before I start I wanted to see if anyone knew if there was a limit to how many nested functions you can have.

This site (http://www.techonthenet.com/excel/formulas/if_nested.php) says that the max is 7 times but I have done more than 7...

2 个答案:

答案 0 :(得分:1)

This depends on which version of Excel you are using. Prior to 2007 the limit was 7, but from 2007 onward it is 64. You can see this if you try to type the following formula:

=IF(L20=1,1,IF(L20=2,2,IF(L20=3,3,IF(L20=4,4,IF(L20=5,5,IF(L20=6,6,IF(L20=7,7,IF(L20=8,8,IF(L20=1,1,IF(L20=2,2,IF(L20=3,3,IF(L20=4,4,IF(L20=5,5,IF(L20=6,6,IF(L20=7,7,IF(L20=8,8,IF(L20=1,1,IF(L20=2,2,IF(L20=3,3,IF(L20=4,4,IF(L20=5,5,IF(L20=6,6,IF(L20=7,7,IF(L20=8,8,IF(L20=1,1,IF(L20=2,2,IF(L20=3,3,IF(L20=4,4,IF(L20=5,5,IF(L20=6,6,IF(L20=7,7,IF(L20=8,8,IF(L20=1,1,IF(L20=2,2,IF(L20=3,3,IF(L20=4,4,IF(L20=5,5,IF(L20=6,6,IF(L20=7,7,IF(L20=8,8,IF(L20=1,1,IF(L20=2,2,IF(L20=3,3,IF(L20=4,4,IF(L20=5,5,IF(L20=6,6,IF(L20=7,7,IF(L20=8,8,IF(L20=1,1,IF(L20=2,2,IF(L20=3,3,IF(L20=4,4,IF(L20=5,5,IF(L20=6,6,IF(L20=7,7,IF(L20=8,8,IF(L20=1,1,IF(L20=2,2,IF(L20=3,3,IF(L20=4,4,IF(L20=5,5,IF(L20=6,6,IF(L20=7,7,IF(L20=8,8,IF(L20=1,1,IF(L20=2,2,IF(L20=3,3,IF(L20=4,4,IF(L20=5,5,IF(L20=6,6,IF(L20=7,7,IF(L20=8,8,0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

There are over 64 levels of nesting here, and Excel will display a message box saying "The specified formula cannot be entered because it uses more than 64 levels of nesting".

答案 1 :(得分:0)

这, 这个问题困扰了我一段时间,所以,为了好玩,我去了它,这是一个结果(当微软这么说时,它必须工作)。我在iliketocode发布的代码中做了一些更改。

=IF(L20=1,1,IF(L20=2,2,IF(L20=3,3,IF(L20=4,4,IF(L20=5,5,IF(L20=6,6,IF(L20=7,7,IF(L20=8,8,IF(L20=9,9,IF(L20=10,10,IF(L20=11,11,IF(L20=12,12,IF(L20=13,13,IF(L20=14,14,IF(L20=15,15,IF(L20=16,16,IF(L20=17,17,IF(L20=18,18,IF(L20=19,19,IF(L20=20,20,IF(L20=21,21,IF(L20=22,22,IF(L20=23,23,IF(L20=24,24,IF(L20=25,25,IF(L20=26,26,IF(L20=27,27,IF(L20=28,28,IF(L20=29,29,IF(L20=30,30,IF(L20=31,31,IF(L20=32,32,IF(L20=33,33,IF(L20=34,34,IF(L20=35,35,IF(L20=36,36,IF(L20=37,37,IF(L20=38,38,IF(L20=39,39,IF(L20=40,40,IF(L20=41,41,IF(L20=42,42,IF(L20=43,43,IF(L20=44,44,IF(L20=45,45,IF(L20=46,46,IF(L20=47,47,IF(L20=48,48,IF(L20=49,49,IF(L20=50,50,IF(L20=51,51,IF(L20=52,52,IF(L20=53,53,IF(L20=54,54,IF(L20=55,55,IF(L20=56,56,IF(L20=57,57,IF(L20=58,58,IF(L20=59,59,IF(L20=60,60,IF(L20=61,61,IF(L20=62,62,IF(L20=63,63,IF(L20=64,64,IF(L20=65,65,)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))