DATETIME_DIFF() - Mixing up the age of living and dead “people”? [SOLVED]
Hi there !
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 :winking_face: .
Reading the help documentation and many topics here concerning the DATETIME_DIFF() formula I found this :
DATETIME_DIFF(TODAY(),{DoB},’years’)
Which works perfectly for the actual age of the living pet.
And…
DATETIME_DIFF({DoD},{DoB},’years’)
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 ?
Thanks a lot, in advance
(PS: Sorry for my English … It’s not my mother language :winking_face: )
… to get the results in “number of years / number of months” instead of only “number of years” ?
I’m pretty sure I’m missing something simple here 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 , I just need the right trigger :winking_face: .
… to get the results in “number of years / number of months” instead of only “number of years” ?
I’m pretty sure I’m missing something simple here 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 , I just need the right trigger :winking_face: .
Thanks a lot in advance again !
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: …
At least, it helped me to think outside of the box , which helped me with a formula in another base I’ve created .
Concerning this particular formula, I’ve found the answer in another post :winking_face:
I don’t know if someone else would be interested in the formula I used, but just in case, I’ll leave it here :winking_face: (we never know :winking_face: )
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 :winking_face: .
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 !
BUT, I now got another problem in another DB with that exact same DATETIME_DIFF formula and I truly don’t understand why ,
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 ) .
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 diedor 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 :winking_face: )) :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 ?
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
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 :winking_face: .
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 !
BUT, I now got another problem in another DB with that exact same DATETIME_DIFF formula and I truly don’t understand why ,
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 ) .
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 diedor 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 :winking_face: )) :roll_eyes: :
At least, it helped me to think outside of the box , which helped me with a formula in another base I’ve created .
Concerning this particular formula, I’ve found the answer in another post :winking_face:
I don’t know if someone else would be interested in the formula I used, but just in case, I’ll leave it here :winking_face: (we never know :winking_face: )