Hi, I am trying to work out the age of a pers...

(Wesley Tulleken) #1

Hi, I am trying to work out the age of a person at two points, when they were diagnosed with something, and on the day we added them. I was using yearfrac(Date1, date2) in excel/googlesheets with good effect, but in appsheet it doesnt seem to work. Can anyone help?

Thanks

(Aleksi Alkio) #2

Check this old post… plus.google.com - If anyone is looking for automatically calculate an age from a date… heres … If anyone is looking for automatically calculate an age from a date… heres … plus.google.com

(Suvrutt Gurjar) #3

Hi @Wesley_Tulleken,In addition to excellent guidance by Aleksi, if you wish to have the equivalent expression of YEARFRAC

function in AppSheet, you may wish to consider following.

The YEARFRAC (Option 3) expression in a Decimal

type column in AppSheet is

DECIMAL((HOUR([End_Date] - [Start_Date]))) / DECIMAL(365.0000*24.0000)

I tested it over a period of 30 years and results exactly match up to 4 decimal digits. Please use and test thoroughly at your end as well.

I believe

one can construct other options of YEARFRAC function as well with AppSheet expressions.

The picture below shows test results in AppSheet. YFSpreadSheet is Google sheets

calculation and YF Calc is AppSheet expression calculation.