Google Sheets – Conditional Formatting Based on Previous Cell Content

conditional formattinggoogle sheets

Is it possible to conditionally format the background colour of a cell, based on the value in the column preceding it?

For example, in the following table (first row/column are titles):

  | A | B | C
1 | 1 | 5 | 2
2 | 2 | 7 | 0
3 | 3 | 1 | 2
4 | 1 | 3 | 4
5 | 1 | 5 | 0
6 | 4 | 1 | 2
7 | 8 | 2 | 4

B1 should be green, as it is greater than A1.

but

C5 should be red, as it is less than B1, etc

I'd like this formatting rule to work with any new column I add. The dataset I'm working with is date driven analytics.

Try as I might, I can either only seem to format the cells by:

  • A fixed number
  • A fixed cell

Best Answer

You can conditionally format based on another cell or column by selecting your cells, and making a conditional formatting rule for cells "Greater Than" the cell "A1" as shown below.

Sheets uses this as a relative reference that you're comparing the cell to the left of each cell in your selection.

Screenshot