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

Comments Don't Appear when Cell is Pointed To

One way that you can view comments in a worksheet is to have them appear when you hover the mouse pointer over a cell. If ...

Discover More

Separating Evens and Odds

If you have a series of values in a column, you might have a need to separate the values into even values and odd values. ...

Discover More

Changing an Invalid Autosave Folder

Excel allows you to specify where it stores various files used by the program. One location you can specify is where ...

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)

Enabling Filters by Default

Filtering can be a powerful way to work with large amounts of data in a worksheet. If you use filtering quite a bit, you ...

Discover More

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 ...

Discover More

Performing Calculations while Filtering

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

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.