The rest of your formula is a mathematic function that should result in a number, but your first condition results in an empty string.
In Airtable, you want to say “If field is blank do nothing”, you get the same result as “Do something if the field has a value” without risking putting strings where numbers/dates should be.
The other issue with your formula is its missing closing parentheses for the first IF.
IF(
{Start Date},
DATETIME_DIFF(
IF({End Date}, {End Date}, TODAY()),
{Start Date},
'days'
)
)
Since the DATETIME_DIFF function’s only variable was the first date, I just used the function once with an IF inside it.
The rest of your formula is a mathematic function that should result in a number, but your first condition results in an empty string.
In Airtable, you want to say “If field is blank do nothing”, you get the same result as “Do something if the field has a value” without risking putting strings where numbers/dates should be.
The other issue with your formula is its missing closing parentheses for the first IF.
IF(
{Start Date},
DATETIME_DIFF(
IF({End Date}, {End Date}, TODAY()),
{Start Date},
'days'
)
)
Since the DATETIME_DIFF function’s only variable was the first date, I just used the function once with an IF inside it.
This works perfect. I’ll study and keep in mind for the future. Thank you!
This works perfect. I’ll study and keep in mind for the future. Thank you!
I tend to simplify formulas down as much as possible. If you’re curious, the correct syntax for your original method would be:
IF(
{Start Date} = BLANK(),
BLANK(),
IF(
{End Date} = BLANK(),
DATETIME_DIFF(TODAY(),{Start Date}, 'days'),
DATETIME_DIFF({End Date}, {Start Date}, 'days')
)
)
I tend to simplify formulas down as much as possible. If you’re curious, the correct syntax for your original method would be:
IF(
{Start Date} = BLANK(),
BLANK(),
IF(
{End Date} = BLANK(),
DATETIME_DIFF(TODAY(),{Start Date}, 'days'),
DATETIME_DIFF({End Date}, {Start Date}, 'days')
)
)
Yeah. This is a thing of beauty!