Coloring alternating table rows

Adding color to alternating rows in a table is a great way to improve a page’s readability and visual clarity. By applying different background colors to every other row, it becomes easier for the reader to distinguish between rows and follow the data across the table. This visual pattern helps reduce eye strain and makes it easier to scan and compare information. Also, it looks good! There are two different forms of the conditional formatting needed to get the alternating colors, depending on whether or not you’ve applied sorting to your table.

For tables without sorting:

If you want to add color to every other row (with the alternating row having no color), you’ll need to add one conditional formatting rule:
  • If you want the first row to have color, follow “Condition 2: Odd rows”
  • If you want the second row to have color, follow “Condition 1: Even rows”
If you want to add alternating colors to each row, you’ll need to create both conditional formatting rules. Within each rule, start with the find() formula. This formula searches for a needle in a haystack. Your needle is “thisRow”. Your haystack is your table.The find formula returns a number, which indicated what position the row is in in the table. We will then use isEven() or isOdd() to determine if something should be use the even color rule or the odd color rule.
Condition 1: Even rows Find(thisRow, [YOUR TABLE]).IsEven()
Condition 2: Odd rows Find(thisRow, [YOUR TABLE]).IsOdd()

For tables with sorting:

If you want to add color to every other row (with the alternating row having no color), you’ll need to add one conditional formatting rule:
  • If you want the first row to have color, follow “Condition 2: Odd rows”
  • If you want the second row to have color, follow “Condition 1: Even rows”
If you want to add alternating colors to each row, you’ll need to create both conditional formatting rules. Within each rule, start with the find() formula. This formula searches for a needle in a haystack. Your needle is “thisRow”. Your haystack is your table, with a sort() formula added to the end to indicate how it is sorted. This needs to match the sort you’ve applied to your table. The find() formula returns a number, which indicated what position the row is in in the table. We then use isEven() or isOdd() to determine if something should be use the even color rule or the odd color rule.
Condition 1: Even rows Find( thisRow, [YOUR TABLE] .Sort(...)) .IsEven()
Condition 2: Odd rows Find( thisRow, [YOUR TABLE] .Sort(...)) .IsOdd()
Coda tip
The conditional formatting rule will not automatically update if you change the sort on your table. If you do change how the table is sorted in the future, you will also need to update the conditional formatting formulas to match.

Was this helpful?

YesNo