How to apply alternate row background colors? And how to apply this in tables that already have conditional formatting?

How can I get alternate row background colors like this:

image description

(Note the alternate row background on the 1st table and the alternate col background on the 2st table)

I also have some tables with conditional formatting (ex: for colA, if AnyCell=“a” apply StyleX. “StyleX” change both Cell font and background). Can I add alternate row background colors to them too? Preferably an easy way to do this…

1 Like

Hello

Q1 How to apply alternating rows?

  • Define 2 cell styles with your desired background (e.g. BGGrey and BGWhite)
  • Format -> Conditional -> Condition...
  • Condition 1: Formula is ISEVEN(ROW()) Apply Style: BGGrey
  • Condition 2: Formula is ISODD(ROW()) Apply Style: `BGWhite?
  • Range: A2:AMJ1048576 (assuming row 1 contains a header)

In case you what that ro apply for columns just replace function ROW() by COLUMN().

Please note This reduces direct formatting options of cells (e.g. in this case you can’t change the background color any longer, since conditional formatting takes precedence).

Q2 Add alternating rows colorization to existing conditional formatting possible?

Yes - but this requires additional effort, since you would need to exclude the ranges of existing conditional formatting from the ranges above in Q1 and add the Q1 rules after the existing conditional formatting to assure precedence of rules.

2 Likes

This does not work for me :frowning:

And what are you doing, loosing your time here?

After applied:

1 Like

Thanks, who would ever have thought "Box List Green: would give you that, I mean
“alternating row colors” would seem to make more sense.

No I didn’t look at every example since Box List has nothing to do with row color in terms of English.

But I am not involved in the backlog for Libre…kinda glad I aint.

So you didn’t look at Simple Grid Rows either?

The Calc Guide can be helpful, download from English documentation | LibreOffice Documentation - LibreOffice User Guides

Are you a real AI or just some guy busting my balls and have to have the last word.

None of those options provide for alternate rows…they provide for a Box List, which has a header.
So again, the working seems like it was half hatched at best.

Well, I never like to use AutoFormat Styles; I prefer doing it the way I have for the last 35+ years, Formula is MOD(ROW(A1),2) and assign a style.
If you want three colours, then MOD(ROW(A1),3)=1, second rule is MOD(ROW(A1),3)=2

Otherwise, How to Report Bugs in LibreOffice - The Document Foundation Wiki