Download Lesson 5 Using Excel Lists

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Extensible Storage Engine wikipedia , lookup

Relational model wikipedia , lookup

IMDb wikipedia , lookup

Clusterpoint wikipedia , lookup

Functional Database Model wikipedia , lookup

Object-relational impedance mismatch wikipedia , lookup

Database model wikipedia , lookup

Transcript
Lesson 5: Using Excel Lists (Databases)
Mini Lecture
A list is a table of information that you can ask questions of. Other names for asking questions are filtering or
querying. The Excel List and/or Database module is truly useful. The key to using lists and pivot tables is organizing
the data in a valid Excel list. If the data is not organized, according to the Excel list rules, the list capabilities will not
work.
A list is made up of records and fields. If you think of your checkbook, your entire checking record is your file, each
transaction is a record, and each piece of information is a field.
If you want to ask a question of a list there must be a field to ask a question of. If you want to find all the people
living in a specific city you must have a field that lists the city names. When you design a database it is important to
think of the questions that you want to ask.
When you go shopping you are querying a database. You can browse the data by wandering in an aisle, you can
have a specific query with a list of shopping list, and you can use AND or OR queries to limit your selection. For
example you can go looking for fruit, that is fresh, and on sale. If you do not find fresh fruit on sale your query will
fail. The fruit example is an example of an AND query. All parts of the query must be true for you to succeed. An
OR query would be looking for cheese that is Cheddar that is either sharp or very sharp. Your query would succeed
if you get either sharp or very sharp Cheddar cheese. The cheese example is an OR query, either part of the query
can be true for the query to be a success.
Designing a list or database is an art. Spend time thinking about how your list will be used, enter sample data, filter
the list to see if it will work, and then add more records to test the list. Take the time to test and modify your list to
be truly useful. The key to making a good list is to understand the data that is being tracked.
An Excel List (For the list commands to work it must be organized in a list!)
Lesson 5-1
Excel 2003: Excel Lists
Cysewski
Lesson Outline
Lesson Concepts
 What is a List or Database?
 List Terms and Concepts
 What is the Database or List Design Process?
 Designing a Database or List to answer questions
Common Errors and Important Concepts
 If you want an answer to a question you must be able to pose the question with the list data
 Not following the rules for making a list using Excel
 Not selecting a cell in the list
 Selecting more then one cell in a list
 Sorting with a range selected in a list
 Having blank rows or columns within a list
Exercises
Basic List Management




Creating a List
Sorting a List
Querying or Filtering a List
Using Auto Subtotals with a List
o Outlining with Auto Subtotals
Common Problems with Lists





Not following the List Rules (Again!)
Not selecting a cell in the list
Selecting more then one cell in a list
Sorting with a range selected in a list
Having blank rows or columns within a list
Excel 2003 List Object


Creating a List Object
Using a List Object
Advanced List Management

Understanding Comparison Operators
o Why do we use comparison operators?
Validating List Data
o The Importance of Valid Data In a List
 Think of thousands of records
o Pick List and Autocomplete
o Conditional Formatting
o Data Validation
More Sorting Options
o Sorting on more then one column
o Sorting columns
o Custom Sort Orders
 Creating a custom sort order
 AutoFill and custom sort orders
More Filtering
o AND Filtering
o OR Filtering
o Top 10 Filters
o Filtering for Blank and Non Blank
o Custom AutoFilters with comparison operators



Lesson 5-2
Excel 2003: Excel Lists
Cysewski
Advanced Filtering





Advanced Filtering Concepts
o Criteria Range
o Database Range
o Extract Range
What is the difference between AND and OR filtering?
o AND Filtering
o OR Filter
AND/OR querying with Advanced Filtering
Extracting data with Advanced Filtering
Using Dfunctions with Advanced Filtering
Lesson 5-3
Excel 2003: Excel Lists
Cysewski
Essential Ideas
List Terms and Concepts





Files
Records
Fields
Sorting
Filtering (Query)
 Conditions
 AND/OR
What is the Database or List design process?











Look at current paper forms
Look at the kinds of questions that need to be answered
Define the Records
Create the Fields
Use the Data Form
Enter Sample Data Records
Create and use the AutoFilter
Find Records
Sort the List
Edit and Update the Records
Enhance the Database, if Appropriate
 Create automatic subtotals
 Use Advance Filtering
 Use DFunctions
 Create Pivot Tables
