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.
Written by Allen Wyatt (last updated April 19, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365
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.
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!
When you print out a filtered worksheet, you may want some sort of printed record as to what filtering was applied to the ...
Discover MoreWhen you use Excel to input and store information, you need to be concerned with whether the information meets your ...
Discover MoreFiltering 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 MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments