microsoft excel database functions tutorial - yolasokly.yolasite.com/resources/(ebook) excell 50...

16
Aston Business School Student Guide - Excel version 5.0 Database Functions Version 1.0 December 199 1 Microsoft Excel v5.0 Database Functions Student Guide Simon Dupernex Aston Business School

Upload: nguyentram

Post on 31-Jan-2018

230 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 19961

Microsoft Excel v5.0Database Functions

Student Guide

Simon Dupernex

Aston Business School

Page 2: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 19962

PrefaceThis document is an introduction to the database functions contained within the spreadsheet programExcel 5.

It tells you how to construct your own database from scratch.

It is specifically tailored for students at Aston University but will be of use to anyone who has a copyof Excel version 5.0 for Windows.

It assumes that you already know how to work with Windows on a PC.

Copyright Simon Dupernex 1996.

Permission is granted for any individual or institution to use, copy or redistribute this document inwhole or in part, so long as it is not sold for profit and provided that the above copyright notice andthis permission notice appears in all copies.

Where any part of this document is included in another document due acknowledgement is requiredof the author and Aston Business School, Aston University, Birmingham B4 7ET.

Although every care has been taken with the production of this training manual to ensure that itscontents are correct, neither the author nor Aston University accept any responsibility in any way forthe accuracy of the information given in the manual, or for any consequences suffered by any partywho uses or relies on the information given in the manual.

Page 3: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 19963

CONTENTS

1 INTRODUCTION 4

3 GETTING STARTED AND ENTERING DATA 5

4 DATA FORMS 6

5 SORTING YOUR DATABASE 8

6 FILTERING A LIST USING AUTO FILTER 10

7 FILTERING A LIST USING ADVANCED FILTER 12

8 SUMMARY 16

Page 4: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 19964

1 INTRODUCTION.

Excel has available a simple database function called a list. A list is a way of storingdata on a worksheet where a series of labelled rows contain similar data. An exampleof a list could be a set of results from a series of questionnaires, or the universitytelephone directory.

An Excel list contains certain common features:

∗ Cells in the same column contain like data.

∗ The first row of the list contains the column labels.

∗ Rows in a list contain similar sets of data.

So a list is a simple database where rows are records and columns are fields.

Excel provides a powerful set of commands to make it easy to manage a list or adatabase. You can use a Data Form to see, change, add, and delete records from alist, or to find specific records based on criteria you specify. You can Sort the data toarrange rows in a list according to the contents of selected columns. You select thedata and the sort order you want, or you can create and use a custom sort order. Youcan Filter the data to find and work with a subset of the data in your list. A filtered listdisplays only the rows that contain a certain value or rows that meet a set of criteria,while temporarily hiding the other rows.

When you create a list, bear in mind the following guidelines:

∗ Avoid having more than one list on a worksheet.

∗ Leave at least one blank column and one blank row between your list andother data on the worksheet.

∗ Create column labels in the fist row of your list.

∗ Design your list so that all the rows have similar items in the same column.

∗ Don’t insert extra spaces at the beginning of a cell; this will affect sortingand searching.

Page 5: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 19965

3 GETTING STARTED AND ENTERING DATA.

Turn on the PC and start Windows. After a short while the Microsoft Windowsscreen is displayed.

Start the Excel spreadsheet program by double-clicking the Excel icon.

Start with a clear worksheet by selecting the New option from the File menu.

Your worksheet should look like:

Exercise.

• Enter the following fictitious personnel data.

Note that cells A1 through F1 inclusive are the column labels and that cellsA2 through F9 inclusive contain the relevant data.

• Now save your spreadsheet on your floppy disk using Save As from theFile menu.

Page 6: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 19966

4 DATA FORMS.

Once a list has been created, you can add, find, edit, and delete records using a DataForm. The Form command on the Data menu displays a data form, which is a dialogbox that you can use to see, change, add, and delete records from a list, or to findspecific records based on criteria you specify. The column labels of your list becomethe field names in the data form.

Exercise.

Select any cell within your database (e.g. cell B3) and choose the Formcommand from the Data menu. The Data Form dialogue box will bedisplayed, containing the details of the first record in the list. Your screenshould look like the one below. Practice scrolling through the records inyour list.

To move around on the data form, press the TAB key to move ahead onefield at a time, and then through the command buttons. Press SHIFT+TABto move back one field or button at a time.

The scroll bar enables you to scroll through the records in your list andshows the approximate position of the displayed record in the list. Moveforward and back through the list by using the scroll box and the up anddown scroll arrows on the scroll bar.

The New button clears the fields in the Data Form dialog box.

The Delete button deletes the displayed record; the other records shift up inthe list.

The Restore button restores edited fields in the displayed record, removingyour changes.

The Find Prev button displays the previous record in the list.

The Find Next button displays the next record in the list.

The Close button closes the data form.

Page 7: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 19967

Entering a record onto the database.

Exercise.

• Choose the New button, and fill in the fields for employee 108, GrahanSmith.

Remember to Tab between the fields.

When you finish filling in the details, press Enter to add the record to theend of the list.

When you have successfully added the details, close the Data Form dialogue box bychoosing the Close button.

Page 8: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 19968

5 SORTING YOUR DATABASE.

Use the Sort command to arrange rows in a list according to the contents of particularcolumns.

You can choose to sort in ascending or descending sort order.

Exercise.

• Select any cell within your database (e.g. cell A1) and choose the Sortcommand from the Data menu. Excel automatically selects every cell inyour database, and then displays the Sort dialogue box.

• To sort the list by Name:

Select the Surname column in the Sort By box and the Ascending optionbutton, then select the Forename column in the Then By box and theAscending option button.

Your screen should look like this:

• Select the OK button to sort the data.