Revise and Use the Database
If you want an answer to a question you must be able to pose the question with the list data.

 What will are you tracking?
 What is the triggering event that will cause you to enter data into your list?
 What questions do you want answered
 What fields would you use answer your question?
Examples
Lesson 5-4
Excel 2003: Excel Lists
Cysewski
List Rules (CRUCIAL INFORMATION)







Each list should be on a separate sheet of the workbook (Good practice, but not essential)
Each Field Name should be text
The Field Names should be formatted differently from the records
There should be no gaps between the Field Name row and the Records
There should be no blank rows in the list
The type of data in each field should be consistent (Dates, Text, Values)
When using the AutoFilters or Sorting select only one cell in the List range
List Management
1.
Creating a List
Create the List as illustrated below. This database will be used for many of the exercises in these lessons.
Lesson 5-5
Excel 2003: Excel Lists
Cysewski
Sorting a List
Sorting can be both powerful and troublesome. For sorting to work as expected in an Excel list only select one cell
within the data list. Also be careful of using the Sort Buttons on the Toolbar. An inaccurate sort can make an entire
Excel List invalid.
1. Highlight a single cell in the Supplier Field of the List. Use the Sort Buttons on the Toolbar and the Suppliers
should sort correctly.
2.
3.
Select a single cell in the Org database Field and Give the Data/Sort Command
Fill Out the Sort List as illustrated below
4.
The Data should sort correctly
Lesson 5-6
Excel 2003: Excel Lists
Cysewski
1.
Querying and Filtering
With one cell in the CIOS List selected use the Data/Filter/AutoFilter Command
2.
A drop down list with the Field Contents will be added to each Field in the Database
3.
Query the Data List by choosing a ABUS from the Org Drop Down List.
4.
Only the records matching ABUS will show in the Data List.
5.
Choose All from the Org Drop Down List to Re-display the entire Data List.
6.
Experiment with Querying the Data List using the AutoFilter Drop Down Lists
Lesson 5-7
Excel 2003: Excel Lists
Cysewski
1.
2.
Auto Subtotals
Excel will create Subtotals for a Data List if the Data is sorted correctly. Sort the CIOS database by the Org
Field. For Subtotals to work the Field in the At Each Change in: Field must be sorted.
Give the Data Subtotal command and fill out the Dialog Box as listed below. Make sure that the only checkbox
in the Add Subtotals in: list is Amount.
Lesson 5-8
Excel 2003: Excel Lists
Cysewski
3.
The database should look similar to the illustration below.
4.
Click on the Level 2 Outline Symbol as illustrated.
5.
The Database should collapse and look like the illustration below.
Lesson 5-9
Excel 2003: Excel Lists
Cysewski
6.
To remove Subtotals Give the Data/Subtotal/Remove All Command
7.
To Remove AutoFilters give the Data/Filter/AutoFilter command again
8.
The AutoFilters will be removed and the database will be restored to its former state.
Lesson 5-10
Excel 2003: Excel Lists
Cysewski
Common Problems with Lists
There are four common problems that people have when using lists:
 Not selecting a cell in a List when giving list commands
 Selecting more then one cell in a list when giving the list command
 Selecting a range, within a list, when giving the sort command.
 Having blank rows or columns within a list.
