Mar 16, 2020 04:57 PM
So I know this shouldn’t be all that difficult, and I get the results for my first two outcomes (Blank and 1 Year), but no years past Year 1 provide an answer.
IF({Last Service Date}=BLANK(),BLANK(),IF({Service Frequency}=“1 Year”,DATEADD({Last Service Date}, 365, ‘days’,IF({Service Frequency}=“1.5 Years”,DATEADD({Last Service Date}, 547, ‘days’,IF({Service Frequency}=“2 Years”,DATEADD({Last Service Date}, 730, ‘days’, IF({Service Frequency}=“3 Years”,DATEADD({Last Service Date}, 1095, ‘days’, IF({Service Frequency}=“4 Years”,DATEADD({Last Service Date}, 11460, ‘days’)))))))))))
“Last Service Date” is a Calendar Type and “Service Frequency” is a Single Select Type (Single Line Text had same result). In Excel I can use a different formula that works just fine, but is not recognized here
Solved! Go to Solution.
Mar 17, 2020 03:58 AM
Hi @David_Owens - you can use a nested IF for this formula, but it you SWITCH statement instead it is a little easier to read (and to debug). I would do something like:
IF(
AND({Last Service Date}, {Service Frequency}),
SWITCH(
{Service Frequency},
'1 year', DATEADD({Last Service Date}, 365, 'days'),
'1.5 years', DATEADD({Last Service Date}, 547, 'days'),
'2 years', DATEADD({Last Service Date}, 730, 'days')
)
)
The AND()
at the start is just saying “if Last Service Date and Service Frequency exist” - this is a bit easier than saying “if X = blank, then blank” etc.
JB
Mar 17, 2020 03:58 AM
Hi @David_Owens - you can use a nested IF for this formula, but it you SWITCH statement instead it is a little easier to read (and to debug). I would do something like:
IF(
AND({Last Service Date}, {Service Frequency}),
SWITCH(
{Service Frequency},
'1 year', DATEADD({Last Service Date}, 365, 'days'),
'1.5 years', DATEADD({Last Service Date}, 547, 'days'),
'2 years', DATEADD({Last Service Date}, 730, 'days')
)
)
The AND()
at the start is just saying “if Last Service Date and Service Frequency exist” - this is a bit easier than saying “if X = blank, then blank” etc.
JB
Mar 17, 2020 06:18 AM
Awesome! That did it. Thank you very much!