Jump to content
Server Maintenance This Week. ×

Age as of a future date


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

Recommended Posts

I"m having a tough time determining client's ages. I've pasted what I'm using below... I tried a few different things... however depending if I'm looking before Dec 31st in the year previous to the future date (ie Dec 30/2006) - the date as of July 1st/2007 isn't right. However, I think after January 1st it's ok... Can someone please offer some help?

CALCULATION 1(Age):B

2007-

Year (dob) -

If ( Date(Month (dob) ; Day (dob) ; "2007") > Date (7;1;2007);1;0)

+

If ( Month ( dob )=1; .05;

If ( Month ( dob )=2; .04;

If ( Month ( dob )=3; .03;

If ( Month ( dob )=4; .02;

If ( Month ( dob )=5; .01;

If ( Month ( dob )=6; 0;

If ( Month ( dob )=7; .11;

If ( Month ( dob )=8; ".10";

If ( Month ( dob )=9; .09;

If ( Month ( dob )=10; .08;

If ( Month ( dob )=11; .07;

If ( Month ( dob )=12; .06;0))))))))))))

CALCULATION 2(AGESEASON):

2007-

Year (dob) -

If ( Date(Month (dob) ; Day (dob) ; "2007") > Date (7;1;2007);1;0)

+

If ( Month ( dob )=1; .05;

If ( Month ( dob )=2; .04;

If ( Month ( dob )=3; .03;

If ( Month ( dob )=4; .02;

If ( Month ( dob )=5; .01;

If ( Month ( dob )=6; 0;

If ( Month ( dob )=7; .11;

If ( Month ( dob )=8; ".10";

If ( Month ( dob )=9; .09;

If ( Month ( dob )=10; .08;

If ( Month ( dob )=11; .07;

If ( Month ( dob )=12; .06;0))))))))))))

CALCULATION 3 (STAFF)

Year (Get(CurrentDate))-

Year (Date of Birth)-

If(Date(Month(Date of Birth);Day(Date of Birth);Year(Get(CurrentDate)))

+

If ( Month ( Date of Birth )=1; .05;

If ( Month ( Date of Birth)=2; .04;

If ( Month ( Date of Birth)=3; .03;

If ( Month ( Date of Birth)=4; .02;

If ( Month ( Date of Birth)=5; .01;

If ( Month ( Date of Birth)=6; 0;

If ( Month ( Date of Birth)=7; .11;

If ( Month ( Date of Birth)=8; .1;

If ( Month ( Date of Birth)=9; .09;

If ( Month ( Date of Birth)=10; .08;

If ( Month ( Date of Birth)=11; .07;

If ( Month ( Date of Birth)=12; .06;0))))))))))))

Link to comment
Share on other sites

Try any of the first three of these custom functions. I've been using number 6 with no problems.

http://www.briandunning.com/filemaker-custom-functions/results.php?keyword=age

HTH

Phil

Link to comment
Share on other sites

"meaning 10 years, 2 months. "

To answer that, we need to know what a month means to you. And if the person is also 29 days, do you want to consider it one month, ie, round up? There is also the question of leap year here. Months are man-made descriptors which don't follow true date logic. So we need to pin down your needs. :wink2:

Link to comment
Share on other sites

What's important to us is always knowing how old the person will be as of July 1st 2007 (if that is the season we're working on - we're a summer camp business, so we start working on Summer 07 in the middle of summer 06). But what we need to know is as of July 1st, 2007 how old someone is. So, for someone who was born in June 2000 - any day in the month - they should be 7years 1 month. For someone born in July 2000, 7 years, 0 months. May 2000, 6 years, 11 months. Does that make sense?

Link to comment
Share on other sites

Ray's calc rounds up by the year, ie, even if they 3 years 8 months, it says they are 4 years - which was the request in that post. And it doesn't address months at all (again because it wasn't requested).

I suggest you use a global date field (gDate) to hold the summer camp date. Why? If it is May, 2006 and you want to view children eligible for camp THIS summer then you can plug in 7/1/2006 and see children who will be within the age-range this summer. Conversely, you can then plug in NEXT year's camp date of 7/1/2007 and also see next year's eligible children. By not depending upon the current date (or hard-coding within the calc), you will be free to extend out your projections and will never have to modify it again. Also, as sure as the sun rises, they will (some day) change the month start. If you use a global, you will never hit limits.

You had asked for a result of 11.04 (11 years and 4 months). If you make this calculation a NUMBER result then you can easily sort it as well:

Let ( [

year = Year ( gDate ) - Year ( DOB ) ;

mo = 12 * year + ( 12 - Month ( DOB ) + 1 ) - ( 12 - Month ( gDate ) ) - 1 ;

y = Div ( mo ; 12 ) ;

m = Mod ( mo ; 12 )

] ;

y & "." & Right ( "00" & m ; 2 )

)

UPDATE: I keep tweaking it ... let me know if it needs tweaked further to fit your needs.

LaRetta

Edited by Guest
Tweaked calc again
Link to comment
Share on other sites

The reply they made, sounded like a youth little league DOB cut off. The month in the request really isn't needed, only that the birthdate, cutoff date, and the age group. I used this to place the children in the right age group per the rule of the sports.

There is more than one file posted to the link, I pointed at Ray's, but the one I posted might actually fit the bill better.

Lee

Edited by Guest
clean up
Link to comment
Share on other sites

I'd go with:

Let (

elapsedMonths = 12 * ( Year ( gDate ) - Year ( DOB ) ) + Month ( gDate ) - Month ( DOB )

;

Div ( elapsedMonths ; 12 ) + Mod ( elapsedMonths ; 12 ) / 100

)

The result is a number, and if required can be formatted to display 2 decimal places.

Link to comment
Share on other sites

  • Newbies

Can someone help me..........

I have NO CLUE how to use Filemaker. I'm just learning. I can see it's not very easy....

Anyway, I have a DOB field and an AGE field. I'm trying to put in a formula that give me their age of say December 31, 2007 or some other future date.

Can someone walk me through the process of the formula and where to put it?

I've tried to copy some of these formulas to see if they work and I'm getting error messages. Since I don't understand how to use formulas, I'm not sure how to fix the error.

I should say I have this formula in there now:

Year(Status(CurrentDate)) - Year(D.O.B.) -

If(Status(CurrentDate) < Date(Month(D.O.B.), Day(D.O.B.), Year(Status(CurrentDate))), 1, 0)

HOWEVER, it says "CurrentDate" and I need a future date.

Please help.

Thanks!

Edited by Guest
Link to comment
Share on other sites

This topic is 6343 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.