Wayne1158 Posted September 29, 2006 Posted September 29, 2006 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.
Genx Posted September 29, 2006 Posted September 29, 2006 You could always just use: Floor((Get(CurrentDate) - BirthDate) / 365.25) as a rough approximation.
Lee Smith Posted September 29, 2006 Posted September 29, 2006 (edited) 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, 2006 by Guest
John Mark Osborne Posted September 29, 2006 Posted September 29, 2006 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).
Wayne1158 Posted September 30, 2006 Author Posted September 30, 2006 thanks every one for the help, much appreciated.
dadudette Posted October 8, 2006 Posted October 8, 2006 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"
Raybaudi Posted October 8, 2006 Posted October 8, 2006 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
Lee Smith Posted October 8, 2006 Posted October 8, 2006 (edited) Please review the article "[color:blue]Posting Guidelines" . Lee [color:red]p.s. Link is broken Edited February 10, 2008 by Guest p.s.
Newbies Lefty Posted October 12, 2006 Newbies Posted October 12, 2006 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.
comment Posted October 12, 2006 Posted October 12, 2006 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.
Newbies Lefty Posted October 12, 2006 Newbies Posted October 12, 2006 Dang! You're dead on. I should play test these things a touch more before I go spouting off. Thanks.
Recommended Posts
This topic is 6678 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 accountSign in
Already have an account? Sign in here.
Sign In Now