Conditional Formatting on Multiple Rows Independently in Excel

Method 1 – Use of the Conditional Formatting Command for Multiple Rows

Steps

Select the range of cells D5:F10.

select the range of cells to apply conditional formatting

From the Home tab, go to Conditional Formatting > Manage Rules.

select conditional formatting on multiple rows in excel

The Conditional Formatting Rules Manager dialog box will pop up. Click on New Rule.

click on new rules

In the New Formatting Rule dialog box, select Use a formula to determine which cells to format. Enter the following formula:

=D5=LARGE($D5:$F5,1)

This formula will return the 1st largest value of the three months. Click on Format.

type formula to apply conditional formatting independently in excel

 From the Format Cells dialog box, select Fill menu. Choose any fill colors. Click OK.

format your cells with your fill color

  We have set our formula and fill color. Click on OK.

rules and formulas to apply conditional formatting in excel

Check the Stop IF True checkbox. This is important as it will make sure that our formula will work only for rows independently. Click on New Rule to add more formulas.

mark the checkbox stop if true

Create two more rules like the previous rule. These two rules will return 2nd and 3rd highest values respectively.

The formula for 2nd highest value is:

=D5=LARGE($D5:$F5,2)

conditional formatting on multiple rows independently another formula

The formula for 3rd highest value is:

=D5=LARGE($D5:$F5,3)

conditional formatting on multiple rows independently in Excel

We have set all the formats and formulas. Remember to mark the checkboxes.

all the formulas and fill color format is set

Click on OK. The desired output will be displayed as shown in the following image.

conditional formatting on multiple rows independently in Excel result

 

Read More: How to Apply Conditional Formatting to Multiple Rows


Method 2 – VBA codes for Multiple Rows Independently in Excel

Steps

Select the range of cells D5:F5.

select range of cells to apply conditional formatting in excel

From the Home tab, go to Conditional Formatting > Manage Rules.

select conditional formatting command from home tab

In the Conditional Formatting Rules Manager dialog box, click on New Rule.

click on new rules

In the New Formatting Rule dialog box, select Use a formula to determine which cells to format. Enter the following formula:

=D5=LARGE($D5:$F5,1)

This formula will return the 1st largest value of the three months. Click on Format.

type formula to apply conditional formatting independently in excel

  From the Format Cells dialog box, select Fill menu. Choose any fill colors. Click OK.

format your cells with your fill color

  We have set our formula and fill color. Click on OK.

rules and formulas to apply conditional formatting in excel

Check the Stop IF True checkbox.

formula is set to apply

Create two more rules following the steps for creating the first rule. These two rules will return 2nd and 3rd highest values respectively.

The formula for 2nd highest value is:

=D5=LARGE($D5:$F5,2)

conditional formatting on multiple rows independently another formula

The formula for 3rd highest value:

=D5=LARGE($D5:$F5,3)

conditional formatting on multiple rows independently in Excel

We have set all the formats and formulas. Remember to check the checkboxes.

all the formulas and fill colors are set

Click on OK. It will format the first row with 3 color scale.

3 color scale conditional formatting on multiple rows independently in excel formatting

Press  Alt+F11  on your keyboard to open the VBA Editor. Select Insert > Module.

insert module for VBA codes

Enter the following code:

Sub format_all_rows()
Dim rng As Range
Dim r As Long
Set rng = Selection
rng.Rows(1).Copy
For r = 2 To rng.Rows.Count
  rng.Rows(r).PasteSpecial Paste:=xlPasteFormats
Next r
End Sub

Save the file. Select the range of cells D5:F10.

select the range of cells

Press  Alt+F8  to open the Macro dialog box. Select format_all_rows.

macro dialog box to apply conditional formatting

Click on Run. The output will display the dataset with conditional formatting on multiple rows independently as shown below.

conditional formatting on multiple rows independently in excel

 

Read More: How to Apply Conditional Formatting to Each Row Individually


Things to Remember

To implement these methods, always check the “Stop If True” checkbox. It will ignore other rules when our data meet the conditions.

This VBA code will generate the same rule for each row. So, if your dataset is large, it may slow down your process.


Download Practice Workbook


Related Articles

<< Go Back to Conditional Formatting Rows | Conditional Formatting | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
A.N.M. Mohaimen Shanto
A.N.M. Mohaimen Shanto

A.N.M. Mohaimen Shanto, a B.Sc. in Computer Science and Engineering from Daffodil International University, boasts two years of experience as a Project Manager at Exceldemy. He authored 90+ articles and led teams as a Team Leader, meticulously reviewing over a thousand articles. Currently, he focuses on enhancing article quality. His passion lies in Excel VBA, Data Science, and SEO, where he enjoys simplifying complex ideas to facilitate learning and growth. His journey mirrors Exceldemy's dedication to excellence and... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo