3 Replies Latest reply: May 15, 2014 10:07 AM by Grant Perkins RSS

    Calculate Age

    rlandeo _

      Hi,

       

      I have a field containing date of birth in short date format.  How can I calculate the person's age with that data?  I would be looking to round up the ages.  I am looking to export this into Access, so worst case I can run a DATEDIFF, but I wanted to see if I could do it in Monarch.  Thanks.

       

      Raul

        • Calculate Age
          Grant Perkins

          Hi,

           

          I have a field containing date of birth in short date format. How can I calculate the person's age with that data? I would be looking to round up the ages. I am looking to export this into Access, so worst case I can run a DATEDIFF, but I wanted to see if I could do it in Monarch. Thanks.

           

          Raul[/quote]

           

          Hi Raul and welcome to the forum.

           

          Monarch offers the Age() function for this task.

           

          It has a few parameters as you would expect. If you have a look at the Functions Reference in the Help file you will find a link to the description of what it offers. Or just add the AGE() function to a formula and it will show you the options in an abbreviated form.

           

           

          HTH.

           

           

          Grant

            • Calculate Age
              rlandeo _

              Grant, I love you!

               

              I didn't see the Age() function in the listing, so I had to write it in, but it worked perfectly.  I wrote it out like this:

               

              Age(DOB_Field,Today(),1)

               

              where 1 is for years.

                • Calculate Age
                  Grant Perkins

                  Hi Raul,

                   

                  It's a little word and easy to miss!

                   

                  As I recall AGE() defaults to TODAY() as the 'compare parameter' so you don't really need to include Today(). However including it does make what the formula is doing clearer when reading it later or if someone else looks at it.

                   

                  That said in many cases it can be more appropriate to compare to a different date - say the date of the report run or a selection date given for the report or, of course, some future date for planning purposes.

                   

                  In your case it sounds like you are doing a 'current date' database update so Today() is likely the best option just as you have chosen.

                   

                  I'm glad it gave you what you wanted.

                   

                  Grant