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

Formula Shows Instead of Formula Result

When you enter a formula in a cell, you expect Excel to display the result of that formula once you are completed. If ...

Discover More

Inserting Footnotes Using Custom Footnote Marks

Automatic footnotes are easy to insert in Word documents. The default settings are usually fine for most projects. ...

Discover More

Picking a Group of Cells

Excel makes it easy to select a group of contiguous cells. However, it also makes it easy to select non-contiguous groups ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Showing Filter Criteria on a Printout

When you print out a filtered worksheet, you may want some sort of printed record as to what filtering was applied to the ...

Discover More

Finding Rows with Values in Two Columns

When you use Excel to input and store information, you need to be concerned with whether the information meets your ...

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
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 two more than 7?

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.