4 Replies Latest reply on Jul 2, 2015 3:31 PM by DeanSuhr

    Calculating Age

    ahhsome2001

      Title

      Calculating Age

      Post

      I am not an expert at Filemaker but I've been able to stumble my way through most of what I need, however, I have a problem with my age calculation.  I have it calculating correctly and when I put in a date of birth the age field tells me their age, however it does not update.  For example, if someone has a birthday of 3/26/2000, today it would still show them as 8 years old, until I go in and re-enter the date of birth, then it changes.  But I can't get it to change daily by itself. Any ideas?

        • 1. Re: Calculating Age
          comment_1
             Make sure the calculation is unstored.
          • 2. Re: Calculating Age
            ahhsome2001
              

            Thank you! I'll try that.

            • 3. Re: Calculating Age
              synergy46

              I use this as a custom function.  It only takes 2 fields: dob and dod.  (date of birth and date of death).  If dod and dob both have dates the it calculates the difference between them.  If the dob has a date and dod is empty, then it calculates the difference between dob and currentdate.  Otherwise it makes the function field "". 

              Case(dob and dod; Year(dod) - Year(dob) -1; dob and IsEmpty(dod); Year(Get(CurrentDate))-Year(dob)-1; "")

              • 4. Re: Calculating Age
                DeanSuhr

                I know I am responding to a very old post, but the function Ron posted is too simplistic and I do not want others to be frustrated.  His function does not account for whether the person's birthday has already occurred this year or whether the dod was before or after their birthday.  I use the following function to report how many years old a person was (no rounding) if alive or at time of death.  

                And be sure to make sure you have checked "Do not store results, recalculate as needed" under Storage Options.

                If( Date_Birthday = "" ; "";

                If(DayOfYear (Date_Birthday)=0;"";


                If(DayOfYear(Date_Deceased)>0;
                        Case (DayOfYear (Date_Deceased)  ≥  DayOfYear (Date_Birthday);
                        Year(Date_Deceased)-Year(Date_Birthday);
                        Year(Date_Deceased)-Year(Date_Birthday)-1);

                Case (DayOfYear (Date_Birthday) > DayOfYear (Get(CurrentDate));
                Year(Get(CurrentDate))-Year(Date_Birthday)-1;
                Year(Get(CurrentDate))-Year(Date_Birthday)))
                ))