### Calculate a person's age to the report

HI I have a field that contains the Patient's birthday. The report is looking for the Patients age.

I was looking for a formula that would give the years between 2 dates, with the to date being of course today's date. I guess that we don't want to round up, that is, someone is not the next year until the actual date match.

There is a command in other script languages called Subdur (subtract duration) that would give the time between two dates. I was wondering if something like this can be had in Crystal as well.

10|10000 characters needed characters exceeded

Former Member
Mar 23, 2009 at 11:28 PM

Hi Philky:

Try this formula:

If totext(CurrentDate,"MM/dd")>=totext({Birth Date},"MM/dd")

then Year(CurrentDate)-Year({Birth Date})

else Year(CurrentDate)-Year({Birth Date})-1

There are other formulas out there that will have you subtract the years and divide by 360 (or some other #) but if accuracy is important, this is the only way to do it as the other methods are not 100% accurate. It looks to see if the the birth month and day has passed, if it has, it subtracts the years, if it hasn't it subtracts the years and minuses 1.

Deb

10|10000 characters needed characters exceeded
• Phil Kestenbaum Brian Dong

HI I was entering the formula in the wrong place. I was entering on the field itself within the Common part of the format field, whereas when I enter it as a 'pure' formula via the Formula expert it compiles cleanly.

This formula Deborah has posted worked very well

Thank you,

Philky

• Mar 24, 2009 at 05:05 PM

Hi Philky,

Try this formula.

Int ((Today - {TABLE.Birthdate} / 365.25));

This will subtract the dates and calculate the years by dividing 365.25.

The Int function will prevent the age from rounding up.

Good luck,

Brian