Jump to content

Calculation for a person's age !


This topic is 5422 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Can anyone provide an age calculation code for an FMP novice??? The way my mind works, I would use four(4)number fields: BirthYear, CurrentYear, BirthMonth and CurrentMonth. Find the DIFFERENCE between the related fields and voila... # of years & # months !!! Just as people say, "I'm 29 years and 6 months." Well, I've tried all the permutations using my 4 fields but...

Question 1: Is there a possible calculation code that would follow my mind's reasoning path : (Using the 4 fields)

Question 2. How would FMP do this calculation :

Specifically.. what fields do I need to create, what operators, and how do I write the formula for FMP's calculation editor ;)

I love FMP but I'm obviously in the twilight zone when it comes to calculations (although I've proudly done several S I M P L E ones!)

This is important to me and your help would be a godsend.

Link to comment
Share on other sites

  • 1 month later...

Try this

" Year " & (Year(Status(CurrentDate)) - Year(DOB) - If(Status(CurrentDate) < Date(Month(DOB); Day(DOB); Year(Status(CurrentDate))); 1; 0)) &"," &

" Month " & (Mod(Month(Status(CurrentDate)) - Month(DOB) + 12 - If(Day(Status(CurrentDate)) < Day(DOJ); 1; 0); 12)) &"," &

" Day " &

(Today- Date(Month(Status(CurrentDate)) - (Day(DOB) > Day(Status(CurrentDate))); Day(DOB); Year(Today)))

Link to comment
Share on other sites

The Status ( ) functions aren't more alive.

They were substituted by the Get ( ) functions.

ALSO

the Today function was substituted by the Get ( CurrentDate ) function.

Note that there is even a typing error ( DOJ instead of DOB ) and that the "If" can be substituded by boolean evaluations.

So, for years and months, you can try this UNSTORED calculation:

Let([

today = Get ( CurrentDate ) ;

Y = Year ( today ) ;

M = Month ( today ) ;

D = Day ( today ) ;

yDOB = Year ( DOB ) ;

mDOB = Month ( DOB ) ;

dDOB = Day ( DOB )

];

Y - yDOB - ( today < Date ( mDOB ; dDOB ; Y ) ) & " years and " & Mod ( M - mDOB + 12 - ( D < dDOB ) ; 12 ) & " months"

)

Link to comment
Share on other sites

This topic is 5422 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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