Sunday, 27 March 2011
Calculating Age Between 2 Date
It is easy to determine the number of days between two dates simply by subtracting one from the other, but it is very difficult to return a string that says something like 24 years, 6 months and 8 days.
Mathematics and logic involved in this question seems to be very complex. You may want to try using the function MONTH () and DAY (), but make sure you really test your formula.
Mathematics and logic involved in this question seems to be very complex. You may want to try using the function MONTH () and DAY (), but make sure you really test your formula.
In Excel you can do so by using the function DATEDIF (). Although not included in the help file or Excel wizard functionality to Excel 2000. However, it was in earlier versions of Excel.
It takes the following structure: = DATEDIF (Date1, Date2, OutputRequirement). The first two parameters are simple, although you need to ensure that the second date (Date2) is greater than the first (Date1). OutputRequirement parameter is the character code (typed in inverted commas) that determines the type of value that you want to get.
Code
|
Description
|
Explanation
|
"d" | Days | The number of days between Date1 and Date2. |
"m" | Months | Number of Months between Date1 and Date2. |
"y" | Years | Number of years between Date1 and Date2. |
"yd" | Days excluding Years | Count what day between Date1 and Date2 (Date1 and Date2 in the same year). |
"ym" | Months excluding Years | Count Month keberapa between Date1 and Date2 (Date1 and Date2 in the same year). |
"md" | Days excluding Months and Years | Count what day between Date1 and Date2 (Date1 and Date2 in the same month and year). |
example:
The first date to your date of birth and date of both should be included in another cell, or automatically set to today's date with the function NOW ().
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment