TheLibreOffice.com

LibreOffice Calc Conditional Formatting: Rules That Work

Choose the right Calc condition, build whole-row rules, and fix references, priority, blanks, text, dates, and saved XLSX behavior.

Highlight what matters. A green rule and a yellow fill mark cells on a paper grid.

To use conditional formatting in LibreOffice Calc, select the cells to format and choose Format → Conditional → Condition. Use Cell value is to check each selected cell, or Formula is to make its appearance depend on another cell. Assign a cell style, confirm the range, and keep Data → Calculate → AutoCalculate enabled so the formatting follows changed values.

I'd start with one small range and a clearly named style. That makes it easier to see whether the problem is the condition, the cells it reads, or the area receiving the color before you apply the rule to a larger table.

Choose the rule that matches the question

The standard menu path is Format → Conditional → Condition; the tabbed interface uses Home → Conditional → Condition. Calc's conditional formatting controls offer several ways to decide what changes:

What you want to showChooseWhat the rule checks
Amounts over a limit, a status such as Paid, or repeated entriesCell value isEach cell's contents against the chosen condition
A whole row based on its Budget and Spent cellsFormula isAn expression written for the first cell of the selected range
Dates in a period such as today or next monthDate isRecognized dates against the chosen period
Relative magnitude across a set of numbersAll cells: Color Scale, Data Bar, or Icon SetValues across the range and the specified thresholds

Conditional formatting changes appearance. To restrict what someone can enter, use Calc data validation. Highlighting duplicates doesn't remove any records. Choose the condition for the decision you need to see.

Highlight values in one column

Use this practice table, with the headings in A1:C1 and data in rows 2–5. Enter Budget and Spent as numbers; leave the final Spent cell empty.

RowA: ItemB: BudgetC: Spent
2Printing100120
3Postage10090
4Folders10070
5Supplies100Empty
  1. Check that Data → Calculate → AutoCalculate is enabled. A check mark appears beside the command.
  2. Select C2:C5, excluding the heading.
  3. Open Format → Conditional → Condition.
  4. Choose Cell value is, then is greater than, and enter 100.
  5. Under Apply Style, choose Bad, or New Style to define your own readable fill and font combination.
  6. Confirm that Range is C2:C5, then click OK.

Only 120 meets this example's condition. Exactly 100 wouldn't: greater than excludes the boundary. Use greater than or equal to when the limit itself must count. For a lower and upper limit, Calc's between condition includes both boundaries.

For amounts above the selected range's average, choose Cell value is → is above average; no helper cell is needed. The average-based conditions ignore empty cells and text. To compare with a target already calculated in F1, choose is greater than and enter $F$1 as the comparison value. Its dollar signs keep every selected cell pointed at that same target.

This first rule compares every amount with the same fixed number. If each row has its own budget, comparing Spent with 100 is the wrong business rule even when the colors look plausible. Use the Budget column instead.

Color a whole row based on two cells

The range determines where the style appears. The formula determines which values decide. To color Item, Budget, and Spent together, the target range must include all three columns.

  1. On the practice sheet, open Format → Conditional → Manage, select the earlier C2:C5 demonstration rule and click Remove, then OK. Save a copy before removing rules from an existing workbook.
  2. Select A2:C5, starting at its upper-left cell, A2. Open Format → Conditional → Condition.
  3. Choose Formula is and enter AND(ISNUMBER($B2);ISNUMBER($C2);$C2>$B2).
  4. Choose New Style, name it Over budget, and give it a readable appearance. Include both fill and border if you want both.
  5. Confirm A2:C5 in Range and click OK.

For the Printing row, the condition reads Budget 100 and Spent 120, so it selects the Over budget style across A2:C2. The two ISNUMBER checks exclude empty and text amounts. These examples assume positive budgets; decide separately how your sheet should label a zero budget or a credit.

Write the formula for the upper-left cell of the selected range, then let Calc adjust the relative references for the other cells. The condition reads one Budget and one Spent value per row. Don't put an entire comparison range such as $C2:$C5>$B2:$B5 into this scalar row rule.

Conditional Formatting formula for A2:C5 using fixed B and C columns and the Over budget style.
The range chooses where the style appears; the row formula chooses which amounts decide it. View this interface detail at full size.

Fix the columns and let the row move

In $C2, the dollar sign fixes column C while the row remains relative. Every cell across the first selected row reads C2; every cell across the next row reads C3. The same applies to $B2.

