Forum Discussion

JBLT-77's avatar
JBLT-77
Iron Contributor
Aug 28, 2022
Solved

Getting #ERROR in Custom Text Field Using IIf Function For The False Argument

I created a simple IIF function in a custom text field to check whether a task is part of the project baseline using the Baseline Start field.  If the task is not part of baseline then the field disp...
  • John-project's avatar
    John-project
    Aug 31, 2022

    John,
    In the digital world dates are represented by numbers. For example, 8/29/22 12:00 PM is stored as 44802.54. String based fields (e.g. Text1) can of course have any string variable (e.g. "NA").

    What I don't fully understand is that the latest date possible with Project (current versions) is 12/31/2149 which is represented by: 91312.34, yet using the ">50000" trick still works for "NA".

     

    Interestingly enough, an "if" statement in VBA can directly detect "NA" in a date field. For example, the following code works fine:

    Sub testNA()
    For Each t In ActiveProject.Tasks
    t.Text1 = "yes"
    If (t.BaselineStart = "NA") Then t.Text1 = "no"
    Next t
    End Sub

    Oh the mysteries of Project 🙂
    John

Resources