Zebra striping based on cell contents in Google Spreadsheets

In its latest version, Google Docs spreadsheets now support using formulas for conditionally formatting cell font and background colors. What this means is that you can make your sheets much easier to read. Here are some useful formulas for sprucing up your sheets.

If you're like me and love the power of spreadsheets but don't miss Excel one bit, this new feature has been a welcome addition. Truth to be told, it should have been added years ago. But it's here now so let's see what we can use it for.

What conditional formatting is

With conditional formatting, a cell's appearance can reflect its contents. In the past, Google spreadsheets could be used to format cells based on whether a cell's value was higher or lower than what was specified, equal, empty et c. With formulas, this feature becomes considerably more powerful.

Formulas for conditional formatting, which are now available, makes it possible for the formatting of one cell to depend on the value of another cell. Not just itself. Furthermore, it allows you to use the same formulas you normally use for calculations. With custom functions and scripting, the uses are almost limitless.

How to use them

The conditional formatting can be found by following the instructions provided by Google here.


To use these formulas, highlight all cells you want the formatting to apply to, then use these formulas. By default, formatting formulas are relative to the cell they apply to (just like all spreadsheet formulas), why it's important to keep those dollar signs there as they indicate the formula cell reference is absolute, not relative.

Zebra striping a numbered list or a list of dates

If you have a list of dates you can easily give each month a distinctive color to make it easier to read it.

The following formula expects a date in the format YYYY-MM-DD, it extracts (MID) the month (MM) and uses the modulo (MOD) function to divide it by 2. Modulo (the % operand) returns the remainder after a division. So 3%2 = 1 and 4%2 = 0. Even month numbers will return 0, i.e. the cell won't have the formatting apply. Odd will return 1, applying the rule. As a result, every second month, starting with the first one, will have the formatting.

=MOD(MID($A1; 6; 2); 2)

TODO list

This formula will apply to cells in rows where the first cell has the value "done" by doing an equivalency check (EQ()), if true, the formatting will apply:

=EQ($A1; "done")

I will add more examples over time. Please post your conditional formatting formulas in the comments section below to share.

Photo by eschu1952

This article was updated on 2020-03-01

Jakob Persson

Your host. A founder and entrepreneur since 20 years. Having worked as a freelancer, consultant and co-founder of a successful digital agency has shaped his skills in and insights into business. Jakob blogs at blog.bondsai.io, speaks at events and consults with agencies and freelancers in growing and developing their companies. He holds degrees in media technology and cognitive science.