Skip to main content

calculate the days remaining between today and month end

  • April 19, 2023
  • 2 replies
  • 49 views

Forum|alt.badge.img+1

I am quite new to airtable, i am trying to create a formula that says if an end date exists THEN subtract today's date from the end date column ELSE calculate days remaining in the month.

I have checked through various date formulas on the community and i do not find a fomrula that directly calculates days remaining between today and month end if there is no value in the field 'end date'.

Can someone help please?

2 replies

Jason_Hill
Forum|alt.badge.img+13
  • Inspiring
  • 40 replies
  • April 20, 2023

This will get you close but it is not a complete winner. Airtable does not recognize the EOMONTH function, so I can't figure out how to calculate to the end of the current month. It counts backward and then forwards depending on your {end date} and the current date.

IF({End Date}, DATETIME_DIFF({End Date}, TODAY(), 'days'), (DATETIME_FORMAT(DATEADD(TODAY(), 1, 'month'), 'YYYY-MM') & "-01") - TODAY())

Forum|alt.badge.img+1
  • Author
  • New Participant
  • 1 reply
  • April 20, 2023

This will get you close but it is not a complete winner. Airtable does not recognize the EOMONTH function, so I can't figure out how to calculate to the end of the current month. It counts backward and then forwards depending on your {end date} and the current date.

IF({End Date}, DATETIME_DIFF({End Date}, TODAY(), 'days'), (DATETIME_FORMAT(DATEADD(TODAY(), 1, 'month'), 'YYYY-MM') & "-01") - TODAY())

Thank you @Jason_Hill 
the formula worked for calculating the remaining number of days from today to the end date but did not calculate the days remaining till the end of the month.

I have managed to find a way around getting my answer, although it took series of formulas to finally arrive there.
Thank you @Jason_Hill again for helping out