Apr 06, 2022 02:26 PM
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”)))
Solved! Go to Solution.
Apr 06, 2022 06:59 PM
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"
)
)
Apr 06, 2022 04:08 PM
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'))))
Apr 06, 2022 06:59 PM
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"
)
)
Apr 06, 2022 11:38 PM
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!
Apr 06, 2022 11:43 PM
Thanks again both work, I have learned something new!