Age Calculation

Hello:

Can someone explain to me how I might calculate a persons age, given their birthdate and the current date. Any help would be appreciated.

To calculate the precise date difference you should use the dateDiff() function, which will return the exact number of days.

Regarding the “age” value as such it’ll depend on how you would like to calculate full years. Assuming that your “age” changes just after the birth anniversary, you can use something like that (one line):

=year(today()) - year(date) - if(month(date) < month(today()), 0, if(month(date) > month(today()), 1, day(date) >= day(today())))

Use this formula for the “age” field, choosing the “Calculation formula” option in the “Special” section of the “Field Setup” dialog box. Once you enter the formula in that section, use the “Tools > Update All… (F9)” command to calculate this field for all already entered records.

If the “date” field is not a valid GS-Base date field (that is, a text field containing optionally formatted generic date/time YYYY-MM-DD strings), the above “date” argument should be replaced by dateValue(date).

If the date strings include the time (hour/minute) value, another nested if() should be added.

Many thanks