Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to quickly shade alternating filtered rows in Excel?

To improve the readability, some people may apply shading color to every other row in Excel. The conditional formatting can help you quickly solve this. For more detailed information, please visit: How to shade alternate rows in Excel?

But, if you need to shade alternating filtered rows in Excel, you can quickly apply shading color to the filtered rows in Excel as follows:

Shade alternating filtered rows with Conditional Formatting
Too complicated!

Shade alternating filtered rows with VBA code
For advanced users!

Quickly shade alternating filtered rows with Kutools for Excel
Simple, easy for all users!


arrow blue right bubbleShade alternating filtered rows with Conditional Formatting


By doing this, you should do with two major steps:

A: Shade the range alternately (step1-step5)

B: Filter the data you need, the shading will automatically change (step6-step9)

1. Select the range that you want to shade. If filtering is already in play, be sure to remove the filter to select the full range. In this example, we will select the range (A2:G25).

doc-shade-filtered-data1

2. Then click Home > Conditional Formatting > New Rule, and a New Formatting Rule dialog box will appear.

3. And click the last option Use a formula to determine which cells to format in Select a Rule Type, and enter this formula “=MOD(SUBTOTAL(3,$A$1:$A2),2)” into the box.

doc-shade-filtered-data2

4. Then click Format button, and a Format Cells dialog box will pop out. Click Fill, and select a color you like. See screenshot:

doc-shade-filtered-data3

5. And click OK, it will return to the New Formatting Rule, and now you can see the color in the Preview box. Then click OK. And the range which you select has been shaded alternately.

doc-shade-filtered-data4

6. Finished the above steps, now you need to filter the date. Click Data > Filter, Excel will add drop-down arrows to the column headers.

doc-shade-filtered-data5

7. Then you can choose the criteria you need. In this example, I will filter the customer name is Minimall. Put the cursor at the Customer drop down arrows and click it, a menu will appear, choose Text Filters > Contains… see screenshot:

doc-shade-filtered-data6

8. And a Customer AutoFilter dialog box will pop out. Enter Minimall in the contains box.

doc-shade-filtered-data7

9. And then click OK. All of the filtered rows have been shaded alternately. See screenshot:

doc-shade-filtered-data8


arrow blue right bubbleShade alternating filtered rows with VBA code

The first method is somewhat complicated, and the following VBA code can help you quickly to shade filtered rows alternately.

Supposing you have filtered the data, see screenshot:

doc-shade-filtered-data9

1. Click Developer>Visual Basic, a new Microsoft Visual Basic for applications window will be displayed, click Insert > Module, and input the following code into the Module:

VBA: alternately shading the filtered rows

Sub ShadeRows()
'Updateby20140529
Dim Rng As Range
Dim WorkRng As Range
Dim shadeIt As Boolean
shadeIt = True
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng.Rows
    If Not Rng.EntireRow.Hidden Then
        Rng.Interior.ColorIndex = _
        IIf(shadeIt, 15, xlNone)
        shadeIt = Not (shadeIt)
    End If
Next
End Sub

2. Click doc-multiply-calculation-3 button to execute the code, a KutoolsforExcel dialog pops out for you to select a range to shade. See screenshot:

doc-shade-filtered-data-13

3. Then click OK. And the filtered data have been shaded alternately. See screenshot:

doc-shade-filtered-data10


arrow blue right bubbleQuickly shade alternating filtered rows with Kutools for Excel

Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. Get it Now .

With Kutools for Excel, you can easily and quickly to shade alternating filtered rows. You can get it done by following these steps:

1. Select the filtered data that you want to shade.

2. Click Kutools > Format Tools > Alternate Row Shading, see screenshot:

doc-shade-filtered-data-14

3. Then check Rows option from the Shade type in the Alternate Row/Column shading dialog box, and choose one color you like in the Shade color drop-down list, then check Conditional formatting from the Color method, at last choose number 1 from Shade every spin button. See screenshot:

doc-shade-filtered-data11

4. And then click OK. The filtered data have been alternately shade. See screenshot:

doc-shade-filtered-data12


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Phil Elliott · 2 years ago
    The KUTOOLS method does not work for me on filtered data. I receive a dialog saying "This feature cannot process filtered data, please clear filter first."