Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- How to calculate the age/time when I have 2 dates

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
07:52 AM

05-04-2011
07:52 AM

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

Labels:

25 REPLIES 25

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
07:57 AM

05-04-2011
07:57 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
08:58 AM

05-04-2011
08:58 AM

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

See here:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
09:01 AM

05-04-2011
09:01 AM

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

Talk about throwing an example at him

Mike

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
10:41 AM

05-04-2011
10:41 AM

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

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

Walter

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
02:01 PM

05-04-2011
02:01 PM

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
02:15 PM

05-04-2011
02:15 PM

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
03:20 PM

05-04-2011
03:20 PM

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
04:23 PM

05-04-2011
04:23 PM

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

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-05-2011
02:02 AM

05-05-2011
02:02 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-05-2011
02:28 AM

05-05-2011
02:28 AM

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

How about the attached?

Mike

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-05-2011
02:41 AM

05-05-2011
02:41 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-05-2011
02:52 AM

05-05-2011
02:52 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-05-2011
05:03 AM

05-05-2011
05:03 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-05-2011
05:12 AM

05-05-2011
05:12 AM

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

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

Mike

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-05-2011
05:35 AM

05-05-2011
05:35 AM

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

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

Mike

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-05-2011
05:15 AM

05-05-2011
05:15 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-05-2011
05:21 AM

05-05-2011
05:21 AM

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

Have a look below.

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

Mike

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-05-2011
06:43 AM

05-05-2011
06:43 AM

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

Thanks a lot Mike, all clear now.

Walter

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-05-2011
09:15 AM

05-05-2011
09:15 AM

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

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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-05-2011
11:21 AM

05-05-2011
11:21 AM

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

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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-06-2011
02:20 AM

05-06-2011
02:20 AM

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

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

Hope now it is clear

Walter

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-06-2011
03:55 AM

05-06-2011
03:55 AM

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

Walter, do you have your issued resolved now?

Mike

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-06-2011
04:05 AM

05-06-2011
04:05 AM

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

Thanks Mike, yes thanks a lot!

Walter

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-06-2011
08:48 AM

05-06-2011
08:48 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-06-2011
10:44 AM

05-06-2011
10:44 AM

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

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

Walter