Not Selecting a Cell in the List
1. Select a cell outside the database, in the example D21 was selected.
2. Give the Data/Form command and read the error message.
3.
1.
2.
3.
Try the Data/Sort command and the Data/Filter/AutoFilter command.
Selecting More then One Cell in a List.
Select a range of cells in the list, for example C15:G18, and give the Data/Form command.
Read the Warning Dialog Box carefully.
Cancel the command
Lesson 5-11
Excel 2003: Excel Lists
Cysewski
1.
Sorting with a range selected in a list
Select a Range of cells in the list and give the Data/Sort command. Notice that it is sorting the selected range
and NOT the list.
2.
Confirm the Dialog box and the range will be sorted. This is a very dangerous feature!
3.
Use the Undo command to return the database to its former sort order.
4.
Try Sorting with the Sort Buttons.
5.
6.
There is no clue that the validity of the list has been damaged.
Select a range of cells that are in a single column and give the Data/Sort Command. A dialog box will appear
warning of the problem.
Lesson 5-12
Excel 2003: Excel Lists
Cysewski
7.
Try the same thing with the Sort Buttons and see what happens, NO WARNING!
1.
2.
Having blank rows or columns within a list.
Insert a blank row and a blank column into the list as illustrated below.
Select Cell F13 and use the Sort Button on the Toolbar to sort the list. Notice that it only sorted the range of
data and not the entire list.
Lesson 5-13
Excel 2003: Excel Lists
Cysewski
Excel 2003 List Object
Excel 2003 has a new List feature, the List Object. The List Object makes it very easy to create and work with
lists. You can return the list to a normal range when you are completed with the List Object features.
1. With the Pretend CIOS Purchase Database selected choose the Data/List/Create List command.
2.
Confirm the Dialog box
Lesson 5-14
Excel 2003: Excel Lists
Cysewski
3.
A new list will be created with a List Toolbar.
4.
Notice the Asterisk in Row 20. You can add a new record to the List and the List range will automatically
expand.
5.
Click on the Toggle Total Row button on the List toolbar. Notice that column H is totaled.
Lesson 5-15
Excel 2003: Excel Lists
Cysewski
6.
Click on Cell E21 and then click on the Drop Down list. Choose a function and it will apply to the selected
column.
7.
When you are done with the List, choose the Convert to Range command from the Data Menu or the on the
List Toolbar. The List will be converted to a normal range. The List Object is only available in Excel 2003.
Lesson 5-16
Excel 2003: Excel Lists
Cysewski
Advanced List Management
Advanced List Terms and Concepts
 Named Ranges
 Database Range
 Criteria Range
 Extract Range
 Query Concepts
 AND/OR
 Comparison Operators
 =
Equal to
 >
Greater than
 <
Less than
 >= Greater than or equal to
 <= Less than or equal to
 <> Not equal to
 Wildcards
 *
Group of Characters
 ?
