Excel 2007: Working With Lists (Sorting, Filtering and Using Subtotals)
Excel 2007: Working With Lists (Sorting, Filtering and Using Subtotals)
subtotals)
Sometimes an Excel spreadsheet has lots of data in columns and rows. Columns have headings at
the top and each row contains the same kind of data. Excel calls this a list. Lists are made up of
fields (the columns). Fields combine into records (the rows) to make the list.
Some important things about lists:
The column headers, also called the field names, must be formatted differently from the rest of
the records. This can be as simple as using all caps, or adding bold or italics. This allows Excel
to recognize the field names and treat them differently from the records.
There should be no blank rows in the list. There may be blank cells where you may not know
the data (example: a persons age), but dont insert blank rows just to make it look good.
Each field in the record should be consistent. Age would always go in the age column, address
in the address column, etc.
Data should be consistent. Decide ahead of time on abbreviations. If you use Georgia, GA and
Ga., you wont be able to filter the data.
Be careful when you are entering the records. Leading and trailing spaces, such as a word
followed by a space, are hard to find and will cause sorting to change.
Here are the first few rows of an Excel list:
Because of their size, it can be hard to get any useable information out of lists. Sorting, filtering,
pivot tables, and adding subtotals can make lists more useable. This handout will cover sorting,
filtering and subtotals. Pivot tables will be covered in another lesson.
Sorting by one field
Excel can sort by one field or on multiple fields at one time. In the example, you could sort by
rank, then by name or by sex, then rank and name.
To sort by one field, click on any cell in that field
Click on Sort & Filter in the Editing group on the Home tab A-Z or Z-A or
Click on the Data tab and A-Z or Z-A in the Sort& Filter group.
Note: Sorting A-Z on values will produce smallest to largest; sorting A-Z on dates will produce
oldest to newest.
If your column headers have been formatted differently from the rest of the records, they will
NOT be included in the sort and will remain at the top of your list.
In this example, the list has been sorted by Salary, A-Z (smallest to largest)
Note the selection box on the far right for my data has headers. It is checked because Excel
picked up on the fact that our list had a header row (since it was formatted differently from the
rest of the records).
Since the last sort performed was on the Salary column, the Sort window still shows that choice.
To add additional sort fields, click on Add Level.
Select the sorting field on each level by clicking on the down arrow to the right of the Sort by
text box.
This example shows the Sort for Sorting by Department (A-Z), then by name (A-Z).
For both fields, the Sort On was set to Values. Other choices are Cell Color, Font Color and Cell
Icon.
Order choices are A-Z, Z-A and Custom List.
Options include Case Sensitive, Sort top to bottom (default) and Sort left to right.
Click on OK in the bottom right corner to perform the sort.
Here is the result of the sort:
Since Excel remembers your previous sort, be sure to delete sort fields that you dont want to use
again by clicking on Delete in the Sort window.
Sorting using a custom list
In the example, if you sort by Rank, the list will be sorted Associate, Full, Part-Time, which is
alphabetical. Colleges usually rank professors Part-Time, Associate, Full. You can change the
sort by creating a custom list. You must create the custom list first then use it in the sort.
Click on the Microsoft Office button.
Click on Excel Options, then select Popular.
Click on Edit Custom Lists. The Custom Lists window should appear.
Click in the List Entries box and key Part-Time, Associate, Full. Be sure to include the commas
and be sure to spell everything correctly.
Click on Add. The new Custom List will appear in the Custom Lists box on the left.
You can also edit or delete custom lists in this same window.
Clayton State University Center for Instructional Development
Updated 2009 Helen L. Brackett
To sort using the custom list, click on the Home tab, Sort & Filter in the Editing Group, Custom
Sort or click on the Data tab, Sort in the Sort & Filter group. Either one will return you to the
Sort window.
You will only need one sort level for this sort, so click on any additional levels and delete those
levels.
In the remaining row, select Rank in the Sort by box and Custom List in the Order box.
Select Part-Time, Associate, Full from the Custom List window and click ok.
Filtering
It would be helpful to remove records that dont meet certain criteria from the list temporarily.
You can do this with a filter. Filtering does not remove any of your records permanently, just
temporarily. The easiest way to apply a filter is to change the list to a table.
Make sure that your active cell is somewhere inside the list then click on Insert, Table.
A window will open to confirm the range of the table. If it is not correct, change the range, then
click on OK. The table appears formatted and with filter arrows in the top row.
To filter, click on an arrow and deselect the records you dont want to see. You can filter more
than one field at a time.
In this example, a filter has been applied to show only the males and only those records in the
Business department. Notice the filter icons on both the Sex and Department columns and the
blue row indicators with rows missing. These two things indicate a filter has been applied.
To remove a filter, click on the filter icon at the top of the filtered column and select clear filter.
Do this for each column that has a filter applied to set the list back to all records.
You can also do special filters for numbers and text.
If youd like to see all records with salaries greater than $60,000, first remove all filters, then
Click on the filter arrow on the salary column.
Select Number filter, greater than.
The custom autofilter window appears. Enter 60000 in the text box on the right.
You can add a second condition by selecting the And or Or button and selecting a condition from
the drop down arrow. If you select And, both will have to be true for the record to be returned in
the recordset. If you select Or, if either condition is true, the record will be returned in the
recordset.
The recordset shows:
Only two records have salaries greater than $60,000. Note that the filter icon at the top of the
column indicates a filter has been applied, as do the blue row indicators.
Using the total row
Clayton State University Center for Instructional Development
Updated 2009 Helen L. Brackett
While the table tool is applied you can also use the total row tool. If youd like to see the
average salary, for example, or how many records there are, use the table tool.
Make sure your active cell is somewhere in the table. Click on Design on the Table Tools tab.
Select Total Row in the Table Style Options group. Scroll to the bottom of the table. A total
appears just below the Salaries. The default is Sum, but if you click on the cell, a down arrow
appears that allows you to change the function. You can also copy the total cell to the other
columns on that row and then change the functions on those cells.
Turn off the total row by clicking on Design on the Table Tools tab and deselecting Total Row in
the Table Style Options.
Converting the list from a table to a range
Some tools, like Subtotal, require that the list NOT be in table form.
To remove the table and change the list to range, make sure your active cell is someplace inside
the table then
Click on Design on the Table Tools tab.
Click on Convert to range in the Tools group. Click Yes when asked if you want to convert to a
normal range. Formatting such as alternating row colors will remain after the table has been
converted to a range. This can be removed by selecting the rows and selecting Clear, Formatting
in the Editing group on the Home tab.
Subtotals
Subtotals is one more tool for working with lists of data. Subtotals can be used to show three
levels: details, subtotals and grand totals. You can also use subtotals to calculate averages, sums,
etc. on each field.
NOTE: You must sort a field BEFORE you subtotal it.
Supposed you would like to count the number of employees in each department. Sort by
department first, then:
Make sure your active cell is somewhere in the list.
Click on Subtotal in the Outline group on the Data tab.
In the Subtotal window, select from the list arrows: At each change in DEPARTMENT, use the
COUNT function. Select the Department field in the Add subtotal to area and deselect any other
fields. Click on OK.
Note the count in the department column where the department changes from Business to
English. This is why you have to sort first! The subtotal appears at each change.
The 1, 2, 3 at the top left corner controls the levels. Level 3 shows all the records, the subtotals,
and the grand total; level 2 shows only the subtotals and the grand total; level 1 shows only the
grand total.
To remove subtotals, click on Subtotal in the Outline group on the Data tab, Remove all.