Skip to main content

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?

Hi @Dennis_Stevens - use ‘months’ in your date diff formula, then divide the result by 12:



(DATETIME_DIFF(To, From, 'months'))/12


JB


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.


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.


Ah, OK, you need to look at the formatting option on the formula field - change this from integer to decimal:



JB


Ah, OK, you need to look at the formatting option on the formula field - change this from integer to decimal:



JB


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


Reply