Forum Discussion

Amapola67's avatar
Amapola67
Copper Contributor
Oct 28, 2021

Conditional Formatting based on empty Date column

Good Morning

 

I have a SharePoint list and I want to apply conditional formatting if an item hasn't been submitted, in which case a Date field will be empty.

 

I have applied other formatting based on whether a column contains data by simply picking the column, 'is equal to' or 'is not equal to' and then leave the last field blank. But that doesn't seem to work with a Date field.

 

I've also tried to put the condition as 'Column' 'is not equal to' '1/1/1990' - in the hope that picking a date long ago, nothing will match but this doesn't work either.

 

I have other conditions so I didn't really want to go to JSON. I don't know enough to work out how to put 3 conditions together!

 

Is there any way to conditionally format based on the empty Date value?

 

Thanks,

Christine

  • Kregg1122's avatar
    Kregg1122
    Copper Contributor

    Amapola67,

    I realize this is a bit dated now, but I believe this can still be done with the out-of-the-box conditional formatting style editor --for those interested in just formatting an individual date column, by simply choosing the "is between" comparison and leaving the date selections empty.

     

     

     

     

  • RobElliott's avatar
    RobElliott
    Silver Contributor

    Amapola67 you can format the date column in advanced mode as follows:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
      "elmType": "div",
      "txtContent": "@currentField",
      "style": {
        "background-color": "=if(Number(@currentField) == 0, '#541417', 'green')",
        "color": "white"
      }
    }

     

     

    Rob
    Los Gallardos
    Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

    • Amapola67's avatar
      Amapola67
      Copper Contributor

      RobElliott Thanks!

      But that only formats that field while I'm trying to format the entire item. As a work around, I've introduced a Status column but that means I need to manually update it .. :sad:

       

       

      • RobElliott's avatar
        RobElliott
        Silver Contributor

        Amapola67 "But that only formats that field while I'm trying to format the entire item" - it would have been helpful if you'd said that in your original post!

         

        Rob
        Los Gallardos
        Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

         

         

Resources