Bug 159167 - Conditional formatting of cells based on rules for checking values greater than or less than
Summary: Conditional formatting of cells based on rules for checking values greater th...
Status: NEEDINFO
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.4.1 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-13 14:18 UTC by Alexander Nolting
Modified: 2024-01-25 16:37 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Conditional fornatting of cells based on rules for checking values greater than or less than or equal to (8.90 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-01-13 14:19 UTC, Alexander Nolting
Details
Modified file (9.94 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-01-13 22:26 UTC, m_a_riosv
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Nolting 2024-01-13 14:18:32 UTC
Description:
I want to format cell values in green (lower) or red (higher) compared to cells containing values for comparison.
Attached is a calc document containing two rows of values where the first row has a conditional formatting rule applied.

It is expected the cells in the first row are colored red and green based on the result of the formatting rule - the rule covers the whole cell range with values in this row:

On a lower value compared to the cell from the second row the cell background is set to green and on a higher value set to red.
The coloring ends after the first cell.

After reading the documentation page to this funtionality I'm not sure if the created rule is the correct way to do this, but in my understanding of the documentation it should be.

Best Alex


Steps to Reproduce:
1. Create the formatting templates from two cells where the first cells background is colored green and the second cell background for the second formatting rule is colored red. Name each formatting template depending on the color: for red give the name "Higher" and for green the name "Lower".
2. Create two rows with about 5 columns of data.
3. Create a conditional formatting rule of the range of cells containing values in the first row.
4. Select Cell value and for the comparison rule lower than and select the cell range for comparison in the range of cell in the second row containing values.
5. Add another subrule set and select as comparison rule higher than and select the same range in the second row.

Actual Results:
First cell in the first row will be formatted.

Expected Results:
All cells in the first row will formatted.


Reproducible: Always


User Profile Reset: No

Additional Info:
[Information automatically included from LibreOffice]
Locale: de
Module: SpreadsheetDocument
[Information guessed from browser]
OS: Windows (All)
OS is 64bit: no
Comment 1 Alexander Nolting 2024-01-13 14:19:22 UTC
Created attachment 191913 [details]
Conditional fornatting of cells based on rules for checking values greater than or less than or equal to
Comment 2 Werner Tietz 2024-01-13 17:11:27 UTC
I guess your after:

CF for A1:E1:
   1. Cellvalue »lower|equal« A$2 ⇒ Lower
   2. Cellvalue »greater« A$2  ⇒ Higher

CF for A2:E2:
   1. Cellvalue »lower|equal« A$1 ⇒ Lower
   2. Cellvalue »greater« A$1  ⇒ Higher


Solved?
Comment 3 Werner Tietz 2024-01-13 17:20:07 UTC
More compact:

CF for A1:E2:
   1. Cellvalue »equal_to« MIN(A$1:A$2) ⇒ Lower
   2. Cellvalue »equal_to« MAX(A$1:A$2) ⇒ Higher
Comment 4 Alexander Nolting 2024-01-13 17:21:42 UTC
Hi Werner

as you can see in the attached document, this is what I've configured. Currently only for the range A1:E1 compared with A2:E2.
And it is not working. Sorry.

Best Alex
Comment 5 Rafael Lima 2024-01-13 19:53:33 UTC
AFAIK it is not possible to define a conditional formatting rule where the condition is a range. It has to be either a single cell or the result of a formula.

In Excel it is not possible as well. The difference is that Excel throws an error, making it clearer that this is not possible.
Comment 6 Rafael Lima 2024-01-13 20:14:00 UTC
Actually Excel offers a way to achieve this:

https://techcommunity.microsoft.com/t5/excel/conditional-formatting-row-by-row/m-p/3966290

In Calc the same can be achieved by setting up a Color Scale (Format - Conditional - Color Scale).

Then in "Condition" you must choose "Formula is". Then you write "A1<=A2" in the formula and choose the style. Then do the same for the ">" rule.

Let me know if this works for you.
Comment 8 m_a_riosv 2024-01-13 22:26:18 UTC
Created attachment 191920 [details]
Modified file

If I have interpreted fine, what is required.

Instead of the second row range in the condition, put
$Tabelle1.A$2
Having a relative column, it is adapted by CFF as it evolves on the range with the condition.
Comment 9 Werner Tietz 2024-01-14 16:15:15 UTC
(In reply to Alexander Nolting from comment #4)
> Hi Werner
> 
> as you can see in the attached document, this is what I've configured.
> Currently only for the range A1:E1 compared with A2:E2.
> And it is not working. Sorry.
> 
> Best Alex

No your CF is different:
Cellvalue »lower|equal A2:E2
my suggestion:
Cellvalue »lower|equal A2

(you need do declare the CF relative to upper|left Cell in the CellRange !! ))