Forum Discussion
MarkShnier__You
4 years agoQrew Legend
Here is a formula which you can adapt for the age of a person from today. You can replace the Today() with your field for the [start date].
var date MyDate = [End Date];
var text Years = ToText(Year(Today())-Year($MyDate) -
If( Month(Today())<Month($MyDate)
or
(Month(Today())=Month($MyDate) and Day(Today())<Day($MyDate)),1,0));
var text Months = If(
Month(Today()) > Month($MyDate), ToText(Month(Today()) - Month($MyDate)),
Month(Today()) = Month($MyDate) and Day(Today()) >= Day($MyDate), ToText(Month(Today()) - Month($MyDate)),
Month(Today()) = Month($MyDate) and Day(Today()) < Day($MyDate), "11",
ToText(12-(Month($MyDate) - Month(Today()))));
var text DaysDisplay = If ( Day(Today()) > Day($MyDate), ToText( Day(Today()) - Day($MyDate) ),
Day(Today()) = Day($MyDate), "0",
Day(Today()) < Day($MyDate), ToText( Day($MyDate)-Day(Today()) ));
var text RawResult=
$Years & " Year" & If ($Years <> "1","s","") & "<br>" &
$Months & " Month" & If($Months<>"1","s", "") "<br>" &
$DaysDisplay & " Day" & If($DaysDisplay<>"1","s", "");
$RawResult
------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------
var date MyDate = [End Date];
var text Years = ToText(Year(Today())-Year($MyDate) -
If( Month(Today())<Month($MyDate)
or
(Month(Today())=Month($MyDate) and Day(Today())<Day($MyDate)),1,0));
var text Months = If(
Month(Today()) > Month($MyDate), ToText(Month(Today()) - Month($MyDate)),
Month(Today()) = Month($MyDate) and Day(Today()) >= Day($MyDate), ToText(Month(Today()) - Month($MyDate)),
Month(Today()) = Month($MyDate) and Day(Today()) < Day($MyDate), "11",
ToText(12-(Month($MyDate) - Month(Today()))));
var text DaysDisplay = If ( Day(Today()) > Day($MyDate), ToText( Day(Today()) - Day($MyDate) ),
Day(Today()) = Day($MyDate), "0",
Day(Today()) < Day($MyDate), ToText( Day($MyDate)-Day(Today()) ));
var text RawResult=
$Years & " Year" & If ($Years <> "1","s","") & "<br>" &
$Months & " Month" & If($Months<>"1","s", "") "<br>" &
$DaysDisplay & " Day" & If($DaysDisplay<>"1","s", "");
$RawResult
------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------
MariaPace
4 years agoQrew Member
Thanks! I made the changes but get the error "Expecting duration but found text" at $RawResult. Should I change the formula type?
------------------------------
Maria Pace
------------------------------
- MarkShnier__You4 years agoQrew LegendYes, if the result is to be in words then yes change the formula type to formula text.
------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------- MariaPace4 years agoQrew MemberIt works, thank you so much!
------------------------------
Maria Pace
------------------------------