Edit=>Conditional Formatting

Conditional formatting can be used to change the text color and fill color of a table cell depending on the cell’s value, or to create a rule with a formula.

To add a new conditional formatting rule to a table:

Execute the command:

  • Select the cell range to apply the cell formatting,

  • Right click on the selected cell range and choose Conditional Formatting=>Add Cell Rule

../../_images/TableConditionalFormat_Add-en.png

Cell Reference

Specifies the cell reference in A1-style (column letter followed by row number). A reference can refer to a single cell (for example B2) or to a range of cells(for example A1:C4). The cell reference defines the cells to which the format is applied.

Starting with UniPlot R2025.3, conditional formatting supports relative and absolute cell references in the same way as formulas, using the $ symbol to lock rows or columns.

=A1          //relative reference (row and column slide when the rule is applied to multiple cells)
=$A1         //column fixed, row relative
=A$1         //row fixed, column relative
=$A$1        //both row and column fixed

This allows flexible rules that can adapt depending on the position of the formatted cell.

Example

If you apply a conditional formatting rule to the range B1:B5:

  • Rule: A1 > 2 Each row compares the value in column A of the same row (A1, A2, A3, …). The reference “slides” as the rule is applied to each row.

  • Rule: $A$1 > 2 All rows compare their value to cell A1 only, since both row and column are fixed.

Warning

This version introduces a change in reference behavior. In earlier UniPlot releases, all references were treated as absolute (=$A$1). Starting with UniPlot R2025.3, references without $ are relative and slide when applied to a range. Existing templates will be automatically updated on import to maintain compatibility, but new rules will follow the new relative/absolute logic.

Format all cells based on their values

If enabled, the cell value will be compared to the specified value Value1. The following is of operators that can be used:

Operator

greater as (>)

greater or equal (>=)

less as (<)

less or equal (<=)

between (>= v1 && < v2)

not between (< v1 || > v2)

equal (==)

not equal (!=)

Value1

Is a real value.

Value2

Is a real value. Will only be used with between and not between.

Format all cells based on the formula expression

Expression

In an expression the following operators can be used: >, >=, <, >=, ==, !=. The expressions can be AND (&&) and OR (||) connected.

List with example:

Expression

Description

A1 > 10

If the value in cell A1 is greater as 10, the expression is TRUE (1).

B2 > C2

If the value in B2 is greater than the value in C2, the expression is TRUE (1).

sum(B2:E2) <= 10

If the sum of the cells in the range B2 to E2 is smaller or equal to 10, the expression is TRUE (1).

A1 > B1 && A1 < C2

If the value in cell A1 is between the values of B1 and C2, the expression is TRUE (1).

Fill Color

Color ist used to fill the cell.

Font Color

Color is used to display the cell value.

Condional Format Dialogbox

The following dialog box can be used to add, remove or edit cell rules.

../../_images/TableConditionalFormat_Manage-en.png

List of cell rules.

Each row is a format rule. The rules are evaluated as shown in the list.

UniScript-Interface

The TableFormatCondition_AddFormat function can be used in UniScript to add conditional formatting to a table. The format parameter is an object Example:

oFormat = [. sqref = "a1:a2",
             type = "cellvalue",
             formula = ["less", "0"],
             format = "fill-color = 'cyan' font-color = 'red'"];
TableFormatCondition_AddFormat(hTable, oFormat)

The color can also be specified as an RGB value, as follows:

oFormat.format = "fill-color = 'rgb(255,0,0)' font-color = 'rgb(100,100,100)'";

Operator names: greater, between, notbetween, greaterequal, less, lessequal, equal, notequal.

More examples:

oFormat = [. sqref = "a1", type = "cellvalue",  formula = ["between", "10", "20"], format = fill-color='rgb(255,0,0)'];
oFormat = [. sqref = "a1", type = "cellvalue",  formula = ["between", "10", "20"], format = fill-color='rgb(255,0,0)'];
oFormat = [. sqref = "C4:G4",  type = "expression", formula = "(C4 < D4)",  format = fill-color='green'];
oFormat = [. sqref = "D9:G13", type = "expression", formula = "(D9/1000 > 0.46)", format = fill-color='rgb(255,0,0)'];

History

Version

Description

R2025.3

Excel like reference style for cells.

R2018.6

New.

id-1237658