How does Excel evaluate embedded "IF" statements

K

Kc-Mass

I am working on a large worksheet (50 meg, 13,000 rows) not of my making.

It has a huge number of embedded IF statements with VLOOKUPS also
embedded in them.

Each file is set to calculate manually after large segments of data are
pulled out
and replaced. the calculation can take over an hour.

Question: How does excel evaluate embedded IFs. If the first value is true,
does Excel take that value and stop or does it evaluate all the IFs in the
formula regardless of whether the first one is true?

I would say that in Formula "A" the likelyhood of the first IF condition
evaluating to true is less than thirty percent. The likelyhood of the
second IF condition evaluating to true is less than twenty percent. The
likelyhood of the third IF condition evaluating to true is more than sixty
percent.

Would rearranging the order of the formula components make calculation
faster.

Thx for any help/ideas
 
G

Gary''s Student

If TRUE, then only the first argument gets evaluated.
If FALSE, then the first argument gets skipped and the second argument gets
evaluated.
 
J

John Coleman

I wish VBA were like that.

As a worksheet function =IF(TRUE,1,1/0) returns an unproblematic 1 but
the VBA equivalent IIF(True,1,1/0) throws a divison by zero error. This
renders the IIF() function much less useful than it could be, which
might be one of the reasons that VBA programmers seem to not use it
much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top