SharePoint conditional formatting: show a value only when another column matches
Keep a column quiet until it matters — the blocker note only when Status is Blocked, the reason only when a request is rejected — with one expression on the display property.
Some columns are only relevant in one situation. A Blocker notes column matters when the item is blocked and is clutter the rest of the time; a Rejection reason only means something once someone has said no. SharePoint and Microsoft Lists can't hide a column per row, but column formatting JSON can read another column in the same row and decide whether to draw anything at all.
The mechanism is a single style property: display. Set it to none when the condition fails and to a normal value when it passes, and the cell is empty or filled accordingly. The column header stays — this is a display rule, not a permission — but the row-level noise is gone.
Before and after
What the SharePoint conditional visibility JSON looks like
The generator produces JSON like the example below. It formats the Notes column, but the test inside it reads Status:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"inlineEditField": "[$Notes]",
"txtContent": "[$Notes]",
"style": {
"padding": "3px 8px",
"border-radius": "3px",
"background-color": "#fff4ce",
"color": "#323130",
"font-size": "12px",
"cursor": "pointer",
"display": "=if([$Status] == 'Blocked', 'inline-block', 'none')"
}
}
Everything except the last line is ordinary styling — a soft yellow note chip. The display expression is the switch: when [$Status] equals Blocked the chip renders as inline-block, otherwise it's none and the cell is blank. If your condition value contains an apostrophe — Client's review — the generator writes this as SharePoint's object form (? with three operands) instead, because the =if(…) string syntax wraps values in single quotes and can't escape one. Both forms mean the same thing, so the =if(…) spelling is fine to hand-edit whenever your values have no apostrophes. The formatter is applied to the Notes column, so inlineEditField still lets people click and edit the note when it's visible.
One rule governs every cross-column reference, and it's the cause of nearly every "it never shows" report: the column you read must be in the same view. Microsoft's documentation states it plainly — references to other fields work only if they're included in the view. If Status is hidden from the view, [$Status] has no value, the comparison fails, and the note stays hidden on every row. Add the column to the view; you can make it narrow, but it has to be there.
Conditions can be as rich as you need. && and || combine tests; @me is the current user's email, so [$Owner.email] == @me shows a value only to the item's owner — Microsoft's own examples use exactly that pattern for a per-user hide. And you don't have to hide: put the same if() on txtContent instead and show a dash, a hint, or a different field when the condition isn't met.
How to apply it
The step-by-step guide spells out every click, with pictures. In short:
- Click Build this conditional formatter above. It opens the step-by-step guide with the Conditional Visibility design already picked.
- In step 2, type the name of the column to show, the condition column to test, and the condition value it must equal.
- Missing a column? Step 3 shows exactly how to add each one.
- Click Copy my code.
- In your list, click the name at the top of the column you want to show or hide (not the one you’re testing), then Column settings, then Format this column. At the bottom of the panel that opens, click Advanced mode.
- Click inside the box, press Ctrl+A and then Delete to empty it, and press Ctrl+V to paste. Click Preview, then Save.
- Make sure the column you’re testing is shown in the view, or nothing will ever appear.
Common questions
Can I hide the entire column, header included?
Why does the value never appear, even when the condition is true?
Can I combine two conditions?
&& for and, || for or, so display can be =if([$Status] == 'Blocked' && [$Owner.email] == @me, 'inline-block', 'none'). Edit the display line in the JSON the generator gives you.Can I show something for everyone else instead of nothing?
txtContent: =if([$Status] == 'Blocked', [$Notes], '—') shows the note when blocked and a dash otherwise. The generator's status templates use the same pattern for empty values.