Filter By Rows, Instead of Columns

Guzzlr

Well-known Member
Joined
Apr 20, 2009
Messages
860
Hello All,
I often use colored cells to filter by column. For example, column A may have 30 cells colored blue, then i can easily filter by that color to get those particular cells in Column A.
But wonder if I want to do the same filter technique with colored cells, only by Row, instead of by Column.
For example, if Row 2 has some cells colored, then how can i set a filter on Row 2, to just filter for those individual colored cells?
Thanks for the help
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
10,799
Office Version
  1. 2013
  2. 2010
Platform
  1. Windows
There is no built-in feature in Excel to filter by rows so you need a macro. This macro assumes that row 2 contains data as well a color fill.
VBA Code:
Sub filterColors()
    Application.ScreenUpdating = False
    Dim lCol As Long, x As Long
    lCol = Cells(2, Columns.Count).End(xlToLeft).Column
    For x = lCol To 1 Step -1
        If Cells(2, x).Interior.ColorIndex = xlNone Then
            Columns(x).Hidden = True
        End If
    Next x
    Application.ScreenUpdating = True
End Sub
 

JLGWhiz

Well-known Member
Joined
Feb 7, 2012
Messages
12,979
Office Version
  1. 2013
Platform
  1. Windows
You cannot currehtly set an Excel filter to filter on rows based on column content. The current capability is to filter on Columns, based on row content.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,151,821
Messages
5,766,641
Members
425,365
Latest member
MrLupin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top