September 29, 200619 yr can some body give me a formula for calculating the age of a person. Will be entering their birth date in a field and then in a seperate feild want their age to appear, thanks.
September 29, 200619 yr You could always just use: Floor((Get(CurrentDate) - BirthDate) / 365.25) as a rough approximation.
September 29, 200619 yr This question has been asked many times in the past. Do a search for [color:blue]+Birthday +Calculation (use the pluses with the words as shown), and you should get many hits, including a few Custom Functions if you had access to Developer / Advance. Genx has suggested a calculation that will give you the age as in years (i.e. 30), but there are calculations that will give you 30 years, 5 months, 22 days, or Birthdays coming, or Birthdays this week, etc.,. Once you know what you want to show, then you can pick the one you want to adapt to your situation. HTH Lee Edited September 29, 200619 yr by Guest
September 29, 200619 yr It's so easy to repost the formula. Here it is: GetAsNumber(Year(Get(CurrentDate)) - Year(DOB) - Case(Get(CurrentDate) < Date(Month(DOB); Day(DOB); Year(Get(CurrentDate))); 1; 0)) & " Years, " & GetAsNumber(Mod(Month(Get(CurrentDate)) - Month(DOB) + 12 - Case(Day(Get(CurrentDate)) < Day(DOB); 1; 0); 12)) & " Months, " & GetAsNumber(Day(Get(CurrentDate)) - Day(DOB) + Case(Day(Get(CurrentDate)) >= Day(DOB); 0; Day(Get(CurrentDate) - Day(Get(CurrentDate))) < Day(DOB); Day(DOB); Day(Get(CurrentDate) - Day(Get(CurrentDate))))) & " Days" If you don't want years, months and days, you can easily remove the portion you don't want as they are separated by concatenation sumbols (ampersand).
October 8, 200619 yr Thank you for not making us search to find this. You're amazingly helpful. I have a question regarding the formula to show age in years, months, and days, which is exactly what I'm trying to get. When I pop the calculation into my calculation window, what parts of the formula are actually supposed to refer to my field names, and do I need separate fields for day, month and year? And what about CurrentDate - is that just something Filemaker knows what to do with? This is your formula which I'm referring to: GetAsNumber(Day(Get(Curre ntDate)) - Day(DOB) + Case(Day(Get(CurrentDate) ) >= Day(DOB); 0; Day(Get(CurrentDate) - Day(Get(CurrentDate))) < Day(DOB); Day(DOB); Day(Get(CurrentDate) - Day(Get(CurrentDate))))) & " Days"
October 8, 200619 yr DOB is the Date Of Birth field Get(CurrentDate) is a FileMaker function that returns the ToDay date; here is important to say that that calculation must be UNSTORED
October 8, 200619 yr Please review the article "[color:blue]Posting Guidelines" . Lee [color:red]p.s. Link is broken Edited February 10, 200817 yr by Guest p.s.
October 12, 200619 yr Newbies If(Month(Date 2) ≥ Month(DOB) and Day(Date 2) ≥ Day(DOB), Year(Date 2 - Year(DOB), Year(Date 2) - Year(DOB)-1) This one works if you just want the person's age at a particular time.
October 12, 200619 yr I am afraid this one doesn't work at all: to begin with, you have missed a parenthesis after Date 2 in the second line. More seriously, take a person born on Jan 15, 2000. According to your calculation, he turns 6 on Jan 15, 2006. Then he keeps that age for the rest of January 2006 - but come February 1, 2006 and suddenly he's back to being 5 years old.
October 12, 200619 yr Newbies Dang! You're dead on. I should play test these things a touch more before I go spouting off. Thanks.
Create an account or sign in to comment