Format a SharePoint Managed Metadata Year Column with JSON
Question details
The user wants to highlight a Year cell in red when its value is two years before the current year.

- Product
- SharePoint document libraries
- Device & OS
- not provided
- Scenario
- A document library stores years in a managed metadata column, and the user wants to apply conditional JSON column formatting.
- Observed behavior
- The Year column is a managed metadata column, which is not supported for SharePoint JSON column formatting.
Confirm that the Year column is a managed metadata column and that you can create and format columns in the library. Identify how the year values will be entered or kept in sync if you add a separate number column.
Use a Number Column for JSON Year Formatting
Use a separate number column to display a red background when its year is two years before the current year.
Managed metadata columns are not currently supported for SharePoint JSON column formatting. A separate number column can be formatted, but it will not automatically stay synchronized with the managed metadata column.
In the document library, select Add column, choose Number, and name it Year Number. Enter the corresponding four-digit year for each document.
Select the Year Number column header, then choose Column settings > Format this column. Select Advanced mode.
Paste this JSON into the editor: {"$schema":"https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json","elmType":"div","txtContent":"@currentField","style":{"background-color":"=if(@currentField == getYear(@now) - 2, '#ffcccc', '')"}}. Select Save.
In the library view, check a row whose Year Number is two years before the current year. Its cell should have a light red background; update Year Number whenever the corresponding metadata year changes.

Request Managed Metadata Formatting Support
Use Microsoft feedback if you need formatting directly on the existing managed metadata column.
Review Year Data in WPS Spreadsheets
WPS Office is a free, lightweight alternative with a familiar interface for working with Office files. Open compatible spreadsheets and use conditional formatting to highlight year values, making it easy to move existing files into WPS. It does not change SharePoint column formatting.

Frequently Asked Questions
Can I apply SharePoint JSON formatting directly to a managed metadata column?
Managed metadata columns are not currently supported for SharePoint JSON column formatting. Check the SharePoint column formatting documentation on Microsoft Learn for the latest supported types.
Will the number column update when the managed metadata year changes?
No. A separate number column does not automatically mirror the managed metadata value. Update it when the metadata changes or arrange a synchronization process.
Where do I paste the JSON in SharePoint?
In the document library, select the number column header and choose Column settings > Format this column > Advanced mode. Paste the JSON and select Save.
Does the formatting change the stored year?
No. SharePoint column formatting changes the cell's appearance in the view; it does not change the stored number or managed metadata value.