Reference in a rule starting at A2What happens across and down the rangeUseful when
C2Both column and row can shiftEach target cell should inspect a correspondingly offset cell
$C2Column C stays fixed; row changesAn entire row depends on its own column-C value
C$2Column changes; row 2 stays fixedEach column depends on a value in a fixed header row
$C$2Every target reads the same cellOne control cell governs the whole range

Calc's relative and absolute reference rules explain these shifts. The fixed $F$1 comparison above is useful for one shared target; $B2 and $C2 serve a row-specific comparison. A range beginning at row 8 needs a formula written for row 8, such as $C8>$B8.

Put the most specific match first

Now add a warning when spending reaches 90% of the budget. In Manage, select A2:C5, click Edit, then Add. Set the second condition to Formula is:

AND(ISNUMBER($B2);ISNUMBER($C2);$C2>=$B2*90%)

Create a style named Near budget. Use Up or Down to place Over budget above Near budget. Calc applies the first condition that evaluates to true; two matching conditions in this list don't combine their styles.

BudgetSpentOver budget?At least 90%?Style with this order
100120YesYesOver budget
100100NoYesNear budget
10090NoYesNear budget
10070NoNoUnderlying formatting
100Empty or textNoNoUnderlying formatting

The warning overlaps the over-budget condition by design. If you put the warning first, 120 receives the warning style and never reaches the over-budget style. This is why I'd keep related decisions in one ordered list for the same range.

Over budget precedes Near budget in Calc’s conditional formatting list, with the second condition selected.
Put the more specific Over budget condition first; the first true condition supplies the style. View this interface detail at full size.

Underlying cell styles and direct formatting remain saved. They become visible when no condition matches or the conditional formatting is removed. Keep the amounts or a written status readable as well; someone printing in black and white should still be able to understand the sheet.

Use text, dates, and duplicates with the right scope

Quote a status; use a formula for its row

For a status column in D2:D100, select that range and choose Cell value is → is equal to. Enter "Y", including the straight quotes, and assign a style. Add another condition with "N" and its own style. Calc's text-comparison instructions require quoted text literals.

To color a wider row from that status, use A2:D100 as the target range and $D2="Y" as a Formula is condition. For a full status such as Paid, use "Paid". Choose contains only when a match anywhere inside longer cell content is what you mean; exact status matching and substring matching solve different questions.

Check real dates and protect empty rows

For dates in a built-in period, select the date cells and use Date is with a period such as Today or Next month. A week-based period follows the locale's week boundaries, as the current Calc Guide's date rules explain.

For a whole-row overdue warning based on valid dates in E, select the required rows, such as A2:E100, and use:

AND(ISNUMBER($E2);$E2<TODAY())

Calc stores dates as numbers, so the numeric check excludes empty cells and date-looking text. It doesn't establish that every number in E is a sensible due date. Keep that column for actual dates and correct imported text before relying on the warning.

A date equal to today doesn't meet the strict less-than comparison. TODAY() uses the computer's date and updates when the document is reopened or recalculated, including after values change. Don't assume an untouched open sheet refreshes exactly at midnight.

Highlight repeats without deleting records

Select the actual ID or value range, then use Cell value is → is duplicate and assign a style. The duplicate condition checks for another equal entry inside the range. Include all records you want compared, exclude the heading, and inspect repeated blanks before treating every highlighted row as a data problem. Deleting or merging duplicate records is a separate decision.

Choose fixed thresholds for bars, scales, and icons

Use All cells when you want magnitude rather than a yes/no decision: a color scale for a gradient, data bars for lengths, or an icon set for threshold bands. The scale and data-bar settings distinguish Value, Percent, and Percentile. They aren't interchangeable.

Value sets a numeric boundary. Percent positions a boundary within the interval between the range's minimum and maximum. Percentile uses the distribution of the data. A Percent threshold of 90 doesn't mean “90% of this row's budget.” Use the row formula above for that question.

For a completion column whose underlying values run from 0 to 1 and display as 0% to 100%, I'd set data-bar limits to Value 0 and Value 1. Then 50% represents half the fixed scale even when no current row has reached 100%. Automatic min/max limits instead follow the selected data. Keep the displayed numbers unless the bars alone communicate everything the recipient needs.

