Duration Formula has Error

M

MarkC

I have the following formula for duration1 field:

ProjDateDiff([Start1],[Finish1])

If start1 and finishh1 are missing then the field displays very loudly
"#ERROR" can I have "0" instead or NA?

Cheers,

Mark
 
D

Dale Howard [MVP]

MarC --

To "trap" for an NA value in a Date field, you need to use the following
Function:

IIF([Actual Start] = ProjDateValue("NA), truepart, falsepart)

So, rewrite your original formula using the above. Hope this helps.
 
D

Dave

MarkC said:
I have the following formula for duration1 field:

ProjDateDiff([Start1],[Finish1])

If start1 and finishh1 are missing then the field displays very loudly
"#ERROR" can I have "0" instead or NA?

Cheers,

Mark

You can but it is messy if you want to use a duration field. You have
to filter out the cases where either or both of [Start1] and [Finish1]
are NA and define their behaviour.

Something like the following will do the job:

IIf( [Start1] = ProjDateValue( 'NA' ) , ProjDurConv( 0 , pjMinutes ) ,
IIf( [Finish1] = ProjDateValue( 'NA' ) , ProjDurConv( 0 , pjMinutes ) ,
ProjDateDiff( [Start1] , [Finish1] ) ) )
 
D

Dale Howard [MVP]

MarkC --

Corrected formula due to typo in first reply:

IIF([Actual Start] = ProjDateValue("NA"), truepart, falsepart)

Hope this helps.




Dale Howard said:
MarC --

To "trap" for an NA value in a Date field, you need to use the following
Function:

IIF([Actual Start] = ProjDateValue("NA), truepart, falsepart)

So, rewrite your original formula using the above. Hope this helps.





MarkC said:
I have the following formula for duration1 field:

ProjDateDiff([Start1],[Finish1])

If start1 and finishh1 are missing then the field displays very loudly
"#ERROR" can I have "0" instead or NA?

Cheers,

Mark
 
M

MarkC

Dale,

Many thanks - so my formula came out as:

IIf([Start1]=ProjDateValue("NA"),0,ProjDateDiff([Start1],[Finish1]))

Cheers,

Mark

Dale Howard said:
MarkC --

Corrected formula due to typo in first reply:

IIF([Actual Start] = ProjDateValue("NA"), truepart, falsepart)

Hope this helps.




Dale Howard said:
MarC --

To "trap" for an NA value in a Date field, you need to use the following
Function:

IIF([Actual Start] = ProjDateValue("NA), truepart, falsepart)

So, rewrite your original formula using the above. Hope this helps.





MarkC said:
I have the following formula for duration1 field:

ProjDateDiff([Start1],[Finish1])

If start1 and finishh1 are missing then the field displays very loudly
"#ERROR" can I have "0" instead or NA?

Cheers,

Mark
 
D

Dale Howard [MVP]

MarC --

You are becoming a true formula writer in Microsoft Project. Way to go, my
friend! I think the keys to writing good formulas in the software are:

1. Don't make goofy type mistakes like I did. :)
2. Take full advantage of the Functions available in the software.

Use the ProjDateValue function to test for an NA in a date field is very
important, as you now know. Other very useful functions are: ProjDateDiff,
IIF, and Switch. Hope this helps.




MarkC said:
Dale,

Many thanks - so my formula came out as:

IIf([Start1]=ProjDateValue("NA"),0,ProjDateDiff([Start1],[Finish1]))

Cheers,

Mark

Dale Howard said:
MarkC --

Corrected formula due to typo in first reply:

IIF([Actual Start] = ProjDateValue("NA"), truepart, falsepart)

Hope this helps.




"Dale Howard [MVP]" <dale(dot)howard(at)msprojectexperts(dot)com> wrote
in
message news:%[email protected]...
MarC --

To "trap" for an NA value in a Date field, you need to use the
following
Function:

IIF([Actual Start] = ProjDateValue("NA), truepart, falsepart)

So, rewrite your original formula using the above. Hope this helps.





I have the following formula for duration1 field:

ProjDateDiff([Start1],[Finish1])

If start1 and finishh1 are missing then the field displays very loudly
"#ERROR" can I have "0" instead or NA?

Cheers,

Mark
 

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