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


1

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

Finding Cells Filled with a Particular Color

Do you need to find cells that are formatted with a particular color? How you accomplish this task depends on your ...

Discover More

Printing Rows Conditionally

Need to only print out certain rows from your data? It's easy to do if you apply the filtering or sorting techniques ...

Discover More

Turning Off the 'Welcome Back' Notice

When you open a document that you previously edited, Word displays a message the right side of the screen about jumping ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

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

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

Discover More

Filtering Based on Comparing Two Cells

Filtering can be very helpful in allowing you to see only those data records that meet certain criteria. In this tip you ...

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 6 + 5?

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.