Single Character
Comparison Operator Exercise
Excel uses Logical Tests to make decisions. When you filter a list you are using Logical Tests. The AutoFilter uses
the = condition.
1. Create the Worksheet as pictured below. You only need to create the area from A4:C10. The Formulas in cells
A5:B10 are illustrated in the Formula View. The results of a comparison formula are either 1 for True or 0 for
False.
2. Experiment With Changing the Values in Columns A and B to watch the results change from True to False.
Lesson 5-17
Excel 2003: Excel Lists
Cysewski
More Sorting
Excel Sort Order
When sorting in Excel it is useful to know the default sort order. This is the explanation of sort order I got by using
Excel help.
1.
Sorting on More Than One Column
With a cell selected in the list give the Data/Sort command. Fill out the Dialog Box as illustrated. The Sort order
goes from most to least important. For example Continent, Country, Region.
Lesson 5-18
Excel 2003: Excel Lists
Cysewski
1.
Sorting by Columns
With a cell in the CIOS database selected give the Data/Sort command. Choose the Options button and change
the Orientation to Sort left to right. Confirm the dialog box.
2.
Row 4, the Header row, will determine the sort order. Confirm the dialog box.
Lesson 5-19
Excel 2003: Excel Lists
Cysewski
3.
The data will be sorted by column as illustrated
4.
UNDO THE COLUMN SORT
Custom Sort Orders
Using AutoFill create a quick list of the days of the week.
With a single cell in the List selected use the Toolbar to Sort the List. The List will be sorted alphabetically.
1.
2.
3.
With a single cell in the list selected give the Data/Sort/Options command and fill out the dialog box as
illustrated below.
4.
The List will be sorted in date order instead of alphabetical order.
Lesson 5-20
Excel 2003: Excel Lists
Cysewski
1.
2.
Creating and Sorting a Custom List
Type the List of Animals as illustrated in Column D.
Select the List and Give the Tools/Options Custom Lists command.
3.
Click on the Import Button and the list will be added to the Custom Lists.
Lesson 5-21
Excel 2003: Excel Lists
Cysewski
4.
Type Zebras in another cell in the Worksheet and use AutoFill to create a list.
5.
6.
The List will repeat the Custom List.
Sort the List in Ascending Order.
7.
With the List Sorted in Ascending Order give the Data/Sort/Sort Options command and choose the Custom List
from the dropdown list.
Lesson 5-22
Excel 2003: Excel Lists
Cysewski
8.
The data will be sorted in the Custom List order.
1.
More Filtering
Create the List as illustrated below. We will be using this List for the remaining exercises.
Lesson 5-23
Excel 2003: Excel Lists
Cysewski
2.
AND Filtering
With a cell selected within the list choose the Data/Filter/AutoFilter command
3.
In the Purpose Field Filter for Food.
4.
In the Payee Field Filter for Fred Meyers.
5.
Only One record matches BOTH criteria. This is an AND search which requires that both conditions are true for
the record to match the criteria.
Lesson 5-24
Excel 2003: Excel Lists
Cysewski
6.
To show the records again select All from the Payee Field.
7.
NOT all the records appear, only those that were filtered on payee. The Food criterion is still filtering.
8.
To see all the records simply use the Data/Filter/Show All command as an alternative to going to each filtered
field and selecting All.
Lesson 5-25
Excel 2003: Excel Lists
Cysewski
1.
AutoFilters with the Top 10 filter
Filter the Amount field for Top 10
2.
Explore and then Confirm the Top 10 AutoFilter Dialog Box
3.
The List will be Filtered for the Top 10 Amounts. The list is filtered not sorted.
4.
After experimenting Show All the records in the List
Lesson 5-26
Excel 2003: Excel Lists
Cysewski
1.
AutoFilters with Blank and Non-Blank
In the Purpose Field make sure that one of the fields is blank.
2.
Filter for Blanks
3.
Only records who have a Blank field will be selected.
4.
Filter again for NonBlanks.
5.
Show All records at the end of this exercise.
Lesson 5-27
Excel 2003: Excel Lists
Cysewski
6.
Custom AutoFilters with Comparison Operators
Select the Amount Field and choose the Custom AutoFilter. Choose the is greater than criteria
7.
Choose $50.00 for the amount.
8.
The Custom AutoFilter should be filled out as illustrated.
9.
Only the records that have an amount greater then $50.00 are displayed.
10. To redisplay and entire Data List use the Data/Filter/Show All Command
Lesson 5-28
Excel 2003: Excel Lists
Cysewski
1.
2.
Custom AutoFilters with Wild Cards
Select cell C10 and using the Filter Drop Down List choose Custom
Fill out the Custom AutoFilter command as illustrated using the Sa* filter. You will be filtering for an Payee’s
that begin with Sa.
Filter Wild
Cards
3.
The filter finds both Safeway and Sams
4.
Experiment with Filtering using Wild Cards in this List
Lesson 5-29
Excel 2003: Excel Lists
Cysewski
Advanced Filters
Advanced Filtering depends on three named ranges.
 Database Range (The Database Including the Field Names)
 Criteria Range (The Range Including Field Names To Query or Question The List)
 Extract Range (The Range to which data can be copied in response to a query)
