# age in YY.MM format

Topic Labels: Dates & Timezones Formulas
Solved
1177 4
cancel
Showing results for
Did you mean:
5 - Automation Enthusiast

I am struggling to get a Formula that would return my age, where the number after the decimal point indicates the number of months in duodecimal format. For example, my current age is 34 years and 3 months, therefore I want to see 34.03 as the return.

So far I've managed to only get this:

the formula I am using is:

(DATETIME_DIFF(TODAY(),{DoB},"Y"))
&"."
&((DATETIME_DIFF(TODAY(),{DoB},"M"))
-((DATETIME_DIFF(TODAY(), {DoB},"Y"))*12))

It is pretty close to what I am looking for, but how do I get 2 digits after the decimal point by default?

*
I understand that it may be a weird request asking to combine decimal and dozenal numeral systems like this, but would really appreciate if somebody helped me solve this one 🙏

1 Solution

Accepted Solutions
11 - Venus

It is more difficult than I thought!

String Ver.

``````DATETIME_DIFF(TODAY(),DoB,"Year")&
"."&
SWITCH(DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year")*12,
11, "",
10, "",
"0"
)&
IF(DATETIME_DIFF(TODAY(),DoB,"Month")>=0,
DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year")*12,
DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year")*12+12
)``````

Numeric Ver.

``````DATETIME_DIFF(TODAY(),DoB,"Year")
+
IF(DATETIME_DIFF(TODAY(),DoB,"Month")>=0,
(DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year")*12)/10,
(DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year")*12+12)/10
)
/
SWITCH((DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year"))*12,
11, 1,
10, 1,
10
)``````

4 Replies 4
11 - Venus

It is more difficult than I thought!

String Ver.

``````DATETIME_DIFF(TODAY(),DoB,"Year")&
"."&
SWITCH(DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year")*12,
11, "",
10, "",
"0"
)&
IF(DATETIME_DIFF(TODAY(),DoB,"Month")>=0,
DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year")*12,
DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year")*12+12
)``````

Numeric Ver.

``````DATETIME_DIFF(TODAY(),DoB,"Year")
+
IF(DATETIME_DIFF(TODAY(),DoB,"Month")>=0,
(DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year")*12)/10,
(DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year")*12+12)/10
)
/
SWITCH((DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year"))*12,
11, 1,
10, 1,
10
)``````

5 - Automation Enthusiast

It worked for me like a charm! Thank you very much 🙌

11 - Venus

I recall the existence of the MOD function.
It is simpler.

String ver.

``````DATETIME_DIFF(TODAY(),DoB,"Year")&
"."&
SWITCH(DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year")*12,
11, "",
10, "",
"0"
)&
MOD((DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year")*12),12)``````

Numeric Ver.

``````DATETIME_DIFF(TODAY(),DoB,"Year")
+
MOD((DATETIME_DIFF(TODAY(),DoB,"Month")-DATETIME_DIFF(TODAY(),DoB,"Year")*12),12)/100``````

9 - Sun

There's a terrible, brute-force way of doing the padded decimal portion:

`RIGHT("0" & {Month Difference}, 2)`