View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
John Coleman John Coleman is offline
external usenet poster
 
Posts: 274
Default How does Excel evaluate embedded "IF" statements

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.

Gary''s Student wrote:
If TRUE, then only the first argument gets evaluated.
If FALSE, then the first argument gets skipped and the second argument gets
evaluated.
--
Gary's Student