Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sujit_nath
Creator III
Creator III

Calculate difference in months between two dates

I have 2 columns in format MM/DD/YYYY

I need to calculate the difference in months between 2 dates.

Ex: 04/25/2018  -  02/11/2016

and so on...

1 Solution

Accepted Solutions
sunny_talwar

May be use this where 30.4 gives a good approximation for the number of days in a month on average.

=(MakeDate(2018, 4, 25) - MakeDate(2016, 2, 11))/30.4

This gives 26.44

Capture.PNG

View solution in original post

10 Replies
sunny_talwar

sunny_talwar

Something like this

=(Year(MakeDate(2018, 4, 25)) * 12 + Month(MakeDate(2018, 4, 25))) - (Year(MakeDate(2016, 2, 11)) * 12 + Month(MakeDate(2016, 2, 11)))

sujit_nath
Creator III
Creator III
Author

I'm doing that in backend

sunny_talwar

This applies on the back end or front end

sujit_nath
Creator III
Creator III
Author

Isn't there an easier way?

sunny_talwar

What is so difficult about the above syntax?

sujit_nath
Creator III
Creator III
Author

Does this take into consideration leap years?

sunny_talwar

Are we talking about Month difference or Day Difference? How does Day play any role when determining the difference in Month... I am not sure I understand... from the two dates that you provided... what is your expected output?

sujit_nath
Creator III
Creator III
Author

I want that if it is more than 12 months it should put something after decimal, ie. 12.xyz..

If it's less than 12 as well, it should show in decimals, ex: a difference of 2 months 15 days should show as 2.5 etc.