# Multiple If Staements

Hi Everyone,

I am new to Monday and trying to use a a formula to update the due dates using if statements. Somehow it is not working. So, my problem is simple and I want to achieve as follows:

If({Practice Column}=“AB”, Update Due date to +N days)
If({Practice Column}=“CD”, Update Due date to +N days)
If({Practice Column}=“XY”, Update Due date to +N days)
Else ( Update Due date to +n days)

I Have tried nested if statement and Switch statement however, it is not giving me the expected results. It always work for First if statement but not for other cases. of course, I must be doing something wrong or missing something which I am not able to identify.

Here is my Code Snippet I am using:

If Statement:
IF({item’s Pratice} = “QA”, TEXT(DATEVALUE({item’s Date}) + 7, “YYYY-MM-DD”), (IF({item’s Pratice} = “Front End”, TEXT(DATEVALUE({item’s Date}) + 7, “YYYY-MM-DD”), (TEXT(DATEVALUE({item’s Date}) + 7, “YYYY-MM-DD”)))))

Switch Statement:
SWITCH({item’s Pratice} , “QA”, TEXT(DATEVALUE({item’s Due Date}) + 7, “YYYY-MM-DD”),“Front End”, TEXT(DATEVALUE({item’s Due Date}) + 7, “YYYY-MM-DD”),“PHP”, TEXT(DATEVALUE({item’s Due Date}) + 7, “YYYY-MM-DD”),TEXT(DATEVALUE({item’s Due Date}), “YYYY-MM-DD”))

NOTE: I am using General Castor to Caste value to a column

Hi Rakesh
It might be better to do this via automation
using the if status or other value changes to something then push the due date by number of days

If this doesn’t provide what you need please let me know and i’ll take a deeper dive into the formula’s
Hope this is of help
Many thanks Dan

Hopefully the below might help… you can combine IF and SWITCH…example below not tested but modified from your code and should produce IF PRACTICE is QA or FRONT END, then push date+7, otherwise push date+3

IF( SWITCH({item’s Pratice},“QA”,1,“Front End”,1,0)=1, TEXT(DATEVALUE({item’s Date}) + 7, “YYYY-MM-DD”), TEXT(DATEVALUE({item’s Date}) + 3, “YYYY-MM-DD”) )

or this can be further simplified…

TEXT(DATEVALUE({item’s Date}) + SWITCH({item’s Pratice},“QA”,7,“Front End”,7,3), “YYYY-MM-DD”)

With General Caster, cast the result to a text column first, so you can see the output, once you get the right result, then change it to cast in to the date column.

Dan,

Thanks for the response. Yes, you are right and I can use the automation to push the due date but i have to create separate automations for each case and I have more than 20 cases. So it would not be ideal to use automation and the reason for choosing If or Switch statements.

I am still not able to execute the formula.

Matthew,

Thanks for the response. This should work if the no days to increase is same for N no of practices but in my case it would be different for each practice. The above code was an example to illustrate the statement I am using.

Then use this…

TEXT(DATEVALUE({item’s Date}) + SWITCH({item’s Pratice},“QA”,21,“Front End”,8,“XYZ”,12,3), “YYYY-MM-DD”)

For QA it adds 21, for FRONT END it adds 8, for XYZ it adds 12, for all others it adds 3… you can add more practices, like I added XYZ, or change the numbers