Page 9: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 19969

• Your sorted data should look like this:

Now practice sorting the database in different sequences.

• When you have finished, restore the database back into Number sequence.

Excel uses the following order for ascending sorts:

Numbers

Text, and text that includes numbers (postal codes, part numbers, etc.)

Logical values (FALSE then TRUE)

Error values

Blanks

A descending sort reverses the above order, except for blank cells, which are alwayssorted last.

If the sort result is not what you expected, look at the type of data you are sorting.You can undo the results of a sort by immediately choosing the Undo Sort commandfrom the Edit menu.

For best results, make sure all of the cells in a column contain the same type of data.

Page 10: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 199610

6 FILTERING A LIST USING AUTO FILTER.

Filtering a list enables you to find and work with a subset of the data in your list.

Filtering displays only the rows that contain a certain value or that meet a set ofcriteria, while hiding the other rows.

Exercise.

• Select any cell within your database (e.g. cell D1) and choose theAutoFilter command from the Filter submenu from the Data menu.

The AutoFilter command applies drop-down arrows directly to columnlabels in the list, so you can select the item you want to display. When youselect an item from the drop-down list, Excel temporarily hides the rowsthat do not contain that item.

Your screen should then look like this:

Page 11: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 199611

To select all the records containing Dawn as a Forename:

• Click the arrow of the column containing the data you want to display, inthis case Forename. A scrolling dialogue box is then displayed.

• Select the item you want to display, in this case Dawn.

Your screen should then look like this:

Now practise using different filters.

• When you have finished, restore the database by reselecting the AutoFiltercommand from the Filter submenu from the Data menu.

Page 12: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 199612

7 FILTERING A LIST USING ADVANCED FILTER.

The Advanced Filter command enables you to filter data by using a criteria range todisplay only the rows that meet all the criteria you specify.

The Advanced Filter allows you to either filter the list, in-place, which hides the rowsthat do not meet the criteria, or copy to another location, which copies the filtereddata to another worksheet or another location on the same worksheet.

You use Criteria to filter lists. There are two kinds of criteria you can use in a criteriarange:

Multiple comparison criteria to specify more than two comparison criteriafor a single column.

Computed criteria when your criteria are the result of calculation or requirea comparison.

Before you use the Advanced Filter you need to set up a Criterion range.

Exercise.

You are going to set up filters on your list using the contents of the Forenameand Surname fields. In order to do this you need to firstly copy the relevantcolumn headings to your selection criteria range, and secondly specify theselection criteria. The procedure for doing this is as follows:

• Select cells B1 through C1, then choose the Copy command from the Editmenu.

Then select cell H1 and choose the Paste command from the Edit menu.

This has set up the selection criteria column headings which tells Excelwhich columns in the list to apply the selection criteria to.

• Select cell I2 and type Anderson, to select all occurrences of Anderson asa surname.

Your worksheet should look like:

Page 13: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 199613

• Select any cell within your database (e.g. cell D1) and select the AdvancedFilter command from the Filter submenu from the Data menu.

Your screen should then look like this:

• Check that Filter the List in-place box is selected and the List Range isfrom cell A1 to F10 inclusive.

• Specify the Criteria Range as cells H1 through I2 inclusive, either bydirectly entering the cell range, or by selecting the cells with the mouse.

Your screen should then look like this:

• When you are satisfied that your filter criteria are correct, choose the OKbutton to select the matching records.

Page 14: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 199614

Your screen should then look like this:

• To restore the database, select the Show All command from the Filtersubmenu from the Data menu.

Page 15: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 199615

Now practise using different selection criteria.

For example:

To select all the people with a Forename of Dawn or a Surname ofAnderson, type Anderson in cell I2 and Dawn in cell H3, and change thecriteria range to cells H1 through I3 inclusive.

To select all the people with a Forename of Dawn and a Surname ofAnderson, type Anderson in cell I2 and Dawn in cell H2, and change thecriteria range to cells H1 through I2 inclusive.

To select all the people with a Forename of Dawn and a Surname ofAnderson, or a Surname of Jarvis, type Anderson in cell I2 and Dawn incell H2, and Jarvis in cell I3, and change the criteria range to cells H1through I3 inclusive.

Don’t forget to restore the database between each selection.

Page 16: Microsoft Excel Database Functions Tutorial - Yolasokly.yolasite.com/resources/(ebook) Excell 50 Tutorial.pdf · Aston Business School Student Guide - Excel version 5.0 Database Functions

Aston Business School Student Guide - Excel version 5.0 Database Functions

Version 1.0 December 199616

8 SUMMARY.

In this exercise you have learned to:

∗ Construct a simple database (list)

∗ Add Data to the database

∗ Use Data Forms to Add, Change and Delete items on the database

∗ Change the sequence of the database using the Sort command

∗ Filtered the database using the Auto Filter and Advanced Filter options

The AutoFilter command applies drop-down arrows directly to columnlabels in the list, so you can select the item you want to display. Forexample, you can display all the rows containing a specified unique valuein a column, such as "all rows that contain Robinson in the Surnamecolumn." You can also use custom comparison criteria to filter the datain your list. When you hide rows using the AutoFilter, your worksheet isin Filter mode. In Filter mode, many Excel commands operate only onvisible cells. After you filter a list to display the rows you want, you cancopy the subset of your data to another location for further analysis. UseAutoFilter to filter the data in place, then use the Copy command and thePaste command to place the filtered data wherever you want it, even onanother worksheet.

Use Advanced Filter to apply complex criteria to filter your list, thenautomatically copy the filtered data to a location you specify. To copythe filtered data to another worksheet, it is easiest to filter the list byusing AutoFilter. Then cut and paste the filtered data where you want it.