1. Create the List as illustrated below. CAREFUL THAT ALL THE FIELD NAMES MATCH
Criteria Range
Database Range
Extract Range
2.
Enter Carrs in Cell C2. This will set the Filter for Carrs
3.
Give the Data/Filter/Advanced Filter command.
Lesson 5-30
Excel 2003: Excel Lists
Cysewski
4.
Fill out the Dialog Box as illustrated.
5.
The List will be Filtered for Carrs
6.
To see all the records again give the Data/Filter/Show All command.
Lesson 5-31
Excel 2003: Excel Lists
Cysewski
7.
8.
9.
By Creating Multiple Queries and redefining the Criteria Ranges, it is possible to pre-define a set of data list
queries. Change the Criteria range as illustrated below. The Criteria Range will reflect the name of the
Worksheet in the Workbook. In this example the Worksheet is named L5 5-29
The illustration on page 5-31 refers to a sheet name ‘L5 5-29’. Your exercise will look different if you do not
name the worksheet tab L5 5-29.
Only the Records with a Payee of Sams will be selected
10. Apply the Data/Filter/Advanced Filter Command and redefine the Criteria Range for each Query. Redefine the
Criteria Range for Ranges. G1:G2, H1:H2, I1:I2. Each time different data will be displayed in the data list.
Lesson 5-32
Excel 2003: Excel Lists
Cysewski
AND/OR Querying With Advanced Filters
1.
2.
3.
Modify the Data List Example so that it looks like the illustration below.
Type Carrs into Cell C2, Select a cell in the Data List, A8 for example and give the Data/Filter/Advanced Filter
Command.
Fill Out the Dialog Box as illustrated and only the Carr’s Checks will be displayed
4.
Modify the Query as illustrated below and give the Data/Filter/Advanced Filter Command.
Lesson 5-33
Excel 2003: Excel Lists
Cysewski
5.
The previous Query is an AND query. To fulfill the criteria the check must meet the criteria of both Carrs and
Greater than $50.00 Dollars.
6.
7.
Show All the records when this exercise is completed.
To create an OR query fill out the query as illustrated below and give the Data/Filter/Advanced Filter
Command. Make sure that the Criteria Range is Changed to A1:E3. Both Carrs and Safeway should be
displayed. An OR query allows either of two criteria to be accurate to display the result.
8.
If the criteria range includes a blank row all data will be displayed. Modify the Query as illustrated below and
Give the Data/Filter/Advanced Filter Command. KEEP THE CRITERIA AS $A$1:$E$3. All records should be
displayed. If there is nothing entered in the criteria range all data will be displayed.
Lesson 5-34
Excel 2003: Excel Lists
Cysewski
9.
Give the Data/Filter/Advanced Filter Command and redefine the criteria range as illustrated below. Only
Safeway records should display. By re-defining the range the blank criteria has been excluded.
1.
2.
Extracting Data with Advanced Filtering
Fill out the Advanced Filter as illustrated below.
The Records that Match the Criteria will be copied to another location or Extracted.
3.
Make sure that the Field Names for the Extract Range are placed in Row A25:E25 as illustrated
Lesson 5-35
Excel 2003: Excel Lists
Cysewski
4.
All the Safeway records will be extracted or copied to a new location.
5.
Enter another Query in the Criteria Range and attempt another Extract.
Lesson 5-36
Excel 2003: Excel Lists
Cysewski
1.
Rearranging Data with Advanced Filtering
Rearrange the Extract Range as illustrated below.
2.
3.
Enter Nothing into the Criteria range so that all records will be extracted.
Give the Filter/Advanced Filter command and fill out the dialog box as illustrated.
Lesson 5-37
Excel 2003: Excel Lists
Cysewski
4.
The Information in the List will be rearranged to reflect the new Extract Range. Rearranging the Extract Range
can reorganize data Lists.
Lesson 5-38
Excel 2003: Excel Lists
Cysewski
Using DFunctions
Instead of Viewing, or Extracting Queries can also calculate using DFUNCTIONS.
DFUNCTIONS are built upon a Criteria Range, a Database Range, and a Field. The Field is the data that will be
calculated. In most cases the Field must be a value. The DCOUNTA function will count Text. DCOUNT only
counts values.
1. Modify the List so it looks like the example below.
2.
3.
Highlight Cell H6 and give the Insert/Function Command.
Choose the Database category
Database
Category
Lesson 5-39
Excel 2003: Excel Lists
Cysewski
4.
Fill out the DSUM dialog box like illustrated in the following dialog boxes. Either type, or preferably enter by
dragging or selecting the ranges.
Lesson 5-40
Excel 2003: Excel Lists
Cysewski
5.
The result of the DSUM with no Filter in the Criteria range is 973.
6.
Type Carrs into Cell C2 and the DSUM will re-calculate to reflect the new filter. Replace Carrs with Safeway,
and then Sams. The DSUM will re-calculate for each new filter.
Lesson 5-41
Excel 2003: Excel Lists
Cysewski
7.
Fill in the DMAX, DMIN, DCOUNT, and DAVERAGE Functions. The DFUNCTIONS are illustrated.
8.
Enter new criteria in the criteria range and watch the DFUNCTIONS recalculate.
Lesson 5-42
Excel 2003: Excel Lists
Cysewski