Format a Column as "Updated" if "Modified" <7 days ago

RASoul 0 Reputation points
2025-05-08T05:43:50.2666667+00:00

Hello -

I'm trying to format a Microsoft Lists presentation of a Sharepoint database. There is a column which is "latest update" for each row. We review the List weekly in a meeting. I would like to format the column "latest update" in yellow highlight if it has been updated in the last week.

I can conditionally format the "latest update" column if the "Modified" date on the record is "Today" but I can't make it "Today()<=7days" in JSON.

Can someone help?

Thank you!

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,601 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Hien-L 3,520 Reputation points Microsoft External Staff Moderator
    2025-05-13T08:04:10.7766667+00:00

    Hi RASoul,

    Good day! Welcome to Q&A forum.

    To Format a Column as "Updated" if "Modified" <7 days ago, you'll need to use JSON formatting with a proper date comparison formula. Here's an example how to implement this:


    {

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

      "elmType": "div",

      "txtContent": "@currentField",

      "style": {

        "background-color": "=if([$Modified] >= @now - 604800000, '#FFF100', 'transparent')",

        "padding": "0 4px",

        "border-radius": "3px"

      }


    Hope these information helps.

    Please do let us know if you have any further queries.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.