Gilbert13 Posted April 11, 2013 Posted April 11, 2013 Hi every one, I need to calculate the number of years and months between two dates fields. August31 = 8/31/2013 DOB = 9/1/2009 I need the calculation to show: 3Y 11M I appreciate any help. Thanks
doughemi Posted April 11, 2013 Posted April 11, 2013 This calculation should do the trick: Let([ ElapsedYears=GetAsText(Year(SecondDate) - Year(FirstDate) - If(SecondDate <Date(Month(FirstDate); Day(FirstDate); Year(SecondDate)); 1; 0)); ElapsedMonths = GetAsText(Mod(Month(SecondDate) - Month(FirstDate) + 12 - If(Day(SecondDate) < Day(FirstDate); 1; 0); 12)) ]; If(FirstDate="";""; ElapsedYears & " Y & " " & ElapsedMonths & " M") ) I can't take credit for it; I found it in a custom function years ago. Sorry I can't remember where, so I can't give proper credit.
Lee Smith Posted April 11, 2013 Posted April 11, 2013 Hi every one, I need to calculate the number of years and months between two dates fields. Also, look at the available Custom Functions at Brian Dunnings site here LINK and search for Elapse
Gilbert13 Posted April 15, 2013 Author Posted April 15, 2013 Thank you all for your help, this Works great for me.
David Jondreau Posted April 15, 2013 Posted April 15, 2013 It depends on what you're using it for and how you define a "month". Doug's example is okay, but you may consider January 29th, 2013 to February 28th, 2013 a month, while that calc doesn't.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now