Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Filtering Columns.

Filtering Columns

by Allen Wyatt
(last updated February 2, 2017)

2

Mayur knows that he can use Excel's filtering capabilities to select which rows in a data table are displayed, but wonders if there is a way to filter by column. In other words, he can now filter vertically, but he would like to filter his data horizontally.

The short answer is that there isn't a way. Excel, when used to store data, follows a database paradigm that equates rows with records and columns with fields in each record. Classical filtering is done by examining values in columns (fields) and thereby determining which rows (records) should be displayed based on what is found there.

The easiest way to filter your data the way you want is to transpose it before filtering. Copy all your data (select it and press Ctrl+C), and then on a different worksheet use the Transpose option of Paste Special. You can display this dialog box by starting at the Home tab of the ribbon, clicking the down-arrow under the Paste tool, and then choosing Paste Special.

Once your data is transposed (rows become columns and columns become rows), you can then use Excel's built-in filtering tools as you normally would.

If you prefer to not transpose your data, you will need to resort to less automatic solutions. For instance, you could manually figure out which columns you want to hide ("filter out") and then actually hide those columns. When you are done hiding all the columns you want hidden, you could define a custom view (as described in other ExcelTips) to save how the worksheet appears.

Finally, you could always create a PivotTable from your data. You can then, in the PivotTable, use the filtering tools to determine what data is shown in the table. The tools there will work on both row fields and column fields.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12918) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Filtering Columns.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Adjusting Spell Check for Internet Addresses

When you check the spelling of worksheet data, you may want to spell checker to either ignore or check Internet addresses ...

Discover More

Periodically Delete TMP Files

After using Word for a while, you may notice some "litter" of unused files on your hard drive. This tip explains how those ...

Discover More

Controlling Names of Backup Files

Want to control the name and location of your document backup? Here are some ideas that may help.

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

MORE EXCELTIPS (RIBBON)

Using a Filtered Value in a Formula

Accessing filtering criteria for use in a formula can be a real need for some worksheet designs. Getting to that information ...

Discover More

Skipping Rows when Filling

Using the fill handle is a great way to quickly fill a range of cells with values. Sometimes, however, the way to fill cells ...

Discover More

Removing Duplicates Based on a Partial Match

Some types of data may have certain fields that contain partially identical information. In such cases you may want to delete ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments for this tip:

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 9?

2017-02-02 07:19:13

Alan

Sicco - I use this simple piece of code to hide columns (I find it particularly useful for chart data, especially when you don't want a series to appear). It works on whether the value in the named range is True or False.

Private Sub Worksheet_CHide()
For Each cell In Range("NamedRange") 'edit if not correct range
Select Case cell.Value
Case False
cell.EntireColumn.Hidden = True
Case True
cell.EntireColumn.Hidden = False
End Select
Next cell
End Sub


2017-02-02 07:00:07

Sicco Jan Bier

Would it be possible to have a top row with some formula, that puts O/I in the first cell by some logic, and a macro that hides columns with O or I?
I stay away from macros as much as I can, but the idea might trigger others to solve their filtering issue.

For vertical filtering this is also easy: to combine conditions of multiple columns in a single field value, and apply standard filtering in that column to collaps all at once.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.

Links and Sharing