Does an if statement calculate both the true and false?
"chriswilko" wrote:
I have an if statement which is basically
if(A1="OK",0,long and complex formula).
[....]
Does excel calculate that part of the formula
even for cells which are "OK" and hence taking
up loads of time, or does it ignore it knowing it
doesn't need to return it?
Unlike a real function, the IF expression evaluates only the parts that are
necessary; at least, in Excel 2003. You can validate that fact for your
revision of Excel with the following.
=if(A1,myUDF(1),myUDF(2))
where A1 is a 0 or 1, and myUDF is:
Function myUDF(x)
myUDF = x
MsgBox "myUDF " & x
End Function
----- original message -----
"chriswilko" wrote:
I have a spreasheet, with 40000+ rows.
I have an if statement which is basically if(A1="OK",0,long and complex
formula).
Almost all instances are "OK" with a few exceptions requiring the complex,
time consuming part of the formula.
Does excel calculate that part of the formula even for cells which are "OK"
and hence taking up loads of time, or does it ignore it knowing it doesn't
need to return it?
Thanks!
Chris
|