Forum Discussion

DirkRuana's avatar
DirkRuana
Qrew Captain
6 years ago

Adding number of days to Date - Formula Field

Hello:

Your friendly yet persistent novice with another question:

I am trying to add days to a date - formula field based on selection in a different field.

Error Message:

Formula syntax error

Please check the syntax of your formula. Look for mismatched parentheses, missing quotes, or extra brackets.


if(

[Work Type]="RD-Reactive",([Date Complete WO Received]+Days(5)),

[Work Type]="PJ-Planned Job",([Date Complete WO Received]+Days(12)),
[Work Type]="RP-Reactive Project",([Date Complete WO Received]+Days(10)),
)

Any help would be greatly provided 

Dirk



  • The problem is that there was an extra comma at the end

    if(
    [Work Type]="RD-Reactive",([Date Complete WO Received]+Days(5)),
    [Work Type]="PJ-Planned Job",([Date Complete WO Received]+Days(12)),
    [Work Type]="RP-Reactive Project",([Date Complete WO Received]+Days(10))
    )

    but this also can be simplified to

    Case([Work Type],
    "RD-Reactive",            [Date Complete WO Received]+Days(5),
    "PJ-Planned Job",       [Date Complete WO Received]+Days(12),
    "RP-Reactive Project",[Date Complete WO Received]+Days(10))

  • Dan:

    Thank you for quick response!

    I tried both, but still not seeing results in [Target End Date] field.

    No formula error messages.

    Dirk
  • On an example record, what date is in the field for 
    [Date Complete WO Received]

     and what value is on the field for

    [Work Type]


     
  • Dan:

    All good!  Just a slight formatting issue on my part.

    Thank you so much.  I am so envious of your skills.

    Dirk