Changing cell style if the cell already have the style applied

Hello!
I am pretty new to Libre Office, so my question may seem dumb to most of you :slight_smile: - sorry for that!

For the past 2 days, I am trying to make a template file in which I will have to input some info/names (apartment guests), and depending on from which service my guests will be coming, I want to tag those cells with color.
Also, I want every other cell to be in a different shade of color, before I put the name in.

I did “shading” with the formula I found here, and it works. However, when I input the name and try to change the style to the one I made, cells that already have a shaded style applied, do not change!

Example: I have a style called cell_grey for shading. And 3 styles for services: cd_airbnb, cd_booking and cd_casadelone. Cells that already have cell_grey applied do not change if I try to apply any of the other styles.
Is there any way to make this work?

Also, after my guests go, I want expired dates to remain in color applied, but to add an overlay pattern. Can it be done? I mean, to select cells and add to that format an overlay pattern?

Thank you in advance!

Do you mean the Style() function? Then use the Style in the formula conditionally, or use the Conditional Format feature.

You need create more styles (child styles) with the desired pattern, and inherited colors.

This is no direct answer to your question, but a way to avoid doing this “manually”

I would suggest to use conditional formatting for this (and assume the information wich service was used is available in the spreadsheet).

https://help.libreoffice.org/latest/lo/text/scalc/guide/cellstyle_conditional.html

Sadly this will double the conditions as there is no “layer” of cell styles.

So you will need conditions like

AND (servicecell="booking";
           dateleaving< TODAY() )
-> style-booking-withpattern

servicecell="booking" 
-> style-booking

AND (servicecell="air";
           dateleaving< TODAY() )
-> style-air-withpattern
...

You need always the more specific condition first, as the first conditions wich is “true” wins and the style is used.

On the other hand there is no need to set colours or patterns yourself after you set this up.