防止Excel评估OR()中不需要的表达式 [英] Prevent Excel from evaluating unneeded expressions in OR()

查看:104
本文介绍了防止Excel评估OR()中不需要的表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IF(OR(ISNA(MATCH(8,B10:B17,0)),MATCH(8,B10:B17,0)>8),"",...BLAH...)

我了解如何通过重新排列公式来解决此问题.我已经证明了这一点.您可以看到OR()语句检查第一个MATCH()是否返回NA.这样做时,OR()应该自动返回TRUE,并且不求值第二个MATCH(),因为无论其他参数如何,都已满足OR()返回true的条件.您会注意到,第一个和第二个MATCH()函数执行相同的操作.发生的情况是,整个函数正在返回NA,因为即使不必执行第二个MATCH(),OR()也已满足一个TRUE,因此该函数应返回".

I understand how to fix this problem by rearranging my formula. I have it the way it is to show this point. You can see the OR() statement checks to see if the first MATCH() returns NA. When it does, OR() should automatically return TRUE and not evaluate the second MATCH() because conditions have been met for the OR() to return true no matter what other arguments there are. You'll notice that the first and second MATCH() functions do the same thing. What's happening is the entire function is returning NA because the second MATCH() is executing even though it doesn't have to, the OR() has been satisfied with one TRUE, therefore the function should return "".

这是错误还是故意的?

推荐答案

在Excel公式中OR不会短路求值(AND也不短路),但IF会短路. 我想它是故意的,因为它一直都是这种方式.

In Excel Formulae OR does not shortcircuit evaluation (neither does AND), but IF does. I guess its intentional since it has always been that way.

这篇关于防止Excel评估OR()中不需要的表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