0

I have a calculated column with this below formula:

=IF(ISBLANK([Confirmed Receipt Date]),"Open","Closed")

How do I make Open with red color and Closed a green color?

New contributor
Andrea is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2

You can use Column/JSON formatting to achieve this. Use below JSON code to change the color of the text:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "debugMode": true,
  "txtContent": "@currentField",
  "style": {
    "color": "=if(@currentField == 'Open', '#ff0000', '#00ff00')"
  }
}

Output:

enter image description here

Documentation: Use column formatting to customize SharePoint.

Additional:

If you want to change the background color with some cool icons then try below JSON code:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "attributes": {
    "class": "=if(@currentField == 'Close', 'sp-field-severity--good', 'sp-field-severity--blocked') + ' ms-fontColor-neutralSecondary'"
  },
  "children": [
    {
      "elmType": "span",
      "style": {
        "display": "inline-block",
        "padding": "0 8px"
      },
      "attributes": {
        "iconName": "=if(@currentField == 'Close', 'CheckMark', 'ErrorBadge')"
      }
    },
    {
      "elmType": "span",
      "txtContent": "@currentField"
    }
  ]
}

It will look like this:

enter image description here

  • Extremely helpful once again, thank you – Andrea Feb 11 at 10:24
  • Welcome. Please try it and accept as an answer if it helps you. If you come across any issue then you can comment here. – Ganesh Sanap Feb 11 at 10:26

Your Answer

Andrea is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.