Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. 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

Written by Allen Wyatt (last updated April 19, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


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, 2013, 2016, 2019, and Excel in Microsoft 365. 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

Pasting a Comment into Your Document

When developing a document, you may end up with all sorts of comments that you need to deal with. One common task is to ...

Discover More

Creating Custom Underlines

Word provides a wide assortment of underlines that you can apply to your text. If the assortment isn't wide enough for ...

Discover More

Preserving the Undo List

The undo list can be a lifesaver when working in a macro. Unfortunately, the undo list is not preserved when you run a ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Performing Calculations while Filtering

The advanced filtering capabilities of Excel allow you to easily perform comparisons and calculations while doing the ...

Discover More

Copying the Results of Filtering

Filtering is a great asset when you need to get a handle on a subset of your data. Excel even makes it easy to copy the ...

Discover More

Entering a Date in a Filter

The filtering capabilities of Excel can come in handy for zeroing in on the data you want to work with. When your data ...

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

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}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. 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 one less than 9?

2024-04-21 04:19:19

Philip

Note that if you want to use Custom Views to save your "filtering" as described in the tip, this will only work with workbooks that have NO TABLES in them (I am referring to the "Table" formatting of cell ranges). For some inexplicable reason, Microsoft has ignored to fix this for the past 10-20 years or so ... rendering the Custom Views functionality basically useless in most work environments I've come across.


2020-09-14 18:53:12

Roy

If you just want to LOOK at the data, but without the exraneous content in some columns (OR want to allow various users to just look at some columns, not all), and make NO changes, the following will work in a filtering manner:

=INDEX(A1:E5,SEQUENCE(COUNTA(A1:A5),1),K1:M1)

where A1:E5 is your data and column A has entries in every row. The range K1:M1, or larger or smaller, has the column numbers you want to show. It will also control the order in which the columns are displayed if that is a good thing (or a bad thing to remember). By the way, using INDEX() this way allows it to be the lookup range for a VLOOKUP() that has to "look left" as you can use it to reverse the order of the two relevant columns. If K1:M1 had 1..4..5, you'd get columns 1, 4, and 5 in that order. If it had 5..1..4, you'fd get them in THAT order.

So insert columns between any two columns by inserting a column, etc. with adding past the rightmost being a little tricky with inserting, then copying the moved value to the newly inserted cell and editing the new last cell. Tricky-ish, but easy-ish.

So, look, but don't edit.

Again though, you can give people viewing access and control their rights very finely — you'd just need a new range of cells to hold each user's unique column rights. Copy a standard one, and edit. If you build a bit of automation so that actual editing is done via forms, not in the material presented like this, they can edit too. One could even set this up as a middle step they never have access to and use FILTER() to present the table they are allowed to see to them, which would allow setting up row filtering via the function rather than via the filtering capability. Everyone would have their own view though so using the filtering capability would not disrupt others, nor sorting their third level view. The forms controlling the editing would keep your rules and concerns paramount since you'd be writing them, controlling how they were carried out, not the user.


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.