mraccess101
Registered User.
- Local time
- Yesterday, 19:47
- Joined
- Feb 11, 2013
- Messages
- 21
How to count months after finished last year & count days after last finished month?
Recently I moved from using Excel to Access to track my data, and I love it. But I have some difficulties to translate one function that I very often have used in Excel, namely the function "DATEDIF". After some research to find how to do this is Access I found the function "DATEDIFF", with an extra "F" in comparison with Excel. But the function "DATEDIFF" in Access does not the same thing as the function "DATEDIF" in Excel. The difference is that the "DATEDIF" in Excel can count the days after the last completed month and/or count the months after the last completed year.
This is how I used the function in Excel.
=DATEDIF(B2,NOW(),"y")&" Years, "&DATEDIF(B2,NOW(),"ym")&" month, and "&DATEDIF(B2,NOW(),"md")&" days"
"YM" counts the month(s) after the last finished year
"MY" counts the days(s) after the last finished month
This video shows in more detail how the function works.
http://www.youtube.com/watch?v=F9dz30QkL7g
And this is how I try to use the function in Access.
Query
Result
Sadly, the function doesn't allow me to calculate exact the years, months and days like Excel does.
This function I used to track registration time was for me very helpful, but unfortunately I still not have find a way to do the same in Access. I hope someone have a solution to have the same result as I had in Excel.
Thanks in advance.
Please forgive me for my grammatical errors, English is not my native language.
Recently I moved from using Excel to Access to track my data, and I love it. But I have some difficulties to translate one function that I very often have used in Excel, namely the function "DATEDIF". After some research to find how to do this is Access I found the function "DATEDIFF", with an extra "F" in comparison with Excel. But the function "DATEDIFF" in Access does not the same thing as the function "DATEDIF" in Excel. The difference is that the "DATEDIF" in Excel can count the days after the last completed month and/or count the months after the last completed year.
This is how I used the function in Excel.
=DATEDIF(B2,NOW(),"y")&" Years, "&DATEDIF(B2,NOW(),"ym")&" month, and "&DATEDIF(B2,NOW(),"md")&" days"
"YM" counts the month(s) after the last finished year
"MY" counts the days(s) after the last finished month
This video shows in more detail how the function works.
http://www.youtube.com/watch?v=F9dz30QkL7g
And this is how I try to use the function in Access.
Query
Result
Sadly, the function doesn't allow me to calculate exact the years, months and days like Excel does.
This function I used to track registration time was for me very helpful, but unfortunately I still not have find a way to do the same in Access. I hope someone have a solution to have the same result as I had in Excel.
Thanks in advance.
Please forgive me for my grammatical errors, English is not my native language.