Help

Re: Multiple if's for date calculation

1195 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Curtis_Hall1
4 - Data Explorer
4 - Data Explorer

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?

4 Replies 4

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")))

Curtis_Hall1
4 - Data Explorer
4 - Data Explorer

Doh! That’s what I get for working on this late at night.

Thanks! That fixed it.

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.

Would be really nice to have a decent editor for formulae built into AP. While were at it, a real scripting language…