SharePoint Document Issues

Format a SharePoint Managed Metadata Year Column with JSON

Muhammad TalhaMuhammad Talha Nov 18, 2026 869 views

Question details

The user wants to highlight a Year cell in red when its value is two years before the current year.

Can SharePoint JSON Formatting Highlight a Managed Metadata Year Column?
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.
Before you start

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.

Solution 1Recommended

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.

1
Add a number column

In the document library, select Add column, choose Number, and name it Year Number. Enter the corresponding four-digit year for each document.

2
Open the formatting editor

Select the Year Number column header, then choose Column settings > Format this column. Select Advanced mode.

3
Apply the JSON

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.

4
Check the result

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.

Use a Number Column for JSON Year Formatting
Formatting does not change metadata: The JSON changes the number column's appearance only. It does not change or synchronize the managed metadata value.
Free Microsoft Office alternative

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.

Highlight year values in spreadsheets with conditional formattingCompatible with Microsoft Excel XLSX and XLS filesFamiliar spreadsheet interface for an easier transition from Microsoft OfficeFree and lightweight office tools
microsoft office alternative - wps office

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.