Help

What would be the formula to show the age of a person as of today? I need the result in years

Topic Labels: Formulas
23040 24
cancel
Showing results for 
Search instead for 
Did you mean: 
Sandra_McCann
4 - Data Explorer
4 - Data Explorer

DATETIME_DIFF([date1], [date2], ‘units’)

I saw this formula but how do I modify it to include my fields and a result in years for the units?

24 Replies 24

@Khatia_Odzelashvili, your error is due to the quotation marks in your formula - they are curly quotes rather than straight quotes, because you copy-pasted them from styles text here in the forums.

Try just deleting those quotes and retyping them directly in the formula editor.

In case that isn’t clear:

  • Open up that formula editor you screencaptured
  • Place your cursor after the first single quote around the word ‘years’
  • Backspace to delete it, and then type a new single quote
  • Repeat for the single quote after the word ‘years’
Khatia_Odzelash
4 - Data Explorer
4 - Data Explorer

Jeremy, thank you, it worked! :smiling_face_with_halo: :pray:

Tayo_Amos
4 - Data Explorer
4 - Data Explorer

That formula works for me! But when I put it in there’s a field that says NaN…is there a way for the field to be empty even if the birthdate field isn’t filled in?

Makai_Magat-Dav
4 - Data Explorer
4 - Data Explorer

image

What am I doing wrong - just trying to calculate age from the date of birth

It looks like you’ve combined the two approaches. My original solution using the DATETIME_DIFF() function is fine, but it’s useful to check and see if there’s data in the cell that contains the {Date of Birth} too. The function would look like this:

IF({Date of Birth}, DATETIME_DIFF(TODAY(), {Date of Birth}, 'years'))

As others have said, watch out for curly quotes. Make sure you have the straight tick mark quotes in your formulas.

The other approach using TONOW() works too (and didn’t exist when I did my original post), but it includes the word years in the output which I don’t want. That formula would look like this:

TONOW({Date of Birth}, 'years')

Either approach works.