Skip to main content

I have this formula that is working: IF({Start date},DATETIME_FORMAT(DATEADD({Start date},14, 'days'),'MM/DD/YYYY'),"") 

I want to incorporate these conditions to it:

IF(Category = "Playbooks",14, 'days')

IF(Category = "How-to-Guides",3,’days')

 

 

Hey ​@Leyvis,

You might want to give the following formula a shot:
 

IF(
{Start date},
DATETIME_FORMAT(
DATEADD(
{Start date},
IF(
{Category} = "Playbooks",
14,
IF(
{Category} = "How-to-Guides",
3,
0
)
),
'days'
),
'MM/DD/YYYY'
),
""
)

 
Completely different matter, but would love to have you join our Airtable Hackathon! Make sure to sign up!!

Mike, Consultant @ Automatic Nation 
YouTube Channel 


I used SWITCH instead of nested IFs because it makes a bit more sense to me, but this should work…

IF({Start date}, 
SWITCH(
{Category},
"Playbooks",DATETIME_FORMAT(DATEADD({Start date},14, 'days'),'MM/DD/YYYY'),
"How-To-Guides", DATETIME_FORMAT(DATEADD({Start date},3, 'days'),'MM/DD/YYYY')), "")

You can also add more categories pretty simply this way.


Yes, ​@DisraeliGears01 solution is way cleaner :D

Mike, Consultant @ Automatic Nation 
YouTube Channel


Hey ​@Leyvis,

You might want to give the following formula a shot:
 

IF(
{Start date},
DATETIME_FORMAT(
DATEADD(
{Start date},
IF(
{Category} = "Playbooks",
14,
IF(
{Category} = "How-to-Guides",
3,
0
)
),
'days'
),
'MM/DD/YYYY'
),
""
)

 
Completely different matter, but would love to have you join our Airtable Hackathon! Make sure to sign up!!

Mike, Consultant @ Automatic Nation 
YouTube Channel 

Right on, it clarified how to include the additional If statements. Thank you. 


I used SWITCH instead of nested IFs because it makes a bit more sense to me, but this should work…

IF({Start date}, 
SWITCH(
{Category},
"Playbooks",DATETIME_FORMAT(DATEADD({Start date},14, 'days'),'MM/DD/YYYY'),
"How-To-Guides", DATETIME_FORMAT(DATEADD({Start date},3, 'days'),'MM/DD/YYYY')), "")

You can also add more categories pretty simply this way.

So much cleaner approach and less thinking of all the parenthesis and commas. I will start playing with SWITCH.


A further addition!

IF(
{Start Date},
DATETIME_FORMAT(
DATEADD(
{Start Date},
SWITCH(
{Category},
'Playbooks', 14,
'How-To-Guides', 3
),
'days'
),
'MM/DD/YYYY'
)
)