# Calculate age in days/months/years in OpenOffice

In need to find the age in days - months - years in OpenOffice.

There is `DATEDIF()` in Microsoft Excel. You can use it to find the difference in days/months/years between two dates.

``````Age Calculation
You can calculate a persons age based on their birthday and todays date.
The calculation uses the DATEDIF() function.
The DATEDIF() is not documented in Excel 5, 7 or 97, but it is in 2000.
(Makes you wonder what else Microsoft forgot to tell us!)
Birth date :    01-Jan-60
Years lived :   52   =DATEDIF(C8,TODAY(),"y")
and the months :    4    =DATEDIF(C8,TODAY(),"ym")
and the days :  30   =DATEDIF(C8,TODAY(),"md")
``````

One can calculate by below formula, but it is cumbersome to calculate months.

``````Another way to calculate age
This method gives you an age which may potentially have decimal places representing the months.
If the age is 20.5, the .5 represents 6 months.
Birth date :    01-Jan-60
Age is :    52.41    =(TODAY()-C23)/365.25
``````
-
Did you check your post's formatting before you submitted it? Please check the preview area. – slhck May 31 '12 at 9:59

Just use the `YEARS()` and `MONTHS()` function from the set of Date/Time functions:

``````=YEARS(01-Jan-60,NOW,1)
``````

and

``````=MONTHS(01-Jan-60,NOW,1)
``````

will give you the sum of years and months elapsed. To get the remainder months from the years sum, just use modulo (in Calc: `MOD()`):

``````=MOD(MONTHS(01-Jan-60,NOW,1), 12)
``````

will return the remaining 4 months after dividing the total sum of months by 12.

Of course, you can replace the dates that are included in the formulas above by cell references. `=YEARS(A1,A2,1)` assumes that cells A1 and A2 contain dates.

-