DATETIME_DIFF() - Mixing up the age of living and dead “people”? [SOLVED]


Hi there ! :grinning:

I’m very very new here, on Airtable, so to begin gently, I’ve come up with the idea to build a DB regrouping all the info I have on the pets I lived with (dead and alive).

But I’ve got a DATETIME_DIFF() formula difficulty.

On my base, I’ve created kind of a summary table with all the general info concerning the pets (Species, race, gender, etc…)

On this table, I’ve got a field Date of Birth (DoB) and a field Date of Death (DoD).

What I would like to do is to create a field that would give me the actual age of the pet (if still alive) or the age of the pet when it died, on same table, if possible :wink: .

Reading the help documentation and many topics here concerning the DATETIME_DIFF() formula I found this :

Which works perfectly for the actual age of the living pet.


Which works perfectly for the age of the pet when it died.

If I get it right, I would need to create a IF() nested formula mixing both of these ones above, but after many tries I can’t find my way around this…

Could someone help me ? :grin:

Thanks a lot, in advance :grin:

(PS: Sorry for my English :blush:… It’s not my mother language :wink: )


Hi @Ptt_Pch,

I think you’re aiming at this:

  • When the pet is alive you need: Today - DoB
  • When the pet died you need: DoD - DoB

That makes it easy:



I just tried and that works perfectly ! :grin:
(Yes, I was exactly aiming at this :wink: )

I think I may have forget one or 2 comma during my tries.

Anyway, thank you very very much for your help ! :grin: :+1:

I’ll play around with this one in my other bases :grin:
(That’s the best way to learn :wink: )


I’m glad it worked out fine for you! :smile:


Hhhmmm :thinking:

I’ve got another question though :yum:

Is there a way to complete or adapt this formula…


… to get the results in “number of years / number of months” instead of only “number of years” ? :thinking:

I’m pretty sure I’m missing something simple here :blush: but I can’t find what …

I must admit, I’m not very skilled yet to translate my thoughts into logical arguments, but it will come :grin:, I just need the right trigger :grin: :wink: .

Thanks a lot in advance again :grin: !


Add-on :

I tried to modify the ’years’ expression in the formula to get the results in “numbers of years / numbers of months” but I well, it simply didn’t work :roll_eyes: .

I thought about adding :

IF(DATETIME_DIFF(TODAY(),{DoB},’years’)<1,[something to get the age in months]

but I don’t know how to write the end of this and how to implement it :roll_eyes:

If someone has an answer/idea, I’m all “eyes” :blush:

Many thanks in advance :grin:


Hi @Ptt_Pch

This formula should do it (replace Today() with relevant date field):

INT(DATETIME_DIFF(TODAY(),{From Date}, ‘months’)/12) & “:” & (DATETIME_DIFF(TODAY(),{From Date}, ‘months’) - INT(DATETIME_DIFF(TODAY(),{From Date}, ‘months’)/12) *12)

Hope this helps!


It helped :wink: ! Thanks :wink:
At least, it helped me to think outside of the box :grin: , which helped me with a formula in another base I’ve created :grin: .

Concerning this particular formula, I’ve found the answer in another post :wink:

I don’t know if someone else would be interested in the formula I used, but just in case, I’ll leave it here :grinning: :wink: (we never know :wink: )

DATETIME_DIFF(TODAY(), {DoB}, 'years') & ' years ' & MOD(DATETIME_DIFF(TODAY(), {DoB}, 'months'), 12) & ' months',
DATETIME_DIFF( {DoD}, {DoB}, 'years') & ' years ' & MOD(DATETIME_DIFF({DoD}, {DoB}, 'months'), 12) & ' months'

Many thanks for the help :grin::+1:


I wasn’t sure if I needed to create a new topic as it concerns kind of a different problem I’m encountering.
But, it is linked to same DATETIME_DIFF formula, so I thought it was better to post here :wink: .

So, to summarize :

Few days ago, I was searching a DATETIME_DIFF formula that would get me the age of my actual living pets and the age of the ones who died.

I created 2 date fields in my pets table to that purpose :

  • Date of Birth > {DoB}
  • Date of Death > {DoD}

I asked for help and thanks to the Airtable Community my problem was solved :grin: !

BUT, I now got another problem in another DB with that exact same DATETIME_DIFF formula and I truly don’t understand why :sweat: ,

So, the DB is meant to regroup all the quotes I like (coming from movies, TV Shows, books, songs, etc… ).
Because each quote (often) has an author, I created a table “Authors” where I can put all the informations I want concerning the authors (logical :yum: ) .

In that table I created, 2 date fields, identical to the ones in my pets table :

  • Date of Birth > {DoB}
  • Date of Death > {DoD}

The purpose is, again, to calculate the age of the author when he/she died or the actual age of the author if he/she is still alive.

I thought that was a no brainer and copied/pasted (I tried to write it in the “formula box” too instead of copying/pasting it) the first formula that worked for my pets (before using the MOD() formula (see above :wink: )) :roll_eyes: :


But, it didn’t work this time :face_with_raised_eyebrow: (this is a screenshot of a “test Author table”)

Did I do something wrong ? :face_with_raised_eyebrow:
If yes, can someone explain me what ? :thinking:
Because, as far as I understand the formula, the logic behind it, to me, seems to be the same … :face_with_raised_eyebrow:

Many thanks in advance :grinning:


As far as I can tell there is a comma missing in the second line:
It now reads:

but it should be:
DATETIME_DIFF(TODAY(),{DoB}, ‘years’),

That should solve it.


Ouch :sweat_smile: ! My bad :sweat_smile: !
I don’t know exactly how it happened :sweat_smile: … But it happened :sweat_smile:

Correcting that missing comma mistake, I also found an “empty space” mistake (between 2 commas) re-writing that formula :sweat_smile:

Thank you very much Sir ! :grin: :+1:
Everything works again :grin:


I’m sorry to ask again :blush: … But I’ve got a tiny question in addition :blush:

Still concerning my “Authors” table…

After correcting my mistakes, I modified a little bit my formula so when an author of a quote doesn’t have a date of birth, the result is “N/A”.


The formula works :grin: !

I just wanted to add “years” somewhere so when there is an age to calculate, I get something like “63 years”.

I’ve tried this :

DATETIME_DIFF(TODAY(),{DoB},'years') & ' years ' &,
DATETIME_DIFF({DoD},{DoB},'years') & ' years ' &

And other placements of the “years” but I’m not able to find the right place in the formula, so it doesn’t work :neutral_face:
Maybe I’m just not writing the “years” right :sweat: .
I have had several problems the past few days to add plain text in my formulas :sweat: .

Thanks for the help in advance again :grin: :blush:



        )&' years'


Perfect ! :grin: :+1:
It works ! :grin:

Thank you very very much !!! :grin: