Você está na página 1de 10

BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 8: Sorting & Filtering– Page 1 of 10

MS EXCEL 2003

SORTING AND FILTERING

SORTING AND FILTERING

Background Reading: Lists


In this section we will be working with Excel lists. In Excel, a list is a set of data, arranged in a certain
way. Many of Excel's important features for data analysis (e.g. filters, pivot tables) will not work properly if
data is not arranged as a list.
A list is defined as a rectangular range of cells on a worksheet. It has one or more adjacent columns and
two or more rows. It is separated from any other data on the worksheet by blank rows and columns.
An Excel list looks like a table in an Access database with its fields and records. The illustration shows a
very simple list. It consists of (1) a header row hold titles for the data, and (2) a data area.
For a list to work correctly,
• the header row cannot have an empty cell
• the data area cannot have any empty rows.

Header area
(cannot have any empty rows)

Data area
(cannot have any empty rows)

Sorting
Ex. 1

Basic sort on a list


1. Create a simple worksheet as illustrated. You do not have to type in
all the data. For each column, type the first three cells, then get
Excel to continue the series by highlighting the three cells, moving
your cursor to the bottom right corner until it changes to a black
cross, then dragging down.

2. Save as Sort_weekdaysMonthsNumbers.xls.
3. Click anywhere in Column B.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 8: Sorting & Filtering – Page 1 of 10
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 8: Sorting & Filtering– Page 2 of 10

MS EXCEL 2003

SORTING AND FILTERING

4. Click on the Sort Ascending button . Has the entire list been sorted correctly or only
Column B?
5. Undo the sort (Ctrl-Z).

How does Excel autoselect data?


6. Click in a cell near the bottom of the data area, such as B18.
7. Select Data / Sort. The Sort dialog button opens. Notice that Excel automatically selects the data
area.
8. In the Sort By box, select Column C.

9. Click on OK. Has Excel sorted correctly, keeping, for example, 1-Mon-Jan together?
10. Click Undo and Redo to see how Excel is sorting.
11. Delete cells A6:C6 in order to make Row 6 empty.
12. Click anywhere in the data above Row 6.
13. Select Data / Sort. What range has Excel automatically selected? How does Excel determine the
data area to select? (Remember the definition of a list.)
14. Click on Cancel.
15. Undo to replace the deleted data (or close the file without saving, then re-open it).
16. Delete only one cell in a row, then see the result in Sort / Data. Repeat with a few more empty
cells. Does Excel respond to several empty cells in a row or only to an entirely empty row? Undo
to get your original data back.

Summary: Excel autoselects a list.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 8: Sorting & Filtering – Page 2 of 10
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 8: Sorting & Filtering– Page 3 of 10

MS EXCEL 2003

SORTING AND FILTERING

How does Excel sort blank cells?


17. Delete the data in A14.
18. Notice the data in B14:C14. Sort by Column A. Notice where the data has been sorted to. Where
does Excel sort blank cells?

Ex. 2

The usefulness of header rows


Although Excel will sort data without a header row, you make the job
much easier for yourself by making sure that a header row is included.
The header row enables you to identify the contents of a column more
quickly and easily.
1. Open the given file named SortingFiltering.xls.
2. Click somewhere in the data area.
3. Select Data / Sort.
Notice that your options in the Sort by field are Column A, Column
B, etc.

4. Add header rows to the data as illustrated.

5. Select Data / Sort again. The Sort dialog box opens.


Excel highlights a data area. Can you explain why Excel automatically selects the data area
without including the header row?
Notice that the Sort dialog box has an option entitled My data range has Header row / No header
row.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 8: Sorting & Filtering – Page 3 of 10
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 8: Sorting & Filtering– Page 4 of 10

MS EXCEL 2003

SORTING AND FILTERING

Notice, too, that now your options in the Sort by field are Date, Amount, etc. This can be very
useful when working with a spreadsheet that has many columns of numbers, names, dollar
figures, and so on.

6. Select Sort by Date.


7. Click OK.

Multiple sorts
8. Use Data / Sort to sort the Budget worksheet by more than one column . Sort in ascending order
first by Department, then by Category.

9. The top part of your result should look like the illustration (the sorted columns have been
highlighted in the illustration).

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 8: Sorting & Filtering – Page 4 of 10
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 8: Sorting & Filtering– Page 5 of 10

MS EXCEL 2003

SORTING AND FILTERING

SORTING TIPS
Inserting a sequence column to restore the original order
• Be careful before you sort some lists. Check to make sure that restoring your data to its original
state will be simple. To avoid scrambling your data permanently, it might be a good idea to insert
an additional column into the list with ascending numbers (that is, 1, 2, 3, and so on) before
sorting the data. Create the numbers by “dragging down” a series, not with a formula such as
=A1+1.
Selecting ranges
• Do not select a column or a row in a List before sorting; instead, select only a single cell. Clicking
the Sort icon automatically sorts the entire List and the data will be sorted according to the
selected cell's field.
Formulas
• Be careful when sorting data if there are formulas in the cells. Sorting data linked by formulas to
other cells can distort the formula’s calculations.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 8: Sorting & Filtering – Page 5 of 10
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 8: Sorting & Filtering– Page 6 of 10

MS EXCEL 2003

SORTING AND FILTERING