Data Bar dialog with fixed minimum Value 0, maximum Value 1 and Display bar only unchecked.
For a percentage stored between 0 and 1, fixed Value limits keep a 50% bar at half the scale. View this interface detail at full size.

Fix a rule that doesn't change the right cells

Before adding another condition, inspect the existing one in Format → Conditional → Manage. The Manage dialog shows only the first condition for each range; select the range and click Edit to see its full list.

SymptomCheckAction and expected change
Nothing changes after editing an amountAutoCalculate, selected range, and whether the chosen style looks differentEnable AutoCalculate; correct the range; assign a visibly different readable style
Only one cell or part of a row changesTarget range and fixed source columnsInclude all target columns and use mixed references such as $C2
The wrong row changes, or every row follows one amountFirst row in the formula and dollar signsMatch the formula's row to the range start; remove the row lock from $C$2 when each row should read itself
An amount looks numeric but is ignored=ISNUMBER(C2) in an unused cellIf false, inspect the source value and its decimal/import convention; correct the data type before judging the threshold
One color wins unexpectedlyEarlier true conditions and overlapping rangesReorder the conditions and consolidate related decisions into the intended range
The fill changes but the font keeps its type-based colorWhether View → Value Highlighting is activeTurn it off to see the rule’s font color. Value highlighting overrides font colors on screen; it does not replace the stored formatting.
A color remains after removing a ruleOther rules, direct formatting, and the underlying cell styleIdentify which layer supplies the color before clearing formatting you still need

To inspect a formula condition, place the same expression in an unused cell with a leading =, for example =AND(ISNUMBER($B2);ISNUMBER($C2);$C2>$B2). TRUE means the condition matches that row; FALSE means it doesn't. An error points to something that needs checking in the formula or the referenced values.

These examples use English function names and semicolons. In Tools → Options → LibreOffice Calc → Formula, or the corresponding LibreOffice Preferences panel on macOS, the formula settings control localized names and argument separators. Use the same syntax as a working formula in your sheet.

The numeric guards exclude blanks and text, but they aren't a general error trap. If B or C contains a formula error, use a separate first condition such as OR(ISERROR($B2);ISERROR($C2)) with a Check data style. Calc's logical-function rules propagate error arguments; an IFERROR wrapper can return FALSE for an errored comparison, but leaving that row uncolored doesn't repair its data.

A blank-looking cell needs a separate check: =ISBLANK(C2) distinguishes a genuinely empty cell from one containing a formula. The ISBLANK definition excludes cells with formulas, even when their displayed result is empty. Decide which meaning of “blank” your rule needs.

Extend the range or copy the rule with care

For more rows in the same table, edit the existing rule's Range, for example from A2:C5 to A2:C100. Keep the formula anchored to its starting row. I prefer a bounded range that covers the working table and expected additions; selecting an entire sheet makes it harder to spot accidental scope.

For another table, copy a cell with the rule, select the destination, and open Edit → Paste Special → Paste Special. Select only Formats, or use Formats only. Calc's formatting-only paste procedure copies conditional formatting without replacing the destination values. Other formatting is copied too, so inspect number formats, borders, and styles.

Review the destination range and formula after pasting. Relative rows can shift; a fixed column still points to its column letter. A table with Budget and Spent in different columns needs an adjusted condition. When Calc warns that a new range overlaps an existing conditional format, inspect the existing rule before creating a second definition.

To delete one condition, edit its range's list and use Delete there. To remove the conditional formatting for a whole range, select its entry in Manage and use Remove, then OK. Save a workbook copy first; don't use a broad clear-formatting operation when you only mean to remove a rule.

Check the saved XLSX in the app that will open it

Keep an ODS master. For an Excel recipient, use File → Save As to create a separately named XLSX copy. LibreOffice lists conditional formatting among the Excel conversion challenges; checking the current display alone doesn't establish that the saved rules survived the handoff.

Open the delivery copy in the recipient's Excel version. In the budget example, check an over-budget row, exactly 90%, exactly the budget, a below-warning amount, and an empty amount. Change a sample value in that copy and confirm that its appearance follows the rule. For bars or icons, also inspect thresholds and whether values remain visible.

In desktop Excel, Home → Conditional Formatting → Manage Rules lets you inspect rules and their scope. If the workbook is passed back, check the returned copy in Calc too. The Calc and Excel comparison covers the wider file-format decisions. Agree on the editable master before several people begin changing different copies.

Filed under Calc