How to use conditional formatting based on another cell in Google Sheets?

conditional formatting based on another cell featured image

Written by Valentine Schelstraete

Mar 26, 2021

There are times when you need to look through mounds of data on a spreadsheet, often searching for certain values. However, without any design elements or visual cues, scouring the data can be time consuming and hard on the eyes. Fortunately, with Google Sheets you can use conditional formatting to change the color of the cells you’re looking for based on the cell value. This functionality is called conditional formatting. This can be done based on the individual cell, or based on another cell. I’ll show you how it works with the help of a few examples.

Different types of conditional formatting

Example 1: Identify the cells below a threshold

I’ll start with a basic example using conditional formatting to change a cell’s color. Consider the following spreadsheet. The warehouse supervisor, at a local automobile service station, uses it to track an inventory of spare parts.

Conditional formatting based on another cell 1

He needs to place a new order for a product if the quantity in stock (column B) falls below the threshold of 20. There are a large number of products and the values in column B change over time. So, he finds it difficult to identify the products that are going out of stock. Even if he were to color the cells manually to easily fish out the cells later, that would double his work – not an ideal solution!

The conditional formatting functionality comes to the rescue, with which you can change the cell colors based on the cell value in Google Sheets. To apply this formatting, first select all the cells in column B.

Now navigate to Format > Conditional formatting. A sidebar opens up on the right side of the screen. You’ll notice that in the Apply to range field, the value is already set to B2:B27. This is because that range is already selected. In any case, if you wish to change the range, you can do that.

I’ll choose Less than or equal to in the Format cells if drop-down field. Then key in the value 20 in the immediate next field. Essentially you are configuring Google Sheets to format cells in a certain way if it satisfies this condition. I’ll choose a Formatting style that’s red in order to suit the situation. To finish, just click on the Done button

Conditional formatting based on another cell 2

This is just a one-time configuration and automatically updates the formatting even if there are future changes to the data.

I used a direct condition for this particular example. You can also change the cell colors by making use of a formula. For that, you just have to ensure the value in the Format cells if drop-down field is Custom formula is, and accordingly key in the formula in the immediate next field.

Example 2: Conditional formatting based on another cell

Now that you know how to use conditional formatting, let’s look at how to change the color of a cell based on the value in a different cell. I’ll use the same example as before. This time, however, the warehouse supervisor wants the Product ID to be highlighted instead of the Quantity.

To do this, follow all the same steps as before, but select Custom formula is from the Format cells if drop-down field. Then, type in the formula based on the cell in column B. In this example, I’ve typed =B2<=20.

Conditional formatting based on another cell 3

Now I’ve achieved the same highlighting of cells with low inventory, but the Product ID is highlighted instead of the Quantity!

Example 3: Formatting with multiple rules

You don’t need to limit yourself to just one rule when using conditional formatting. Adding multiple conditional formatting rules can help visually dissect your data even further.

In this example, a fifth-grade teacher wants to highlight students whose grades are either below or above a threshold. Specifically, the teacher wants students with an average below 70 in red, and students in the 90’s in green.

Conditional formatting based on another cell 4

To do this, you need to add two separate rules. The process for each rule is very similar to the previous example.

Because you want the names highlighted based on the average scores, highlight the names as the Apply to range, and add the scores by typing the rule into the Custom formula is section from the Format cells if drop-down field

Conditional formatting based on another cell 5

Once you’ve written the first rule, press Done and then Add another rule. The formulas I used in the rules here are =F2<70 and =F2>=90.

Example 4: Formatting based on multiple cells

You can also use conditional formatting based on multiple cells, all within one formatting rule. To do this, you can use the OR or AND functions.

In this example, the teacher wants to consider each individual subject instead of the average. If a student has a grade below 60 in any subject, their name should be highlighted in red so the teacher can quickly see who’s struggling.

The method here is similar to the other examples – hopefully you’re getting used to it by now! The difference is, in the Custom formula is section from the Format cells if drop-down field, type =OR(B2<60,C2<60,D2<60,E2<60).

Conditional formatting based on another cell 6

Congratulations! You successfully used conditional formatting to provide visual cues that make the data identification process a lot easier!

Learn more about alternated colors in the following blog post: How to create an alternated colors list in Google Sheets?

Editor’s note: This is a revised version of a previous post that has been updated for accuracy and comprehensiveness.

You may also like…