Aug 16, 2017 09:07 PM
I’m trying to calculate dates based on two values. I have a formula that works for this:
IF({Renewal type} = "Annual", DATETIME_FORMAT(DATEADD({Last register date}, 90, 'days'), "MM/DD/YYYY"))
If I try to add another IF statement then it fails:
IF({Renewal type} = "Annual", DATETIME_FORMAT(DATEADD({Last register date}, 90, 'days'), "MM/DD/YYYY"),IF({Renewal type} = "Semi Annual", DATETIME_FORMAT(DATEADD({Last register date}, 300, 'days'), "MM/DD/YYYY")
What am I doing wrong?
Aug 16, 2017 09:34 PM
I think you just need to add two more close parentheses “)”. You’ve closed DATETIME_FORMAT function at the end, but but you still need to close the two IF functions.
IF({Renewal type} = "Annual", DATETIME_FORMAT(DATEADD({Last register date}, 90, 'days'), "MM/DD/YYYY"),IF({Renewal type} = "Semi Annual", DATETIME_FORMAT(DATEADD({Last register date}, 300, 'days'), "MM/DD/YYYY")))
Aug 16, 2017 09:57 PM
Doh! That’s what I get for working on this late at night.
Thanks! That fixed it.
Aug 17, 2017 04:39 AM
Doesn’t matter: Day, night, afternoon. I’m forever dropping or misplacing parentheses. As a result, to detect or prevent such annoyance, I often create my formulas in Notepad++ and then paste them into Airtable. Notepad++ has automatic highlighting of common delimiters, including parentheses; if you hover over one parenthesis, both it and its complementary match turn red. Makes missing parentheses easy to find. It’s for Windows, but similar apps exist for MacOS and Linux.
Aug 17, 2017 05:46 AM
Would be really nice to have a decent editor for formulae built into AP. While were at it, a real scripting language…