Jun 29, 2019 11:56 PM
I need to count the number of fractional years between dates. I’m currently using this formula to count the number of days between dates:
DATETIME_DIFF({To},{From},‘days’)
and this formula works great for the number of days between dates but what I really need is fractional years between dates, such as 1.1, 1.5, etc, such as the YEARFRAC function does in Excel. If I change ‘days’ to ‘year’ I get whole number results like 0, 1 or 2. I need to show fractions of a year.
Suggestions anyone?
Jun 30, 2019 08:29 AM
Hi @Dennis_Stevens - use ‘months’ in your date diff formula, then divide the result by 12:
(DATETIME_DIFF(To, From, 'months'))/12
JB
Jun 30, 2019 09:49 PM
Thank you very much for your help. The formula, however, did not work for me. This is the formula I used with your suggestion:
(DATETIME_DIFF(To,From,‘months’))/12
It returned whole numbers instead of fractional ones. Any follow ideas? And thanks again very much for trying to help.
Jun 30, 2019 10:28 PM
Ah, OK, you need to look at the formatting option on the formula field - change this from integer to decimal:
JB
Jun 30, 2019 11:33 PM
That’s it! Perfect; thank you very much. I’m new to Airtable and had a project ready to go so I’m heading out without much experience with it yet. So far, I love.
Thanks again.
Dennis