Forum Discussion

JenniferDriscol's avatar
JenniferDriscol
Qrew Member
11 months ago

Formula for figuring out age in months

Hi,

I have tried a bunch of different ways but I need to figure out the age of a child in months. is there a formula for this?



------------------------------
Jennifer Driscoll
------------------------------

11 Replies

  • this beauty will show like

    2 yrs 11 months and 5 days 

    you can drop the days part and get years and months.



    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------
    • MarkShnier__You's avatar
      MarkShnier__You
      Qrew Champion

      Sorry, try this:  substitute your field name for date of birth into the first line.

      var date MyDate = [DOB];
       
      var number Years = Year(Today())-Year($MyDate) -
       
                  If( Month(Today())<Month($MyDate)
       
                      or
       
                  (Month(Today())=Month($MyDate) and Day(Today())<Day($MyDate)),1,0);
       
       
       
      var number Months =  If(
       
                  Month(Today()) > Month($MyDate), Month(Today()) - Month($MyDate),
       
                  Month(Today()) = Month($MyDate) and Day(Today()) >= Day($MyDate), Month(Today()) - Month($MyDate),
       
                  Month(Today()) = Month($MyDate) and Day(Today()) < Day($MyDate), 11,
       
                  12-(Month($MyDate) - Month(Today())));
                  
      $Years * 12 + $Months


      ------------------------------
      Mark Shnier (Your Quickbase Coach)
      mark.shnier@gmail.com
      ------------------------------
      • JenniferDriscol's avatar
        JenniferDriscol
        Qrew Member

        Hi,

        I tried Both. The first one said there is a syntax error--parenthesis are mismatched. the 2nd one said that there are extra characters at the end. What in the heck am i doing wrong. I copied and pasted



        ------------------------------
        Jennifer Driscoll
        ------------------------------