Skip to content

Commit a721ecf

Browse files
committed
[ADD] spreadsheet: conditional formatting
task-3491855 closes #15129 Signed-off-by: Xavier Platteau (xpl) <xpl@odoo.com>
1 parent 2637c2e commit a721ecf

File tree

6 files changed

+156
-0
lines changed

6 files changed

+156
-0
lines changed

content/applications/productivity/spreadsheet/visualize_data.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ Present and visualize data
88
:titlesonly:
99

1010
visualize_data/charts
11+
visualize_data/conditional_formatting
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
======================
2+
Conditional formatting
3+
======================
4+
5+
Conditional formatting applies specific formatting, such as a background color or font color, to
6+
a range of cells that meet one or more defined criteria, or rules. This allows you to visually
7+
highlight important data, patterns, trends, or anomalies.
8+
9+
.. note::
10+
When a spreadsheet containing dynamic Odoo data is reopened or refreshed, any conditional
11+
formatting that has been defined is updated to reflect any changes to the data.
12+
13+
Different types of conditional formatting are possible:
14+
15+
- :ref:`Single color <spreadsheet/conditional-formatting/single-color>`: changes the color of the
16+
cell’s background or font, or changes the font formatting if cell values meet the defined
17+
conditions, e.g., changes a cell to red if an invoice is overdue.
18+
- :ref:`Color scale <spreadsheet/conditional-formatting/color-scale>`: uses color intensity to
19+
represent smaller and larger values on a two- or three-color scale, e.g., shows sales performance
20+
using increasingly dark tones of the same color.
21+
- :ref:`Icon set <spreadsheet/conditional-formatting/icon-set>`: uses sets of arrows, smileys, or
22+
dots in green, orange, and red to visually show how cell values in a range compare to certain
23+
defined values, e.g., a green smiley to represent sales performance above a certain amount.
24+
- :ref:`Data bar <spreadsheet/conditional-formatting/data-bar>`: inserts colored bars inside a cell
25+
to show how a value compares to the value of other cells in the defined range, e.g., the customer
26+
generating the highest sales has the longest bar, with bars of decreasing length for customers
27+
generating lower sales.
28+
29+
To add conditional formatting to a range of cells:
30+
31+
#. Select the cells the formatting rule should apply to.
32+
#. Click :menuselection:`Format --> Conditional formatting` from the menu bar.
33+
#. In the :guilabel:`Conditional formatting` panel that opens to the right of the spreadsheet, click
34+
:guilabel:`+ Add another rule`.
35+
36+
.. tip::
37+
Click :guilabel:`Add range` to select additional ranges of cells if needed.
38+
39+
#. Select the type of :guilabel:`Format rules`, then enter the information required depending on the
40+
rule selected.
41+
42+
.. _spreadsheet/conditional-formatting/single-color:
43+
44+
Single color
45+
============
46+
47+
With the range selected and :guilabel:`Single color` selected as the rule type:
48+
49+
#. Define the conditions to be met for the formatting to be applied by choosing the desired value
50+
from the :guilabel:`Format cells if …` dropdown.
51+
#. Define the :guilabel:`Formatting style` to be applied by selecting the appropriate font
52+
formatting, font color, and/or background color.
53+
#. Click :guilabel:`Save`.
54+
55+
.. example::
56+
In the example, single-color conditional formatting changes the background color of cells
57+
containing the value `FALSE` to red, showing at a glance which eLearning courses are not yet
58+
published.
59+
60+
.. image:: conditional_formatting/single-color.png
61+
:alt: Single-color conditional formatting showing cells containing 'False' colored red
62+
63+
.. _spreadsheet/conditional-formatting/color-scale:
64+
65+
Color scale
66+
===========
67+
68+
With the range selected and :guilabel:`Color scale` selected as the rule type:
69+
70+
#. Define what is used as the :guilabel:`Minpoint`, i.e., the lowest value, and the
71+
:guilabel:`MaxPoint`, i.e., the highest value, by selecting the appropriate category from the
72+
dropdown.
73+
#. Optionally, to create a three-color scale, add a :guilabel:`MidPoint`, i.e., the middle value.
74+
#. Define the color range by choosing a color for the lowest value, i.e., the :guilabel:`Minpoint`,
75+
and the highest value, i.e., the :guilabel:`MaxPoint`. For a three-color scale, also choose a
76+
color for the :guilabel:`MidPoint`.
77+
#. Click :guilabel:`Save`.
78+
79+
.. example::
80+
In the example, sales performance by salesperson is shown using a two-color scale, with white
81+
representing the lowest value, and increasing amounts intensifying in color towards the selected
82+
green color.
83+
84+
.. image:: conditional_formatting/color-scale.png
85+
:alt: Color scale conditional formatting showing sales performance by salesperson
86+
87+
Adding a :guilabel:`Midpoint`, with a corresponding color, allows you to highlight performance in
88+
relation to a defined target or neutral value, e.g., below or above a target %, or to distinguish
89+
between positive or negative values.
90+
91+
.. _spreadsheet/conditional-formatting/icon-set:
92+
93+
Icon set
94+
========
95+
96+
With the range selected and :guilabel:`Icon set` selected as the rule type:
97+
98+
#. Click on the set of :guilabel:`Icons` to use.
99+
#. For the first and second icons:
100+
101+
- enter the value that represents the *lower* threshold for the icon
102+
- indicate whether the cell value must be `>` :guilabel:`(greater than)` or
103+
`` :guilabel:`(greater than or equal to)` the threshold value
104+
- define whether the threshold value is a :guilabel:`Number`, :guilabel:`Percentage`,
105+
:guilabel:`Percentile` or :guilabel:`Formula`
106+
107+
The third icon is added to all cells whose values are below the threshold for the second icon.
108+
109+
.. tip::
110+
Click :guilabel:`Reverse icons` to reverse the order of the icons.
111+
112+
#. Click :guilabel:`Save`.
113+
114+
.. example::
115+
In the example, sales performance by salesperson is shown using a three-scale set of colored
116+
dots:
117+
118+
- A **green** dot represents high performance, and is added to total sales amounts *greater than
119+
or equal to* $50,000.
120+
- An **orange** dot represents average performance, and is added to total sales amounts *greater
121+
than* $25,000 (but less than $50,000 as this is the lower threshold for the green dot).
122+
- A **red** dot represents low performance, and is added to all other amounts (i.e., amounts
123+
below below $25,000 as this is the lower threshold for the orange dot).
124+
125+
.. image:: conditional_formatting/icon-set.png
126+
:alt: Icon set conditional formatting applied to sales amounts
127+
128+
.. _spreadsheet/conditional-formatting/data-bar:
129+
130+
Data bar
131+
========
132+
133+
.. note::
134+
Unlike other conditional formatting rules in Odoo Spreadsheet, this rule allows for the
135+
formatting to be applied either on the cells containing the values the rule is based on, or on a
136+
corresponding range of cells, e.g., on a column containing text. The :guilabel:`Apply to range`
137+
determines *where the formatting is shown*, while the :guilabel:`Range of values` determines
138+
which cells the rule is based on.
139+
140+
With :guilabel:`Data bar` selected as the rule type:
141+
142+
#. Click below :guilabel:`Apply to range`, then, in the spreadsheet, select the range of cells
143+
*where the data bars should appear*. Click :guilabel:`Confirm`.
144+
#. Click on the :guilabel:`Color` dot to select the color of the data bars.
145+
#. Click below :guilabel:`Range of values`, then, in the spreadsheet, select the range of cells
146+
*containing the values the rule should be based on*. Click :guilabel:`Confirm`.
147+
#. Click :guilabel:`Save`.
148+
149+
.. example::
150+
In the example, the rule is based on the `Total sales` amounts in column B (with the
151+
:guilabel:`Range of values` being `B2:B14`), while the formatting is applied on the
152+
`Salesperson` names in column A (with the :guilabel:`Apply to range` being `A2:A14`).
153+
154+
.. image:: conditional_formatting/data-bar.png
155+
:alt: Data bar conditional formatting
38.4 KB
Loading
24.3 KB
Loading
27.5 KB
Loading
21.7 KB
Loading

0 commit comments

Comments
 (0)