Apr 25, 2023 01:52 AM
Hi everyone!
I am currently setting up a database to calculate how long a project has been active.
This means I'd like a formula that calculates the difference between (a) the start and finish dates or (b) the start and current date (if a finish date has not been specified).
I know of formulas that can do either of the needed functions, but not one that is conditional and selects which calculation is appropriate for each project.
Hopefully someone might be able to help me out?
Thanks again!
Solved! Go to Solution.
Apr 25, 2023 03:34 AM
Hi.
Airtable formulas are quite flexible. Statement 'if value X exists, show X, otherwise show Y' will be IF(X,X,Y)
You can even omit 'value if false', the default is 'show nothing' : if(X,X)
in you case, to get simple date difference, formula is:
DATETIME_DIFF({End Date},{Start date},'days')
if you want to use current date when end date is empty, it might be:
DATETIME_DIFF(IF({End Date},{End Date},TODAY()),{Start date},'days')
Apr 25, 2023 03:34 AM
Hi.
Airtable formulas are quite flexible. Statement 'if value X exists, show X, otherwise show Y' will be IF(X,X,Y)
You can even omit 'value if false', the default is 'show nothing' : if(X,X)
in you case, to get simple date difference, formula is:
DATETIME_DIFF({End Date},{Start date},'days')
if you want to use current date when end date is empty, it might be:
DATETIME_DIFF(IF({End Date},{End Date},TODAY()),{Start date},'days')
Apr 29, 2023 12:06 AM
Hi Alexey,
Awesome, thanks so much for your assistance - it worked!