Skip to main content

Calculating years,months,days remaining between two dates


Hi guys,


First, credits to @Jeremy_Oglesby for this awesome workaround. Since I cannot message him directly here, I am hoping that he catches this! Thank you so much for this!!! My coding skills are not good and I have been trying to figure this on my own.


This was his workaround:


IF(

{Months Remaining}>0,

IF(

{Years Remaining}>0,

{Years Remaining}) &

IF(

{Years Remaining}>1, "yrs ",

IF(

{Years Remaining}=1, “yr "

)

) &

({Months Remaining}-{Years Remaining}*12) &

IF(

OR(

({Months Remaining}-{Years Remaining}*12)>1,

({Months Remaining}-{Years Remaining}*12)=0

),

“mos “,

IF(

({Months Remaining}-{Years Remaining}*12)=1,

“mo "

)

),

{Days Remaining} &

IF(

{Days Remaining}>1,” days”,

IF(

{Days Remaining}=1,” day”

)

)

)


I noticed that this only works for combinations of years and months so lets say just for the sake of this example that the remaining duration would be 1 year &; 6 months ; 28 days. Then it will not display the 28 days when using this formula. It wont display 28 days until it goes to a full month which should be then 1 year & 7 months.


Can you give a modified version of this code to include the remaining 28 days?


Anyone’s time would be appreciated! I just cant seem to work on the logic of the code.


Thanks again!

2 replies

  • Author
  • Participating Frequently
  • 6 replies
  • January 8, 2019

This is the direct link to the specific topic


https://community.airtable.com/t/calculate-difference-between-two-dates/17038/2

  • Inspiring
  • 1386 replies
  • January 8, 2019
John_Hairam_Fuj wrote:

This is the direct link to the specific topic


https://community.airtable.com/t/calculate-difference-between-two-dates/17038/2

See my reply to the original post for some unexpected complications regarding your request.


Reply