Multiple Conditions/Colors for SharePoint List Calendar

2024-02-12T10:27:49.9166667+00:00

Hi, I have two sets of conditions that I would like to color code for in a SharePoint List Calendar. Conditional Formatting is great when coloring certain items based on one variable, however I haven't found a way to color code for multiple variables. As an example, let's say I have time off requests for employees and each type of request is color coded. Blue for Vacation, Red for Sick Day. I am also dealing with employees from different regions and want to color code for that as well without creating multiple views. Is there a way to color code both variables? Perhaps the borders of the entries for the Northeast region could be purple and the borders of the West Coast entries could be green. This example would yield four different color codes. Vacation (Northeast): Blue fill with purple border Sick Day (Northeast): Red fill with purple border Vacation (West): Blue fill with green border Sick Day (West): Red fill with green border Is this possible?

Microsoft 365 and Office SharePoint Development
{count} votes

Accepted answer
  1. Emily Du-MSFT 51,836 Reputation points Microsoft External Staff
    2024-02-13T08:31:34.52+00:00

    Go to the calendar view -> Format current view -> Apply formatting to Month -> Advanced mode -> Use following JSON codes.

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/calendar-formatting.schema.json",
      "additionalEventClass": "=if([$Typeofrequest] == 'Vacation' && [$Region] == 'Northeast', 'sp-css-color-WhiteFont sp-css-backgroundColor-BgLightBlue sp-css-borderColor-PurpleText', if([$Typeofrequest] == 'Sick Day' && [$Region] == 'Northeast', 'sp-css-color-WhiteFont sp-css-backgroundColor-BgCoral sp-css-borderColor-PurpleText', if([$Typeofrequest] == 'Vacation' && [$Region] == 'West', 'sp-css-color-WhiteFont sp-css-backgroundColor-BgLightBlue sp-css-borderColor-GreenText','sp-css-color-WhiteFont sp-css-backgroundColor-BgCoral sp-css-borderColor-GreenText')))"
    }
    

    Result:

    enter image description here


    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.


1 additional answer

Sort by: Most helpful
  1. Emily Du-MSFT 51,836 Reputation points Microsoft External Staff
    2024-02-16T10:20:01.68+00:00

    You could refer following documentation to know more about JSON formatting in the calendar view.

    https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-calendar-formatting

    Per my knowledge, a color stripe is not possible.

    And you could through background color, font color, border color and hover color to do conditional formatting.


    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.