Help

Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

))) at the end of formulas

Topic Labels: Automations
Solved
Jump to Solution
205 4
cancel
Showing results for 
Search instead for 
Did you mean: 

Hi using this formula works…
IF({Type of Task}=“CANCEL”,DATEADD({Check In Date},-1,“days”), IF({Type of Task}=“REBOOK”,DATEADD({Check In Date},-60,"days”)))

But then I want to add another condition so have copied it the exact same way and it doesn’t work? I’m suspecting its to do with the number of ))) at the end as I have no clue why in the first condition it ended with ) and the second ended with ))) so have tried all number of them but they don’t work. Thanks in advance.

IF({Type of Task}=“CANCEL”,DATEADD({Check In Date},-1,“days”), IF({Type of Task}=“REBOOK”,DATEADD({Check In Date},-60,"days”))), IF({Type of Task}=“CHECK PAYMENT”,DATEADD({Check In Date},1,"days”)))

1 Solution

Accepted Solutions

Every ( must have a closing ). You cannot have extra ) or extra ( or your formula won’t work. Your revised formula doesn’t work because you closed off the first set of ( and then added more closing ) to the very end; in other words, you aren’t nesting IF() statements properly

Instead of nesting several IFs together to check the value of the same field, use a single SWITCH statement to reduce the number of parenthesis to track:

SWITCH(
   {Type of Task},
   "CANCEL",DATEADD({Check In Date},-1,"days"), 
   "REBOOK",DATEADD({Check In Date},-60,"days"), 
   "CHECK PAYMENT",DATEADD({Check In Date},1,"days")
)

^ Even that can be re-worked since its a DATEADD to the same field every time.

IF(
   AND({Type of Task}, {Check In Date}),
   DATEADD(
      {Check In Date},
      SWITCH(
         {Type of Task},
         "CANCEL",-1, 
         "REBOOK",-60, 
         "CHECK PAYMENT",1
      ),
      "days"
   )
)

See Solution in Thread

4 Replies 4
IF({Type of Task}="CANCEL",DATEADD({Check In Date},-1,'days'),IF({Type of Task}="REBOOK",DATEADD({Check In Date},-60,'days'),IF({Type of Task}="CHECK PAYMENT",DATEADD({Check In Date},1,'days'))))

Every ( must have a closing ). You cannot have extra ) or extra ( or your formula won’t work. Your revised formula doesn’t work because you closed off the first set of ( and then added more closing ) to the very end; in other words, you aren’t nesting IF() statements properly

Instead of nesting several IFs together to check the value of the same field, use a single SWITCH statement to reduce the number of parenthesis to track:

SWITCH(
   {Type of Task},
   "CANCEL",DATEADD({Check In Date},-1,"days"), 
   "REBOOK",DATEADD({Check In Date},-60,"days"), 
   "CHECK PAYMENT",DATEADD({Check In Date},1,"days")
)

^ Even that can be re-worked since its a DATEADD to the same field every time.

IF(
   AND({Type of Task}, {Check In Date}),
   DATEADD(
      {Check In Date},
      SWITCH(
         {Type of Task},
         "CANCEL",-1, 
         "REBOOK",-60, 
         "CHECK PAYMENT",1
      ),
      "days"
   )
)

Thank you so much for taking the time to explain, I am new to this and struggling with the formulas. Will give it a try!

Thanks again both work, I have learned something new!