Here are the valid values that you can use for Code.
- Y - will tell you the number of complete years between the two dates.
- YM - will tell you the number of complete months, excluding the years, between the two dates.
- MD - will tell you the number of complete days, excluding complete months, between the two dates.
- M - will tell you the number of complete months. For example, I've been alive for 495 months
- D - will tell you the number of days. For example, I've been alive for 15,115 days. This is a trivial use, since you could just subtract one date from another and format as a number to duplicate this code.
The formula in column G strings this together to create text with the length of time in years, months, and days.
You could combine this into a single formula. If cell A2 contains the joining date, use the following formula in B2:
=DATEDIF($A2,TODAY(),"Y")&" years, "&DATEDIF($A2,TODAY(),"YM")&" months & "&DATEDIF($A2,TODAY(),"MD")&" days"
No comments:
Post a Comment