Conditional formatting formula in a table (2024)

Table of Contents
Abstract Transcript

Abstract

In this video we'll look at how to apply conditional formatting to a table with a formula.

Transcript

In this video we'll look at how to apply conditional formatting to a table with a formula.

Here we have a table that contains employee data.

Let's say we want to highlight people in this table who belong to group A.

Conditional formatting works well in a table, but you can't use structured references directly when you create the rule.

I'll use a helper column to help illustrate.

To highlight people in group A using structured references, we'd want to use a formula like this:

=Table1[@Group]="A"

Translated, this means: the value in the current row of the Group column equals "A".

You can see the formula returns TRUE for all rows where the group is A, and FALSE for any other group.

However, if I try to use this formula to define a conditional formatting rule, Excel will complain.

This is because structured references are not recognized inside a conditional formatting rule.

The workaround is to use regular references. In this case, I need to use:

F5 equals A, with column F locked.

=$F5="A"

This allows the formula to highlight an entire row.

Now I'll use this formula to create the conditional formatting rule.

As you can see, the rule correctly highlights employees in group A.

Even though we can't use structured references, we still get some benefit from using a table, because Excel will keep track of the table range.

If I add some new data to the table, the table expands and Excel automatically extends the conditional formatting rule to cover the entire range.

I can verify this by checking the range inside the rule.

Next, I'll extend the rule a bit to make the worksheet more interactive.

I'll first put an "A inside cell F2, and then edit the formula to refer to F2.

That way a user can change the group being highlighted any time they want.

Notice Excel uses an absolute reference by default, which is what we need in this case.

Back on the worksheet, I can now change the value in F2 to any valid group, and Excel will automatically highlight the relevant rows.

Conditional formatting formula in a table (2024)
Top Articles
Latest Posts
Article information

Author: Rubie Ullrich

Last Updated:

Views: 5730

Rating: 4.1 / 5 (52 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Rubie Ullrich

Birthday: 1998-02-02

Address: 743 Stoltenberg Center, Genovevaville, NJ 59925-3119

Phone: +2202978377583

Job: Administration Engineer

Hobby: Surfing, Sailing, Listening to music, Web surfing, Kitesurfing, Geocaching, Backpacking

Introduction: My name is Rubie Ullrich, I am a enthusiastic, perfect, tender, vivacious, talented, famous, delightful person who loves writing and wants to share my knowledge and understanding with you.