Age Calc Help please

Age Calc Help please

am 04.12.2007 20:57:29 von J T

I have a formula that was given to me a few years ago.It has worked
well until I updated to FMP 9 and now it is not returning the correct
results:

Case (

GetAsNumber ( DOB ) > GetAsNumber ( Date ); "Unborn";
GetAsNumber ( DOB ) = "" or GetAsNumber ( Date ) = "";"";
Date - DOB <= 30 ; Date - DOB & Case( Date - DOB = 1 ; "day" ; "
days" ) ;
( Year( Date - DOB ) - 1 ) * 12 + ( Month( Get ( CurrentDate ) - DOB )
- 1 ) < 13 ;
( Year( Date - DOB ) - 1 ) * 12 + ( Month( Get ( CurrentDate ) - DOB )
-1 ) & " mo" ;

Year( Date - DOB ) - 1 & " yr" )


Recently I updated to FMP 9 and it is now returning wrong values for
months - i.e. between 10 and 12 months it will say 1 or 2 when really
it should be 11 or 12.

Can you think what might be the problem?

Also is there any way that it could give me the age in Months and
years right up to 24 months i.e for anything up to that 16 ... 23
months and after that back to 2, 3 , 4... years

Thanks in advance if you can help

Regards

John

Re: Age Calc Help please

am 05.12.2007 00:59:17 von bill

In article
<0e464a95-bf57-40fa-8e11-53a7a86bb293@l1g2000hsa.googlegroups.com>,
J T wrote:

> I have a formula that was given to me a few years ago.It has worked
> well until I updated to FMP 9 and now it is not returning the correct
> results:
>
> Case (
>
> GetAsNumber ( DOB ) > GetAsNumber ( Date ); "Unborn";
> GetAsNumber ( DOB ) = "" or GetAsNumber ( Date ) = "";"";
> Date - DOB <= 30 ; Date - DOB & Case( Date - DOB = 1 ; "day" ; "
> days" ) ;
> ( Year( Date - DOB ) - 1 ) * 12 + ( Month( Get ( CurrentDate ) - DOB )
> - 1 ) < 13 ;
> ( Year( Date - DOB ) - 1 ) * 12 + ( Month( Get ( CurrentDate ) - DOB )
> -1 ) & " mo" ;
>
> Year( Date - DOB ) - 1 & " yr" )
>
>
> Recently I updated to FMP 9 and it is now returning wrong values for
> months - i.e. between 10 and 12 months it will say 1 or 2 when really
> it should be 11 or 12.
>
> Can you think what might be the problem?
>
> Also is there any way that it could give me the age in Months and
> years right up to 24 months i.e for anything up to that 16 ... 23
> months and after that back to 2, 3 , 4... years
>
> Thanks in advance if you can help
>
> Regards
>
> John

I use a very simple-minded formula to calculate age:

int((Date1 - Date2)/365.25)

in which Date1 represents today's date or some other event date, and
Date2 represents the birthdate

--
Bill Collins
For email, change "fake" to "earthlink"

Re: Age Calc Help please

am 05.12.2007 03:58:25 von The other Mike

J T wrote:
> I have a formula that was given to me a few years ago.It has worked
> well until I updated to FMP 9 and now it is not returning the correct
> results:
>
> Case (
>
> GetAsNumber ( DOB ) > GetAsNumber ( Date ); "Unborn";
> GetAsNumber ( DOB ) = "" or GetAsNumber ( Date ) = "";"";
> Date - DOB <= 30 ; Date - DOB & Case( Date - DOB = 1 ; "day" ; "
> days" ) ;
> ( Year( Date - DOB ) - 1 ) * 12 + ( Month( Get ( CurrentDate ) - DOB )
> - 1 ) < 13 ;
> ( Year( Date - DOB ) - 1 ) * 12 + ( Month( Get ( CurrentDate ) - DOB )
> -1 ) & " mo" ;
>
> Year( Date - DOB ) - 1 & " yr" )
>
>
> Recently I updated to FMP 9 and it is now returning wrong values for
> months - i.e. between 10 and 12 months it will say 1 or 2 when really
> it should be 11 or 12.
>
> Can you think what might be the problem?
>
> Also is there any way that it could give me the age in Months and
> years right up to 24 months i.e for anything up to that 16 ... 23
> months and after that back to 2, 3 , 4... years
>
> Thanks in advance if you can help
>
> Regards
>
> John
Give this formula a go.

Year ( Get ( CurrentDate ) ) - Year ( DOB ) - (DayOfYear ( Get (
CurrentDate ) ) < DayOfYear ( DOB )) & " years and " &

Case (

DayOfYear ( Get ( CurrentDate ) ) ≥ DayOfYear ( DOB ); DayOfYear (
Get ( CurrentDate ) ) - DayOfYear ( DOB );

DayOfYear ( Get ( CurrentDate ) ) + (DayOfYear(Date(12;31;Year (
Get ( CurrentDate ) )) - DayOfYear ( DOB )))) & " days"

M Myett