Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index

Am 14.09.2015 um 09:13 schrieb Dave Barton:
-------- Original Message  --------
From: Brian Barker
Date: Mon, 14 Sep 2015 06:15:32 +0100

At 22:10 13/09/2015 +0200, Dave Barton wrote:
In Calc I have column with a series of calculated dates (ie. the
result of a formula). I am looking to find a way of using conditional
formatting to set the background colour (eg. green) for those dates
which fall on a Saturday or Sunday (eg. Condition: = WEEKDAY (A2; 2)>5
sets Format: Cell Background = Green)

Can anyone offer any pointers to a solution?

I think you have (almost?) answered your own question.

o Select *one* cell of your range - e.g. your A2.
o Go to Format | Conditional Formatting... .
o With "Condition 1" ticked, select "Formula is".
o In the Cell Value Condition box, enter: WEEKDAY(A2;2)>5
o For Cell Style, select Green. You need either already to have defined
a "Green" cell style or else to create one on the fly using the New
Style... button.
o Now copy that formatting to other cells in your range. You can do this
either by using the Format Paintbrush or by copying A2 and pasting it
over the range, but using Paste Special... and selecting *just* Formats
in the Paste Special dialogue.

Alternatively there is a quite different technique using the STYLE()
function. Modify your original formulae to read:
=<your existing formula>+STYLE(IF(WEEKDAY(CURRENT();2)>5;"Green"))

I trust this helps.

Brian Barker

Yes, Thank you Brian. I knew where I wanted to go, but took a wrong turn
and got lost. I now have no idea why I missed the obvious.
Also, thanks for reminding me about the "+STYLE(IF" alternative.
Guess I was having a brain deadlock day. :(


It works also with a range selection or even with multiple selected
ranges as long as you are aware that the dialog shows the conditional
format of _one_ cell which is the currently active cell within the
current range selection. All relative references are relative to this
single cell and adjust to the other cells when you finish the dialog.

The relative references in a c.f. behave exactly like in a cell formula
which is entered into a range of cells using Alt+Enter.
Test: Select a column of cells, say X1:X5, type =Y1 and hit Alt+Enter.
The c.f. dialog behaves in the same way in respect to the active input
cell and the other selected cells.

To unsubscribe e-mail to:
Posting guidelines + more:
List archive:
All messages sent to this list will be publicly archived and cannot be deleted


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.