I’ve been looking all over this platform as well as trying out stuff, but I can’t figure out this formula.
Right now I have the following formula that displays the age in years and months :
INT(YEARFRAC(FORMAT_DATE({Date of Birth}),FORMAT_DATE(TODAY()))) & " years “& INT(MOD(YEARFRAC(FORMAT_DATE({Date of Birth}),FORMAT_DATE(TODAY())), 1) * 12) & " months”
I want it so that if the Date of Birth column is empty, then the formula is blank instead of showing the exclamation mark.
I tried:
IF({Date of Birth},(INT(YEARFRAC(FORMAT_DATE({Date of Birth}),FORMAT_DATE(TODAY()))) & " years “& INT(MOD(YEARFRAC(FORMAT_DATE({Date of Birth}),FORMAT_DATE(TODAY())), 1) * 12) & " months”),“”)
But it still shows up with the exclamation. Any help is greatly appreciated. Thank you
GCavin
(Gilles Cavin - Reinventing Formulas in monday.com)
2
With both solutions, I remain with an exclamation mark if the DOB is blank.
However, what’s weird is that with the first option, the > isn’t blue but white, so it looks like the formula is using it as an actual character and not as part of the formula ?
In this topic, I had found that if I ONLY write down what Jim said at the end, it shows up empty and works fine :
IF({Date},INT(YEARFRAC({Date}, TODAY())),“”)
But as soon as I replace the formula above with my own, it doesn’t work anymore… Is maybe my formula wrong?
Thanks again for your help
GCavin
(Gilles Cavin - Reinventing Formulas in monday.com)
4
GCavin
(Gilles Cavin - Reinventing Formulas in monday.com)
6
I can’t find a solution, sorry. Maybe someone else has one.
There are 2 things that make the formula break.
Contrarily to one might think, when you write:
IF(Condition,OptionA,OptionB)
monday will calculate OptionA, then OptionB and return the appropriate one based on the condition. One would think that it would first evaluate the condition, then calculate only the appropriate option: that’s not the case.
Once you know that, the problem is with the * 12. When there is no date provided, you end up multiplying NULL * 12 which generates an error and the infamous red exclamation mark. Try it without * 12 and you’ll see that it does work (and that’s also why the formula you found in the other topic does work!).
Maybe there is a solution using the formula column, I couldn’t find one. Anyone else?
Now, there is a solution without using the formula column, but it requires using an app called “Advanced Formula Booster”. With this app, you design your formulas outside of monday and it is a lot more intuitive. It is a different concept. For example, you can use as many lines as you want.
Here is what this same formula would look like targeting a {Age} text column(a regular text column).
I am the main developer of this app which was released this week. I decided to develop it after spending hours answering formula questions here to finally get annoyed with the complexity of most solutions I would recommend.
Should you want to test it, you’ll find all the info at https://docs.mdboosters.com. There is a trial version to play with it.
Since we are just launching it, I can provide you with a discount once the trial is over. Don’t hesitate to ask.
I tried the formula, but it seems to be partially working? The formula gives the age of people born in january, mars, september, october and november only. If someone is born in any of the other months, the formula column shows up with the infamous exclamation mark.
At least, when there is no date of birth, the formula column really shows up blank so that’s amazing!
Is that normal? Is there a workaround for this? Thank you again
Hi Marie-Eve, tested on my side the formula, and i have the same issue as you (some date fail like date in february, december…).
FIY, I have french date format… (24 Octobre, 2023). I guess it could be a clue.
Bonne journée