Using The Two Powerful Tools Of MS Excel
Data analysis and summary creation is one of the most common task that MS Excel is used for in offices. Many departments work with raw data for which meaningful results are required, like sales data, students' mark sheets, budget-related information, survey results, inventory lists, customer data and other similar stuff.There are two very powerful functions in Excel that can greatly speed up data summarisation for such common scenarios - Advanced Filters and Pivot Tables. These features are often thought to be complex and are not used as frequently as they should have been, resulting in manual formula-based work to achieve similar results, and that too after taking a lot of productive time with dependency on manual updates every time the base data changes. But in fact, these are simple enough techniques to get started with. Now lets take a look at Advanced Filters.
To apply Advanced Filters, let us work with a short sample data of customers who made some purchases at a store. The store generates a file of customer ID, name, age, location and purchase amount information and wants to apply some filters to segregate customers matching a given criteria. Most of us would recall the Data > Filter > Auto Filter command that provides dropdowns at sheet columns through which one can specify a search criteria.
But there is a limitation: at the most only a combination of two criteria can be defined using the Auto Filter dropdown's last item ‘Custom'. For example, it is not possible to apply a filter that would show customers with age > 20, and location = tokyo, and purchase amount > 500 as this query has three criteria to be applied on the data.
This is where Advanced Filters comes in. We will use a sample data in a sheet where top two rows would hold our criteria, while the actual data appears below it. When using your own data, you can insert rows above your data to hold search criteria, or place the criteria fields at any convenient location in the sheet.
Sample Excel sheet with required criteria and sample data is shown in Fig. 1.
Note that the column heading in row 1 are for filter criteria, while column names in row 4 are for the actual data. Select the cells comprising the actual data, that is, from A4 to E8 and go to Data > Filter > Advanced Filter menu. Advanced Filter dialogue box appears.
The Action section by default is set to filter the list in-place. Leave it as it is for now. See that our selected data range appears automatically in the List Range field. Next field, Criteria Range, is blank - and as you may have guessed, we will select our criteria fields in the top two rows here, column labels and criteria both, using the browse button (showing cell selection icon) at the right-hand side of this field. Make sure you select only those columns that contain filter criteria. These are age, location and purchases columns (from C1 to E2), that is, columns C, D and E.
Press OK. The data set now reduces to show only customers with ID 3 and 4 as these are the only customers that fulfil the entered criteria.
There a few nothings to note here. First, there is no very apparent visual indication that an Advanced Filter has been applied. Though the rows get hidden and row numbers would be missing, one may assume that those rows have been manually hidden or a user can overlook it completely.
Second, if criteria fields are changed in the top rows, the filtered data would not automatically update itself to reflect the changes. That is to say, it is not a dynamic functionality. User must explicitly go to Advanced Filter menu and press OK again to make changes take effect. This is why no data entry should be made in the actual data when there are filters applied to ensure consistency in subsequent formula usage.
To show all the data again, go to Tools > Data > Show All. Or, after changing the criteria, go directly to Advanced Filter and press OK for the new criteria to take effect. At this point, you may experiment with ‘Copy to another location' option in Action section. This would ensure the actual data remains displayed as it is. Selecting this option makes ‘Copy to filed' enabled. Select the target top-left cell and rest is taken care of by Excel itself as the filtered data is displayed on the right and to the down of selected cell.
The real strength of Advanced Filter lies with the range of filter criteria that can be defined. For instance, wildcards can be used for searching text. This means, T* would search all cities starting with T, and for names, H?ssam would search Hassam and Hessam both, since ? means a character. Tilde ~ character can be used before ‘?' or ‘~' or ‘*' to specify these wildcards themselves.
Multiple criteria for a single column can be searched by adding criteria vertically, say under City, adding Tokyo and Sydney in next two rows would mean City = Sydeny or Tokyo. Note that our initial criteria was an and condition, that is, to show results where all three conditions are met. This can be converted to or condition, to show results where any of the three conditions are met, by writing each criteria in a new row. Also, conditions can be defined in a set.
There is a lot that can be done in this way particularly when combined with functionalities such as named data ranges to ease data selection.