Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Age calculation

Featured Replies

I have the "date_of_birth" field and the "date_of_death" field

 

I would like to calculate the current age, which is easy if the person is alive by using the Get CurrentDate function; however, if the person is dead, how should the value "date_of_death" field be used in the calculation to replace the CurrentDate value

 

Thanks.

Solved by comment

Go to solution

Try =

Let (
date_of_calc = Case ( date_of_death ; date_of_death ; Get ( CurrentDate ) )
;
Year ( date_of_calc ) - Year ( date_of_birth ) - ( date_of_calc < Date ( Month ( date_of_birth ) ; Day ( date_of_birth ) ; Year ( date_of_calc ) ) )
)

Calculation must be unstored for the benefit of people still alive.

  • Author

Thanks again Mr. Comment;

 

The calculation works great.

 

Just need an additional feature which is to calculate the age in months and days if age is <1 year, years and months if age <6 years.

Ahmm... is this for medical purposes? If yes, I'd suggest calculating the month as equal to approximately 30 days and the year as equal to 365 days or so - rather than taking into account when exactly does the birthday fall in the current year/month. It makes the calculation simpler and more logical - otherwise you may find two people with exactly the same age in days having different ages when expressed in months and days.

  • Author
Yes indeed, it is for medical purposes and I appreciate your suggestion.
 
What if I have the same output format for all ages as follows : ##Y ##M ##D
 
Is it logical ?
 
If you agree, how can I do that?
 
THANKS
  • Solution
What if I have the same output format for all ages as follows : ##Y ##M ##D

 

It makes very little difference: you can have one format for all =

Let ( [
date_of_calc = Case ( date_of_death ; date_of_death ; Get ( CurrentDate ) ) ;
n = date_of_calc- date_of_birth + 1;
y = Div ( n ; 365.2425 ) ;
r = Mod ( n ; 365.2425 ) ;
m = Div ( r ; 30.436875 ) ;
d = Round ( Mod ( r ; 30.436875 ) ; 0 )
] ;
y & "Y " & m & "M " & d & "D"
)

or different formats for each group, as you asked before =

Let ( [
date_of_calc = Case ( date_of_death ; date_of_death ; Get ( CurrentDate ) ) ;
n = date_of_calc- date_of_birth + 1;
y = Div ( n ; 365.2425 ) ;
r = Mod ( n ; 365.2425 ) ;
m = Div ( r ; 30.436875 ) ;
d = Round ( Mod ( r ; 30.436875 ) ; 0 )
] ;
Case (
y < 1 ; m & "M " & d & "D" ;
y < 6 ; y & "Y " & m & "M" ;
y & "Y" )
)

The important part to remember is that that these are average months and years; so a patient may disagree with you when you state their age as 30, when their 30th birthday is still a few days away...

  • Author

In fact, we encounter this age problem with patients every now and then; however, I can not be thankful enough for your great help..

 

These two formulas are great...

 

 

THANXXXXXXXX

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.