Senin, 15 Juni 2015

Re: [ExcelVBA] Inline if will not evaluate second condition


Hi Linda

I think you need to put some debug.print statements before the offending line to see what it is doing 

Debug.print [Finish]<=Date()
Debug.print  [% Complete]<>100
Debug.print [Finish]<=Date() And [% Complete]<>100

Then perhaps this will show you what is going wrong.

You may even need to break it down a bit further to
Debug.print [Finish]
Debug.print Date()
Debug.print  [% Complete]

David Grugeon

On 16 June 2015 at 06:52, [ExcelVBA] <> wrote:

I have a project plan where I have created an if statement however  second condition is not being evaluated. IF I change the order of the if statements, the first condition is evaluated but not the second.  

Correct syntactically but incorrect  results the second condition is not being evaluated so the 1 condition is never evaluated if condition 2 is true  so I think I need to swap the two and add an additional "and condition  to also evaluate the start and finish dates and %complete. I think I need another and condition but it breaks when I that logic to the formula.    

Any suggestions ?   

IIf([Finish]<=Date() And [% Complete]<>100,2,IIf([Start]<=Date() And [% Complete]=0,1,

IIf([% Complete]=100,3,0)))


Posted by: David Grugeon <>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: to enter the ezine, then search the ARCHIVES for EXCEL VBA.

Visit our ExcelVBA group home page for more info and support files:

More free tutorials and resources available at:




Tidak ada komentar:

Posting Komentar