Help

Airtable Date Calculation

Topic Labels: Data Formulas
Solved
Jump to Solution
941 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Harrry
5 - Automation Enthusiast
5 - Automation Enthusiast

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!

1 Solution

Accepted Solutions
Alexey_Gusev
12 - Earth
12 - Earth

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

 



See Solution in Thread

2 Replies 2
Alexey_Gusev
12 - Earth
12 - Earth

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

 



Hi Alexey,

Awesome, thanks so much for your assistance - it worked!