Excel2016 Sorting Filtering
Excel2016 Sorting Filtering
[email protected]
Excel 2016: Large Data 1 - Sorting and Filtering
1.5 hours
In this workshop, we will work with single and multilevel sorting; learn to use data
filters to automatically show only the specified data set; and do math on our
filtered data sets. This workshop also contains a very brief introduction to other
summary tools such as Subtotal and Pivot Tables. This intermediate workshop
assumes prior experience with Microsoft Excel.
Updated 03/22/2019
Sorting Data
On the far right side of the Home tab, you will find a large Sort & Filter
button. The menu you see when you Click on the button is reflected in
the Sort & Filter group of the Data tab.
If you make a selection of cells, Excel will think you only want to sort or
filter by that selection. But if your
dataset has no blank rows and no
blank columns Excel will see the
whole range as one data set.
You can have blank cells, but not completely blank columns/rows; if
you are not sure that your dataset is consistent, Click inside one cell, and press Ctrl-A. This will select all
the cells within the dataset. A second "Ctrl-A", or pressing the shortcut in an empty cell, will select the
entire sheet.
When you have completed a sort, you can Click the Undo button (or Ctrl-Z). Excel will undo the sort and
it will select the dataset it used in the sort. This is another way to see your dataset.
Ascending Sorts
- Text: Sort alphabetically from A to Z
- Numbers: Sorts from smallest number to largest number
- Dates: Sorts from the newest date to the oldest date
Descending Sorts
- Text: Sort alphabetically from Z to A
- Numbers: Sorts from largest number to smallest number
- Dates: Sorts from the oldest date to the newest date
Custom Sorts
When you first open this window, Excel will show the most recent sort options. If you haven't created a
sort yet, this window may be blank.
In Excel 2016, we can sort by 64 levels. From this sort window we can add levels, delete levels, copy
levels, and even change the order of our sort using the up and down arrows in the toolbar.
1
Column: The column drop-down menu will show the names of your columns, your 'fields'. If your data
does not have titles, Excel lists the column heading letters instead. If you were expecting titles, but is
only showing the column letters, you can Click on the check box in the upper right hand corner of the
Sort window to let Excel know your data has headers.
Sort On: You can Sort on the values of the cells, the cell colors, the font
colors, or the cell icons.
Order: The order options change depending on the values in the cells.
Custom Lists
Custom lists can be built through the
Excel Options under the File menu in
the Advanced section under General.
Or by choosing Custom List… option at
the bottom of each order box above.
Sort Options
- Case sensitive: Sort lowercase letters before uppercase letters
- Orientation: Sort vertically (top to bottom, sort rows) or horizontally
(left to right, sort columns)
2
Filtering Data
Filters hide rows (records) based on criteria you set. You can turn the filter on
and off by choosing Filter from the Sort & Filter button on the Home tab, or
choosing the Filter button on the Data tab.
Excel will place a drop-down arrow at the end of each cell in the title row
(the first row of the dataset). When you Click on this arrow, we see several
options including our sort orders:
Sort Ascending, Descending, and by color
Clear the Filter
Filter by Color
Set a custom filter (text, number, date)
Search for a matching value in the column
List of values in the column (field). Select All will toggle
between everything and nothing.
Once a filter has been set Excel will hide all the rows that do not match the criteria. The status bar will
show how many records (rows) were found that matched. The row numbers of the original data will
remain the same, but will appear blue. The dropdown arrows of the columns that are being filtered will
show the filter icon (funnel). The double line between the row numbers indicate hidden rows.
3
Custom Filters
Depending on the data in the column, you will have the option to set a custom filter based on text,
numbers, and dates.
If you choose one of the options on the Filter List with the ellipsis (…), you
will see a Custom Auto Filter window such as this. From here, we can set up
to two filters.
Be careful with the AND/OR relationships. If you ask Excel to show the rows where the City equals
Jacksonville AND the City equals Gainesville, you will get no results, because one cell cannot equal both
values. However, if you ask for the same using the OR, Excel will show all the records for both cities. Or's
tend to work for exact matches (Equals This OR Equals That), whereas AND's tend to work for ranges
(Greater than This AND Less than That).
You can use the "Wildcards" ? and * to help you with your filter. ? is used for one character, * for
multiple.
Equals Jacks* -> Jacksonville, Jacksonville Beach, Jackson Heights
Some of the filter choices may work just as well. I could say Contains 'Jacks' or Begins with 'Jacks'.
4
SUBTOTAL Worksheet Function
We can do common mathematical functions with our filtered lists using the SUBTOTAL worksheet
function. The syntax is for this function is "SUBTOTAL(function_num,ref1,ref2,...)". Function_num is the
number 1 to 11 that specifies which 'function' to use in calculating subtotals within a list (see below).
The ref1, ref2… are the ranges of data that should be used in the equation, there can be up to 29
different ranges used in this function.
Function_Num Function Function_Num Function
1 AVERAGE 7 STDEV
2 COUNT 8 STDEVP
3 COUNTA 9 SUM
4 MAX 10 VAR
5 MIN 11 VARP
6 PRODUCT
Function numbers 1 through 11 will include manually hidden rows, ones you have hidden yourself.
Function numbers 101-111 will exclude your hidden rows from the function. Filtered-out rows are
always excluded.
5
Other Summary Tools
Subtotal Outlines
One way to sum up a large set of data is to use the
Subtotal tool in the Outline group of the Data tab. This
tool will total sets of related data and insert a subtotal
row into the sheet at each change in the column of your
choosing. It will also create a grand total at the bottom
of the dataset.
Pivot Tables
Another amazing summary tool built into Microsoft
Excel is the Pivot Table. You will find this button at the
beginning of the Insert tab.
6
Class Exercise
Simple Sorts
- Click in the title CITY in cell D1
- Home Tab -> Sort and Filter -> Sort A to Z (ascending)
- Undo
- Sort is "undone" and data set that was sorted is selected
- Select Column D (city)
- Home Tab -> Sort and Filter -> Sort A to Z (ascending)
- Say OK to the message
- Undo
7
Custom Sort - Multiple levels
- Click on the large sort button on the Data tab
- Set the sort order for CITY, BALANCE, and DUE DATE
- Use the Add Level buttons to create new lines
- View the Results
8
Custom Sort - by Color
- Open the Custom Sort window
- Sort by Address, Sort on Cell Color, Order Green "On Top"
- Copy Level and set the Order to Peach "On Top"
- Add Level -> Balance, smallest to largest
9
Custom Sort - Left to Right
- Select Row 2, and Insert a row
- Number the cells: 3, 8, 4, 7, 1, 2, 5, 6
10
Start over
- Exit Microsoft Excel
- DO NOT SAVE
Instant Filter
- Open SortCustomers.xlsx
- Right-Click on a city of Waldo
- Choose Filter -> Filter by Selected Cell's Value
Filter by Unchecking
- Click the large Filter button on the Data tab
- From the City drop down, uncheck Jacksonville, Click OK (67 records)
- From the City drop down, uncheck Gainesville, Click OK (12 records)
- From the City drop down, check Select All, Click OK
11
Filter by (Un)Select all
- from the Zip drop down
- uncheck Select All
- check 32608
- Click OK (12 records)
Date filter
- Due Date drop down
- uncheck Select All
- use the expand (+) buttons to open the dates
- check the first three months of 2016
- Click OK (11 records)
12
Custom text filter
- From the Last drop down, choose Text Filter
- Choose Begins with, type J
- Click ok (10 records)
Search filter
- From the Address drop down, Click inside the Search box
- Type box
**** Type it slowly, one letter at a time to see the list
get smaller as you go
- Click ok (12 records)
- Clear the filter
13
Filter by Color
- From the Address drop down, choose Filter by color
- Choose the green addresses (13 records)
- Clear the filter
14
Filter on one data set
- Move to Cell A1 (Ctrl Home)
- Turn on the filter
- From the City drop down, uncheck Gainesville
- Click ok (4 records)
****Gainesville only disappears from the first list because of the gap
- Turn off the filter
Start over
- Exit Microsoft Excel
- DO NOT SAVE
15
Set up Grand Total
- Open file SortCustomers.xlsx
- Turn on the Filter
- Go to Cell H79, Type SubTotal
- Go to Cell H80, Type Total
- Go to Cell G80, press the AutoSum button ∑ (on the Home or Formulas tab)
- Modify equation to stop at row 78
**** =SUM(G2:G78)
- Result: $23,192.00
Set up SubTotal
- Return to the top of the worksheet (Ctrl-Home)
- Set City filter to show only Waldo
- Go to Cell G79, press the AutoSum button ∑
**** See Page 5 for details on the SubTotal Worksheet Function
- Result: $2,325.00
- From the City drop down, set it so you can only see Jacksonville
- Result: $3,506.00
- From the City drop down, set it so you can only see Gainesville
- Result: $16,071.00
Start over
- Exit Microsoft Excel
- DO NOT SAVE
16
SubTotal Worksheet Function Exercise
- Open file SortSales.xlsx
1) Insert four rows at the top of the worksheet
a. Select the first four rows
b. Right-Click inside the select and choose INSERT
You have to go above and below the showing numbers so that you include all the hidden cells!
If you only use E43:E49 you will lose all the data currently hidden.
7) Clear the filter, the numbers in Column E should match the numbers in Column B
17