Filtering
When Excel filters data, it displays only the information you need, hiding the rest.
Unlike sorting, filtering does not rearrange a list. Filtering simply hides rows you do not want displayed
and shows only those rows that meet the criteria you specify for a column.
Before you filter, it is useful to have headings in your columns, just as it was with sorting. Also, before
beginning, make sure that your cursor is placed in a cell inside the data area.
After a list has been filtered, the subset can be edited, formatted, charted, or printed. It does not have to
be rearranged or moved first.

Ex. 3

Basic AutoFilter
AutoFilter adds drop-down options to your column headers, enabling you to
use a variety of filter options on your data.
1. Click anywhere in the data area.
2. Select Data / Filter / AutoFilter to turn on AutoFilter.
Notice the drop down-arrows next to each column heading and the
options available when you click on a drop-down arrow.

3. Click on the down arrow at the top of Column B. Excel displays a list of all unique
items in the column, including blanks and all non-blanks.
4. Select $1,200.00. Excel instantly hides all rows that don't contain that value.
The signs that a filter has been applied are:
• the down-arrow for the filtered column is now blue
• some of the row numbers in the filtered
column appear to be missing (e.g. row #1 is followed
by row #20)
• some of the row numbers are blue.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 8: Sorting & Filtering – Page 6 of 10
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 8: Sorting & Filtering– Page 7 of 10

MS EXCEL 2003

SORTING AND FILTERING

Removing a single filter


5. To remove the filter, select All from the drop-down list. Or select Data / Filter, and de-select
AutoFilter.
6. Click on the down-row in Column C. Notice that the options are different from the options given
for Column B.
7. Become more familiar with basic filtering by applying the following filters one after the other,
removing the filter each time:
• Date: 9/15/2008, 11/6/2008
• Amount: $2,302.76, $81.61, $10,330.31
• Department: IT, Administration, Telephones
• Category: Payroll
• Authorized: Jones, Smith.

Removing multiple filters


8. Place filters on columns as follows:
• Column A: 10/15/2008
• Column D: Payroll
• Column E: Johnson
To remove all filters but leave the filtering down-arrows enabled, select Data \ Filter \ Show All. To
remove all filters and remove the AutoFilter down-arrows from the columns, select Data \ Filter \
AutoFilter.
9. Select Data / Filter / Show All. This leaves the filtering down-arrows enabled.
10. Repeat step 8 above to put filters back.
11. Select Data \ Filter and uncheck AutoFilter. This removes all filters and removes the AutoFilter
down-arrows from the columns.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 8: Sorting & Filtering – Page 7 of 10
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 8: Sorting & Filtering– Page 8 of 10

MS EXCEL 2003

SORTING AND FILTERING

Multiple filters
Once a filter has been applied, it is possible to apply an additional condition based on a value in
another column.

12. Use multiple filters on the Budget data to show only data where the Department is IT and the
Category is Equipment. Your result should be as illustrated.

AutoFilter Options
Ex. 4
Top 10 AutoFilter
The Top 10 AutoFilter enables you to quickly view the largest values in the
list.

But the Top 10 AutoFilter can do more than just show the "Top 10". For
example, it can show the top 10% as well as the top ten, or the bottom ten or
10%, or the top or bottom seven, eight, nine, eleven, twelve, etc..
The Top 10 AutoFilter is especially useful when analyzing numerical data.

1. Continuing with the same Budget worksheet used in previous


exercises, apply a filter to show the top fifteen items from the
Amount column.

2. Apply a filter to show the bottom 15% of values from the Amount column.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 8: Sorting & Filtering – Page 8 of 10
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 8: Sorting & Filtering– Page 9 of 10

MS EXCEL 2003

SORTING AND FILTERING

Ex. 5
Custom AutoFilter
Custom AutoFilter offers you great flexibility in filtering. For example, you can
filter for rows that contain either one value or another. Also, you are not
limited to using the “equals” operator; you can also use “greater than,” less
than”, etc.
13. Continuing with the same Budget worksheet used in previous
exercises, remove all filters if necessary.
14. We want to look at data for two dates: 11/14/2008 and 11/15/2008.
Click on the drop-down arrow for Column A.
15. Select Custom. The Custom AutoFilter dialog box opens.

16. Select Date equals 11/14/2008 Or equals 11/15/2008, as shown above.


Note: Because we want both dates, we use Or.
(Selecting And would filter for dates that are both 11/14/2008 and 11/15/2008; but, of
course, there are no such dates.)
17. Click OK.
18. The results are as illustrated below.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 8: Sorting & Filtering – Page 9 of 10
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 8: Sorting & Filtering– Page 10 of 10

MS EXCEL 2003

SORTING AND FILTERING

Practice with Custom AutoFilter


3. Filter for expenditures authorized by Smith or Johnson.
4. Remove the filter. Filter for expenditures for the first of September and the first of October.
5. Remove the filter. Filter for expenditures above $5,000 but below $20,000.
6. Remove the filter. Filter for expenditures greater than or equal to $15,000.00 or is less than or
equal to $1,000.00. Sort the results from highest to lowest.
You can use the Custom filter on text fields, too. For our worksheet, it's not very useful, but you could
filter for authorizers whose name begins with J, as shown below.

7. Filter for categories that begin with the letter S.


8. Filter the results of the previous filter for categories that end with the letters re.
9. Remove the filters.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 8: Sorting & Filtering – Page 10 of 10

Você também pode gostar