cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

How to calculate the age/time when I have 2 dates

WalterSchrabmai
7-Bedrock

How to calculate the age/time when I have 2 dates

Dear friends,

IN a lot of Excelsheets I have 2 dates and I want to calculate the time (age) between these dates.

How can this done in Mathcad 15?

The dates are all in the same corresponding cell.

I want the age as a decimal number, which can be used in an formular.

thanks for your help

walter

25 REPLIES 25

It would be easier to solve your problem if you provide a worksheet with the Excel components included.

The attached might be of some help though.

Mike

MikeArmstrong
5-Regular Member
(To:RichardJ)

Talk about throwing an example at him

Mike

THANKS A LOT, experts. My info demand is satisfied completely.

Walter

I would like to see the method you adapted if you don't mind posting an example. It will also help other members when looking at this thread.

Mike

I have copied the whole date/time functions into my sheet as collapsed area and used it to calculate the age, where the 2 Dates are in a Excel sheet.

As the whole MC sheet is for a paper and so it is still confidantal, I have captured the part where I used the date function as gif file.

THanks a lot. It works fine.

Walter

I have copied the whole date/time functions into my sheet as collapsed area and used it to calculate the age, where the 2 Dates are in a Excel sheet.

As the whole MC sheet is for a paper and so it is still confidantal, I have captured the part where I used the date function as gif file.

THanks a lot. It works fine.

Ok, no worries. Cheers for providing the screenshot.

Mike

One comment. An average year is not 365 days long, so your age is not accurate. In fact, I would argue that you can't express someone's age accurately in years, because the average length of a year during someones lifetime is different for diffferent people, depending on how many leap years ocurred.

Thanks Richard for your comment. But how should I calculate the age in years for a GFR Formular, where the age must be entered in years (with comma)?

Have you an idea how I can get the age in years when I have the age in days like in my sheet?

Thanks for your help

Walter

How about the attached?

Mike

Mike, thanks but how can I calculate the year in float if I have the timespan in days?

I am not enlighted completely with your MCD Sheet.

THanks for help

Walter

how can I calculate the year in float if I have the timespan in days?

Can you elaborate?

I take it you have the person D.O.B and that's how you've got the age in days.

Mike

Dear M ike,

yes I also could calculate the DAYS between two dates.

But moreover I would need the age in years (als floating real value). And the nuber of days / 365 could be not correct.

Could you understand what I mean?

Thanks for your idea.

Walter

Have a look at the attached. It calculates the years between two dates.

Mike

Updated function that will now accept a Matrix of dates and return the years between them.

Mike

Dear Mike,

in your sheet there is:

y <- Y - [M<=2]

what does that mean?

Do I substract M from Y when M <= 2 ?

I have never seen such a MC statement.

Thanks for answering.

Walter

Have a look below.

Clipboard01.jpg

It is a boolean operator and produces a either a 1 or 0 depending if the condition is met.

Mike

Thanks a lot Mike, all clear now.

Walter

An age in years seems somewhat subjective to me. If someone lived through the whole year it's easy. That's one year, and it doesn't matter if the year was 365 days long or 366 days long. But the year of birth and year of death are more of a problem. Suppose one of those is a leap year, and the person's life included Feb 29. Then it would seem reasonable to divide the number of days by 366 to get the fraction of the year. But what if the person's life did not include Feb 29? Do you divide by 365 or 366?

RichardJ
19-Tanzanite
(To:RichardJ)

Some more thoughts on this. What I just calculated was the age in calendar years. Perhaps this is not what you want though. Perhaps you want the age in "average years". An age in days is accurate to +/-24 hrs (+/-12 at each end). For a life span of 70 years that means the age is good to about the 5th digit, and two ages could be compared to that accuracy. But it is not so easy to compare ages given in calendar years. They cannot be converted to an accurate age in days without knowing the date of birth (or death). So I guess it depends on what you want. If you want the age in "average years", just use Mathcad's day and year units to convert. And then specify in the paper exactly what "age in years" actually means!

Richard, I need the age in years for calculating the GFR accoring the formular below.

Hope now it is clear

Walter

Walter, do you have your issued resolved now?

Mike

Thanks Mike, yes thanks a lot!

Walter

For an empirical equation like that it would have to be "average years". I would be interested in knowing if they actually used average years when deriving it though. If you are given an age in, for example, years, months, and days, you have to be very careful converting that to an age in average years (and in fact you can't if you don't know the date of birth or death). On the other hand, there was probably enough scatter in the data that it doesn't really matter what they used, and doesn't matter that much what you use either

Richard, I agree to you totally. Thanks for your comment.

Walter

Top Tags