Relative Reference in Conditional Formatting in Google Sheets

Relative reference in conditional formatting is not a matter of concern in Google Sheets if the cell range to highlight and the conditions are within the same sheet. It’s a concern only when they are in two different sheets in the same file!

Unlike normal worksheet formulas, the formulas in conditional formatting, known as formula rules, require the INDIRECT function to refer to another sheet.

As you may know, the INDIRECT function uses a cell reference as a string. So when we use INDIRECT to refer to a cell in Google Sheets in a ‘normal’ way, relative cell reference has no effect.

Syntax: INDIRECT(cell_reference_as_string, [is_A1_notation])

But we can overcome that by using the ROW and COLUMN functions within the ADDRESS function as the cell_reference_as_string argument inside INDIRECT.

In this post, let’s learn how to apply Relative Cell Reference in Conditional Formatting when two sheets are involved in the same Google Sheets file.

Before that, you must know how to apply Relative Cell Reference in Conditional Formatting within the same sheet in Google Sheets.

Relative Cell Reference in Conditional Formatting in the Same Sheet

Relative cell reference helps us use a single conditional format formula across an entire row or column range. So, no need to create separate formula rules for each cell or row/column.

Let me start with a column range, as it’s the most common scenario in conditional formatting.

Formula for a Column Range

Here’s an example. I want to highlight values in A2:A if B2:B is “Pending.” Both values are in the same sheet. How do I do that?

Here is the formula you must insert via Format > Conditional formatting > Format rules, and then select “Custom formula is.”

Custom Formula #1:

=B2="Pending"
Column highlighting based on relative reference in Google Sheets

The only thing you need to take care of is the “Apply to range” field inside the “Conditional format rule” panel.

You must set it to A2:A so that the formula for the first cell will automatically apply to the selected range. Because we have used a relative cell reference (no dollar sign with B2).

Suppose I want to highlight both columns A and B. Simply changing “Apply to range” to A2:B won’t yield the desired result.

In such a scenario, make the column (letter) absolute and keep the row (number) relative.

Custom Formula #2:

=$B2="Pending"
Highlighting two columns with relative reference in Google Sheets

What about if the values are in two rows instead of two columns?

Formula for a Row Range

Here too, there is no change in how we use Relative Cell Reference in Conditional Formatting in Google Sheets.

If the invoice numbers are in row #1 and the statuses are in row #2, the same formula rule #1 applies to highlight row #1.

Just set “Apply to range” to B1:K1 to get the highlighting, as shown below.

Row highlighting using relative reference in conditional formatting

To highlight both rows, using custom formula #2 won’t work because the column was made absolute.

Here, instead, we must make the row (number) absolute. Also, change the highlight range to A1:K2.

Custom Formula #3:

=B$2="Pending"
Highlighting two rows with relative reference in Google Sheets

Relative Cell Reference in Conditional Formatting Across Two Sheets

The above custom formulas won’t work if the invoice numbers are in one sheet and the statuses are in another sheet. No matter whether it’s column-wise or row-wise.

For example, the invoice numbers are in A1:A in “Sheet1,” and the statuses are in B1:B in “Sheet2” (this setup is just for explaining Relative Cell Reference in Conditional Formatting).

In this case, some of you might think the following rule would work:

=Sheet2!B2="Pending"

But it won’t, because conditional formatting rules in Google Sheets only apply within the same sheet. That’s why the workaround is to use INDIRECT.

Whenever two or more sheets are involved in conditional formatting, we must use the INDIRECT function.

(Must Read: Using INDIRECT in Conditional Formatting in Google Sheets.)

Since our focus here is Relative Cell Reference in Conditional Formatting, let me show you how to use INDIRECT properly.

Indirect Formula for a Column Range

In the image below, you can see the values (invoice numbers) to highlight are in “Sheet1,” while the criteria are in “Sheet2.”

Conditional formatting with relative reference across two sheets in Google Sheets

Here is the formula to use:

Custom Formula #4:

=INDIRECT("'Sheet2'!"&ADDRESS(ROW(B2),COLUMN(B2),4))="Pending"

To apply relative cell reference highlighting to an entire row (e.g., columns A and B in “Sheet1”), change B2 to $B2 in both the ROW and COLUMN functions inside ADDRESS.

Custom Formula #5:

=INDIRECT("'Sheet2'!"&ADDRESS(ROW($B2),COLUMN($B2),3))="Pending"

Don’t forget to change the “Apply to range” to A2:B.

Indirect Formula for a Row Range

Now let’s assume the values to highlight are in A1:K1 in “Sheet1,” and the conditions are in A2:K2 in “Sheet2.”

If so, use the same Custom Formula #4 above. Just set “Apply to range” to B1:K1.

Using Indirect function for conditional formatting across two sheets

To highlight multiple rows in “Sheet1,” for example, A1:K2, based on the same conditions in “Sheet2,” use this formula:

Custom Formula #6:

=INDIRECT("'Sheet2'!"&ADDRESS(ROW(B$2),COLUMN(B$2),4))="Pending"

That’s all about Relative Cell Reference in Conditional Formatting in Google Sheets.

Thanks for staying till the end. Enjoy!

Additional Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Top N Products and Top N Sellers in Google Sheets (Top N of Top N)

If you’ve ever wanted to compare which sellers contribute the most to your top-selling...

Use XLOOKUP in a Structured Table in Google Sheets (Single and Multiple Conditions)

This tutorial is for users who want to apply XLOOKUP inside a structured table...

Reset SCAN by Another Column in Google Sheets and Excel

Resetting SCAN function results based on values in another column is a topic of...

How to Get the Fastest Time for Each Person in Google Sheets

Whether you’re tracking race results, event times, or any other timed activities, finding the...

More like this

Top N Products and Top N Sellers in Google Sheets (Top N of Top N)

If you’ve ever wanted to compare which sellers contribute the most to your top-selling...

Use XLOOKUP in a Structured Table in Google Sheets (Single and Multiple Conditions)

This tutorial is for users who want to apply XLOOKUP inside a structured table...

How to Get the Fastest Time for Each Person in Google Sheets

Whether you’re tracking race results, event times, or any other timed activities, finding the...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.