Alternate and Conditional Formatting in Sharepoint List

James Jarman 1 Reputation point
2022-08-09T21:01:26.513+00:00

Is it possible to have both alternate row formatting (eg. blue/white), as well as conditional formatting based on a column value? I can get either to do what I want, but struggling to have both at the same time. I have a column called "Old", and if the value is "Yes" the entire row changes to red. Any help on the code would be appreciated!

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Dillon Silzer 60,701 Reputation points Volunteer Moderator
    2022-08-09T23:22:23.697+00:00

    Hi @James Jarman

    Yes, as seen below I have alternating colors and conditional formatting:

    229761-image.png

    How to have both:

    1) Create the conditional formatting for the list:

    a) Format this column

    229771-image.png

    b) Go to Manage Rules > Add Rule > Make the rule and formatting you want.

    229697-image.png

    2) Format the current view (for alternate coloring of rows)

    a) Go to All Items > Format Current View

    229762-image.png

    b) Add the JSON code:

    {  
      "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",  
      "additionalRowClass": "=if(@rowIndex%2==0,'ms-bgColor-themeLight','')"  
    }  
    

    229705-image.png

    Cited from https://techcommunity.microsoft.com/t5/sharepoint/sharepoint-list-alternating-column-formatting/m-p/2012389

    c) Click Save

    -------------------------------

    If this is helpful please accept answer.

    1 person found this answer helpful.

  2. James Jarman 1 Reputation point
    2022-08-10T14:25:22.28+00:00

    Thank you DillonJS, it worked!
    Is it possible to expand this to the entire line to change color, or is it just the the column field that I'd be limited to? Appreciate all the help!


Your answer

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