MS List Formula Syntax

Anonymous
2021-06-15T01:19:43+00:00

I am new to using Microsoft List. I am trying to do a simple calculation for Age using a Date of Birth and today's date. Can anyone help me with the formula that I need to use?

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Anonymous
    2021-06-15T05:42:42+00:00

    Hi Chantel,

    Thanks for using Microsoft products and posting in the community, I'm glad to offer help.

    According to your description, you can follow the steps below to format the 'Age' column:

    1. Create a 'Date and time' column named 'Date of Birth'
    2. Create a 'Calculated' column named Age and enter the formula as shown below (Note: to create a 'Calculated' column, please click '+Add column' > More…)  Image
    3. Select the 'Age' column > Column settings… > Format this column > Advanced mode > copy and paste the following code:

    {

      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",

      "elmType": "div",

      "txtContent": "=substring(toString(Number(@now-@currentField)/86400000/365),0,indexOf(toString(Number(@now-@currentField)/86400000/365),'.'))"

    }

     Image

    Reference: Create an 'Age/Days old' column in SharePoint List - Microsoft Tech Community

    Hope the above suggestion can be helpful, and please feel free to let me know if it works, I'll continue to help you.

    Best Regards,

    Arck

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2021-06-17T09:12:17+00:00

    Hi Chantel,

    I'm writing this reply to follow up on this thread, may I know if you have checked my last reply? When you have time, you are welcome to come back and let us know if you still need help here.

    Hope you are all well during this period, stay safe and have a nice day : )

    Best Regards,

    Arck

    1 person found this answer helpful.
    0 comments No comments