SharePoint column formatting

SharePoint number column formatting

Make a number column say something: green under budget and red over, a currency symbol in front, a bar or a dashboard tile instead of a bare figure.

Number columns are the easiest columns in SharePoint or Microsoft Lists to format and the ones most people leave alone. By default a Number (or Currency) column shows the raw value — 1450 — with nothing to say whether that's good, bad, or over a limit. A short piece of column formatting JSON fixes that with a comparison and two colors, and the same JSON can add a symbol, a label, or a whole different shape.

The generator has several number templates, each for a different question: Inline Number colors a value against one threshold, Budget Threshold adds a currency symbol and turns red over a limit, KPI vs Target shows the delta from a target with ▲ and ▼, Heat Cell fills the cell green → amber → red by size, and Metric Card presents it as a dashboard tile. This page uses the budget one as the worked example because it combines the two most-asked-for things — a symbol and a limit.

Before and after

Line itemCost
Venue deposit$820
AV hire$1450
Printing$0
Catering$2300
At or under 1000 = green · over 1000 = red · symbol added in front
Build this budget formatter → Opens the generator on the Budget Threshold template. Enter your field name, limit, and symbol; copy the JSON; done.

What the SharePoint number formatting JSON looks like

The generator produces JSON like the example below. It's a single element whose text and colors are all expressions over the field's value:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "inlineEditField": "[$Cost]",
  "style": {
    "display": "inline-flex",
    "align-items": "center",
    "padding": "2px 9px",
    "border-radius": "4px",
    "font-size": "12px",
    "font-weight": "700",
    "cursor": "pointer",
    "font-family": "Consolas, Menlo, monospace",
    "color": "=if(toString([$Cost]) == '', '#605e5c', if(Number([$Cost]) > 1000, '#a4262c', '#107c10'))",
    "background-color": "=if(toString([$Cost]) == '', '#f3f2f1', if(Number([$Cost]) > 1000, '#fde7e9', '#dff6dd'))"
  },
  "txtContent": "=if(toString([$Cost]) == '', '—', if(Number([$Cost]) == 0, '$0', '$' + toString([$Cost])))"
}

Three expressions, one pattern. Number([$Cost]) > 1000 is the test; color and background-color each pick a value from it, giving dark-red-on-pink over the limit and green-on-mint under it — with a neutral grey first when toString([$Cost]) is empty, so a blank cell doesn't masquerade as a $0 line item. txtContent builds the label by joining the symbol to toString([$Cost]). Nothing here changes the data — the column still holds a plain number, and sorting, totals, and flows are untouched.

The threshold version, Inline Number, is the same idea without the symbol. It uses eight-digit colors like #d134381a — a normal hex color with an alpha value on the end — to get a faint tint of the same red as the text, which is an easy way to make a cell look highlighted without a hard block of color.

Three things to know about numbers in expressions

How to apply it

  1. Open the generator and pick the Budget Threshold template (or use the button above).
  2. Enter your column's internal field name — see the note below.
  3. Set the Limit and the Symbol (or leave the symbol empty for a plain number).
  4. Click Copy.
  5. In SharePoint: Column settings → Format this column → Advanced mode.
  6. Delete what's in the box, paste, click Preview, then Save.
Most common reason it doesn't work: the field name must match your column's internal name, which can differ from the display name (a column shown as "Total Cost" might be TotalCost or Total_x0020_Cost internally). See the internal field name guide to find yours.

Common questions

What happens when the number cell is empty?
SharePoint treats an empty number as 0 in expressions, so a blank cell takes whichever look 0 gets — under budget, in the red band, and so on. If blanks should look different, set a default value on the column or make it required so there are no blanks to misread.
Can I add a thousands separator or control decimals?
The templates show the value the column stores, so 1450 stays 1450. The column formatting expression language has no number-formatting function — its toLocaleString() only formats dates — so separators are not available in the JSON. Decimal places are set in the column's own settings.
Can I compare the number to another column instead of a fixed limit?
Yes. The Trend Arrow and KPI vs Target templates compare two values. In the JSON, a fixed limit like 1000 can be replaced with another field reference such as [$Budget], as long as that column is included in the same view.
Does the currency symbol change the stored value?
No. Column formatting only changes how the cell is drawn — the column still stores a plain number, so sorting, filtering, totals, and Power Automate see exactly the same value as before.