Help

))) at the end of formulas

Topic Labels: Automations
Solved
Jump to Solution
1226 4
cancel
Showing results for 
Search instead for 
Did you mean: 
Bianca_Kearney
5 - Automation Enthusiast
5 - Automation Enthusiast

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
Kamille_Parks
16 - Uranus
16 - Uranus

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'))))
Kamille_Parks
16 - Uranus
16 - Uranus

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"
   )
)
Bianca_Kearney
5 - Automation Enthusiast
5 - Automation Enthusiast

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!