CoureseModol UGBS 008 Data Processing

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 72

UNIVERSITY OF GHANA

DEPARTMENT OF OPERATIONS AND MANAGEMENT


INFORMATION SYSTEMS
UNIVERSITY OF GHANA BUSINESS SCHOOL
UNIVERSITY OF GHANA
LEGON

ADMN 008 DATA PROCESSING

LECTURE NOTES

Prepared by:

PRINCE KWAME SENYO


1 INTRODUCTION TO DATA PROCESSING ............................................................. 1
1.1 DEFINING DATA PROCESSING ..................................................................................... 1
1.2 STAGES OF DATA PROCESSING ................................................................................... 1
1.3 DIFFERENTIATE BETWEEN DATA AND INFORMATION .................................................. 2
1.4 DATA PROCESSING CYCLE .......................................................................................... 2
1.5 DATA STORAGE HIERARCHY ...................................................................................... 4
1.6 IMPORTANCE OF DATA PROCESSING ........................................................................... 4
2 PROCESS DATA WITH MICROSOFT EXCEL – AN OVERVIEW....................... 6
2.1 OVERVIEW OF MICROSOFT EXCEL .............................................................................. 6
2.2 HOW TO START EXCEL ................................................................................................ 7
2.3 CREATING A WORKBOOK ............................................................................................ 9
2.4 WORKING WITH BASIC DATA FORMAT ...................................................................... 9
2.5 WORKING WITH COLUMNS AND ROWS ..................................................................... 10
2.6 WORKING WITH CELLS AND RANGES ........................................................................ 10
2.7 INTERPRETING ERROR VALUES ................................................................................. 11
3 PROCESSING DATA WITH MICROSOFT EXCEL FORMULAS ...................... 12
3.1 OVERVIEW OF FORMULA .......................................................................................... 12
3.2 GUIDELINES FOR WRITING EFFECTIVE FORMULAS ..................................................... 13
3.3 ORDER OF PRECEDENCE ............................................................................................ 13
3.4 EDITING A FORMULA ................................................................................................. 14
3.5 CELL REFERENCING .................................................................................................. 14
3.6 AUTO FILLING FORMULAS AND DATA ...................................................................... 17
4 PROCESSING DATA WITH MICROSOFT EXCEL FUNCTIONS ...................... 20
4.1 OVERVIEW OF FUNCTIONS ........................................................................................ 20
4.2 CATEGORIES OF FUNCTIONS ..................................................................................... 20
4.3 HOW TO WORK WITH FUNCTIONS .............................................................................. 21
4.4 BASIC EXCEL FUNCTIONS ......................................................................................... 24
4.5 LOGICAL FUNCTIONS ................................................................................................ 25
4.6 COMPARISON OPERATOR .......................................................................................... 27
5 PROCESSING FINANCIAL DATA WITH MICROSOFT EXCEL ....................... 28
5.1 OVERVIEW OF FINANCIAL FUNCTIONS ...................................................................... 28
5.2 PAYMENT FUNCTION ................................................................................................ 29
5.3 RATE FUNCTION ....................................................................................................... 30
5.4 NPER FUNCTION ...................................................................................................... 31
5.5 PV FUNCTION ........................................................................................................... 31
5.6 IPMT AND PPMT FUNCTIONS .................................................................................. 32
5.7 FUTURE VALUE......................................................................................................... 33
5.8 LOAN AMORTIZATION............................................................................................... 34
6 USING CHARTS TO PROCESS DATA IN MICROSOFT EXCEL ....................... 37
6.1 OVERVIEW OF CHARTS ............................................................................................. 37
6.2 CHART CATEGORIES ................................................................................................. 37
6.3 HOW TO CREATE EXCEL CHARTS .............................................................................. 38
6.4 FORMATTING CHARTS .............................................................................................. 40
7 PROCESSING DATA WITH DATABASES: AN OVERVIEW OF MICROSOFT
ACCESS .................................................................................................................................. 41
7.1 OVERVIEW OF DATABASES ....................................................................................... 41
7.2 IMPORTANCE OF A DATABASE .................................................................................. 41
7.3 BASIC DATABASE TERMINOLOGIES .......................................................................... 42
7.4 INTRODUCTION TO MICROSOFT ACCESS ................................................................... 44
7.5 HOW TO CREATE AN ACCESS DATABASE .................................................................. 45
8 WORKING WITH MICROSOFT ACCESS TABLE................................................ 48
8.1 OVERVIEW OF ACCESS TABLES................................................................................. 48
8.2 DEFINING A TABLE ................................................................................................... 48
8.3 CREATING A TABLE IN DATASHEET VIEW................................................................. 49
8.4 CREATING A TABLE IN DESIGN VIEW........................................................................ 52
8.5 ADDING RECORDS TO A TABLE ................................................................................. 56
8.6 TABLE RELATIONSHIPS ............................................................................................. 57
9 WORKING WITH MICROSOFT ACCESS FORMS ............................................... 59
9.1 OVERVIEW OF FORMS ............................................................................................... 59
9.2 CREATING ACCESS FORMS USING FORM VIEW ......................................................... 59
9.3 CREATING A FORM USING THE FORM DESIGN VIEW ................................................. 60
9.4 CREATING FORMS USING FORM WIZARD ................................................................. 61
9.5 MODIFYING ACCESS FORMS ..................................................................................... 62
10 WORKING WITH MICROSOFT ACCESS QUERIES AND REPORTS.............. 63
10.1 OVERVIEW OF MICROSOFT ACCESS QUERY .............................................................. 63
10.2 CREATING AND RUNNING A QUERY .......................................................................... 63
10.3 SORTING DATA IN A QUERY ...................................................................................... 65
10.4 FILTERING DATA....................................................................................................... 66
10.5 DEFINING QUERIES RECORD SELECTION CRITERIA................................................... 66
10.6 OVERVIEW OF MICROSOFT ACCESS REPORT ............................................................. 67
10.7 CREATING REPORTS .................................................................................................. 67
10.8 MODIFYING REPORTS ............................................................................................... 69
1
Introduction to Data Processing
This chapter introduces the concept of data processing. The chapter covers:
 The definition of data processing
 Stages of data processing
 Differences between data and information
 Data processing cycle
 Data storage hierarchy
 Importance of data processing

1.1 Defining Data Processing


Data processing is a series of actions that convert data into useful information. It
involves the collection and transformation of data items to produce meaningful
information. For example, by collecting and processing students’ course registration
data for classroom allocation; we can refer to this process as data processing. It is
important to note that data processing can be done manually or automated. In this
course, the focus is on computer-aided data processing.

1.2 Stages of Data Processing


Data processing procedures can be organised in five stages, namely data collection,
preparation, inputting, processing and outputting.

Data collection: Involves gathering data from different sources such as transactions,
from users, and documents, etc. this procedure can be achieved by using
questionnaires, extracting data from documents, interviews and so on.

Data preparation: Refers to the process of organising raw data for further analysis. It
includes editing, coding, rearranging, and classifying raw data.

Data inputting Involves feeding a system with raw data for processing or passing
data from an initial stage to another. If a computer system is being used for data

1
processing, then input devices such as keyboard, barcode scanners can be used for
data input.

Data processing: Involves the process of converting data into information through a
set of procedure.

Data Outputting: Refers to providing processed data that is, information into suitable
format for various stakeholders.

1.3 Differentiate between Data and Information


Data: Refers to a collection of unorganized facts in the form of figures, text, images,
audio, video, and symbols. Data is the plural form of datum. Data can be divided in
two categories: numeric and character data. Numeric data are represented in the form
of digits (e.g. 20 books). Character data on the other hand is expressed in
alphabetical letters and words as well as graphical data.

Information: Refers to a processed data that contains patterns, associations, or


relationships to enable decision-making. It also refers to a collection of data that
conveys some meaningful idea. It may provide answers to questions like who, which,
when, why, what, and how.

1.4 Data Processing Cycle


Data processing cycle refers to the iterative processes of converting data into
information. Whenever a computer is used in data processing, it must go through
three basic stages before any task can be completed. These as presented in Figure 1.1
are input, processing, and output.

Input
It is the process through which collected data is transformed into a form that the
computer can understand. It is a very important step because correct output results
totally depend on the input data. In input step, following activities can be performed.

2
Figure 1.1 Data processing cycle

Processing
It denotes data manipulation techniques such as classifying, sorting, calculating,
summarising, comparing, etc. that convert data into information. Classification
involves arranging data into different groups and subgroups, to provide some
meaningful information.

Storing involves arranging data into an order to provide quick information.


Calculation refers to arithmetic operations that are performed on the numeric data to
get the required results. For example, a student’s exam grade can be calculated by
adding an interim assessment and examination marks. Summation refers to data
processing by aggregating two or more data elements.

Output
Refers to the result of data processing. The main purpose of data processing is to
derive output for decision-making. Mostly, the output is stored on the storage media
for later use. In output step, following activities can be performed, namely retrieval
and communication. Output retrieval refers to the process of finding an existing
information from a storage media. Communication, on the other hand, refers to the
transfer of output to other stakeholders. For example, output from weather forecast
can be stored for future and sent to other organisations such as newspapers and radio
stations for dissemination.

3
1.5 Data Storage Hierarchy
Data storage hierarchy refers to the systematic organisation of data in a computer. It
starts from the lowest to the highest data storage. The lowest unit of data storage in a
computer is bit. A bit is the basic unit of digital data. It can have only two values zero
(0) or one (1). From bit, we move to byte and so on. A byte is made up 8 bits. Figure
1.2 shows the data storage hierarchy from the smallest to the highest. The Figure
shows the units of data storage and corresponding number of bytes it contains.

Figure 1.2 Data storage hierarchy

1.6 Importance of Data processing


Data processing is important for the following reasons:
• Generate information by converting data into meaningful facts
• Source of evidence of activities for accountability

4
• Add value to an otherwise facts/figures
• Condense or reduce volume of data
• Identifying patterns that are not easily detected from data
• Making informed decisions because of the insight obtained from the processed
data
• Planning for short, medium and long term
• Projection or forecasting based on the information processed

5
2
Process Data with Microsoft Excel
– An Overview
This chapter discusses data processing using Microsoft Excel software. The chapter
presents an overview and basics of the Excel software. The chapter covers:
• Overview of Microsoft Excel
• How to start Microsoft Excel
• Parts of the Excel window
• Creating a workbook
• Working with basic data formats
• Working with cells and ranges
• Interpreting error values
• Entering, analysing, and presenting quantitative data
• Entering text, numbers, and dates in a worksheet

2.1 Overview of Microsoft Excel


Microsoft Office Excel or Excel for short is an application software that enables users
to record, process, and present data in an organised and easily updatable manner.
Excel contains a collection of columns and rows laid out in a grid referred to as a
spreadsheet. An Excel file integrates data from several spreadsheets a single
workbook.

As presented in Figure 2.1, Excel commands are categorised into groups of tabs on a
ribbon. These tabs include Home, Insert, Page Layout, Formula, Data, Review, and
View. Some key features of the spreadsheet are; ribbon, tabs, formula bar, workbook
name, name box, row heading, column headings, status bar, sheet tabs, zoom controls,
and active worksheet

6
Figure 2.1 Parts of Microsoft Excel workbook

2.2 How to start Excel


There are several ways to start the Excel application. Two methods are presented

here.

7
Method 1

• Press the Windows key from the keyboard or click on the Windows icon from
the task bar to bring up the startup menu as presented in Figure 2.2.
• Go to All programs
• Select Microsoft Office folder and click on Microsoft Excel from the list.

2
3

Figure 2.2 Starting Microsoft Excel

Method 2
To start Excel using this method (see Figure 2.3):
• Press Windows key and R together from the keyboard. Alternatively, type
RUN in start-up menu search box.
• Type Excel in the RUN dialog box.
• Press OK or enter from the keyboard

8
Figure 2.3 Run dialog box

2.3 Creating a Workbook


To create a new workbook if you have already started Excel as presented in Figure 2.4
 On the ribbon, click the File tab to display the Backstage view
 Click New in the navigation bar to display the New screen
 Click the Blank workbook tile or select an existing template.

Figure 2.4 Creating a workbook

2.4 Working With Basic Data Format


The common data formats that Excel allows are letters, numbers, symbols, and a
combination of these. For instance, you can enter words (book title and author), price
expressed as currency, and quantity expressed in number (see Figure 2.5). These data

9
are entered into a cell – an intersection between a row and a column. Data entered into
a cell appears in both the active cell and the formula bar. To enter multiple lines of
data within a cell the ALT and Enter keys are pressed together.

Figure 2.5 Entering data into a cell

2.5 Working with Columns and Rows


In a spreadsheet, the columns are represented by the alphabets starting from A and the
rows are represented by the number starting from 1. Depending on the content entered
into a cell, the column and row size can be expanded to accommodate the length of
the text. For instance, in Figure 2.6, column A is expanded by placing the cursor in
between column A and B and double clicking or dragging towards B.

Figure 2.6 Columns and rows

2.6 Working with Cells and Ranges


In a spreadsheet, a cell is made up of a column and a row. As such, a cell name also
reflects this arrangement. For instance, cell C3 is made up of column C and row 3.

10
A cell range reference indicates the beginning and end as well as the location and size
of selected cells. For instance, in Figure 2.7, the highlighted portions indicate the cell
ranges. Thus if cells A1 to A5 are selected, we can refer to the selected portions as a
cell range.

Figure 2.7 Cells and ranges

2.7 Interpreting Error Values


In Excel, some common errors may emerge during data processing. Figure 2.8
presents some of these errors, their meaning and how to fix them. For instance, if a
cell has the hash sign error (######), it is an indication that the cell size is too small
for the value. To fix this error, the cell needs to be widened by double clicking
between the two columns bordering the cell.

Figure 2.8 Common Excel errors

11
3
Processing Data with Microsoft
Excel Formulas
This chapter discusses how Excel formula aids in data processing. The chapter covers:
 Overview of a formula
 Guidelines for writing effective formulas
 Order of precedence
 Editing an existing formula
 Cell references in formula writing
 Auto filling formulas

3.1 Overview of Formula


Formula is an expression that returns a value. Formulas are written using operators
that combine different values, resulting in a single displayed value. In most cases
Excel formulas contain basic arithmetic operators such as addition, subtraction,
multiplication, division, and exponentiation. Figure 3.1 shows the basic arithmetic
operators in Excel, their use in an example and a description. For instance, the
addition operator can be used to add two numbers and return a value using the
formula =4+4. The golden rule of Excel formulas is that every formula must with the
equal sign (=). If the equal sign is not provided, Excel will not recognise the
expression as a formula to return a value.

Figure 3.1 Basic formula

12
3.2 Guidelines for writing effective formulas
It is important to write effective formulas when processing data with excel. The
following steps can aid this process:
 Keep them simple
 Do not hide data values within formulas – This means that try as much
possible not to include values in your formula especially when the values can
change often
 Break up formulas to show intermediate results

Entering a formula
 Click cell where you want formula results to appear
 Type = and an expression that calculates a value using cell references and
arithmetic operators
 Cell references allow you to change the values used in the calculation without
having to modify the formula itself
 Press Enter or Tab to complete the formula

For example, to perform the operation 20 plus 10, located in cell A1 and B1
respectively. Click cell C1 if you wish the answer to be placed there. Then begin the
formula by typing =A1+B1. Note that we did not type =20+10 even though this will
also give us the right answers. The reason is that by writing formulas with cell names
instead of actual values, you call always change the cell content and the formula will
update automatically. However, if you use the actual values in the formula, you will
have to change the formula and the values in the cells whenever there is a change in
the values. Thus, the best practice is to avoid using values in formulas unless it is
certain that the values will not change often.

3.3 Order of precedence


Refers to a set of predefined rules used to determine the sequence in which operators
are applied in a calculation. The order of precedence can be abbreviated as PEDMAS
representing parenthesis, exponent, division, multiplication, addition and subtraction.
Thus, in writing formulas, this logic must be considered. Excel also follows the order
of precedence in its calculation. Figure 3.2 presents some examples of order of
precedence and how Excel applies these to a formula. For instance, in the formula

13
=50+10*5, Excel will first multiply 10 and 5 to get 50 and thereafter add 50, to get a
final value of 100.

Figure 3.2 Order of precedence

3.4 Editing a formula


To edit a formula, click the cell that contains the formula. The formula will appear in
the formula bar. In other cases, if the cell with the formula is double clicked, the
formula will appear in both the cell and the formula bar. Each cell reference is colour
coded in the formula and the corresponding cell in the worksheet for easy
identification. For example, in Figure 3.3, the formula appears in both the formula bar
and the cell with colour coding indicating corresponding cells used in the calculation.

Figure 3.3 Editing formulas

3.5 Cell Referencing


Cell referencing refers to a technique of using data from one cell to perform
operations in another cell worksheet or workbook. Most Excel workbooks are created

14
to record and analyse data. To do this effectively, you enter data in cells in a
worksheet, and then reference the cells with data in formulas that perform calculations
on that data, such as adding the total of a column of numbers as part of a budget.

Types of cell references


There are three types of cell references, namely relative, absolute, and mixed.
Relative reference: When a formula includes a cell reference, Excel interprets it as
being located relative to the position of the current cell. This means that excel
assumes that the values relative to the first operation will also perform this same
calculation. Therefore, Excel repeats the formula for the relative cells (cells following
the first one) and the performance this same operation. In this case, the formulas for
all the cells will look similar but the corresponding cells will be different.

For instance, from Figure 3.4, a formula was written in cell D4, when this formula is
copied below D4, Excel will recognise the preceding operation and repeat the formula
below, illustrating relative cell referencing.

Figure 3.4 Relative reference

15
Absolute reference: Also called the fixed reference is a type of cell reference that
always references the same cell no matter where it is moved. That is, under absolute
reference, Excel is made lock down a particular cell for subsequent calculation
irrespective of location. Absolute referencing is performed by placing a dollar sign ($)
in front of the column and/or row values of a cell. For instance, to make cell D4
absolute, the formula will read as =$D$4. In the same vein, to make a column
absolute, the dollar sign is placed in front of the column name say =$D4. Also, this
can be done for row as well by placing a dollar sign in front of row name say =D$4.

In Figure 3.5, cell D$ is made absolute by adding the dollar sign to the cell name.
Thus, by copying the formula to other cells, the same values were repeated. The
absolute reference is very useful when performing calculations that require the
constant use of a particular cell.

Figure 3.5 Absolute reference

Mixed reference: Refers to a reference containing both relative and absolute


references. Thus, when both relative and absolute references are used in a formula, we
call this a mixed reference. For example, Figure 3.6 shows a mixed reference where

16
cell B3 uses a combination of absolute and relative references to develop a
multiplication table.

Figure 3.6 Mixed reference

3.6 Auto Filling Formulas and Data


AutoFill provides a quick way to enter content and formatting in cells based on
existing entries in adjacent cells. After you select a range, a fill handle appears in the
lower-right corner of the selection. When you drag the fill handle over an adjacent
cell or range, AutoFill copies the content and formats from the original cell or range
into the adjacent cell or range. More efficient than the two-step process of copying
and pasting.

By default, AutoFill copies both the content and the formatting of the original range
of the selected range. Use the AutoFill options button to specify what is copied. From

17
Figure 3.7 clicking this button provides a list of Auto-Fill options. The Copy Cells
option, which is the default, copies both the content and the formatting. The Fill
Formatting Only option copies the formatting into the selected cells, but not any
content. The Fill Without Formatting option copies the content but not the formatting.

Figure 3.7 AutoFill

Filling a Series
By using the AutoFill technique, you can create a series of numbers, dates, or text
based on a pattern. The fill series option learns the pattern of data provided and
provides subsequent values. To create a series of numbers, you enter the initial values
in the series in a selected range and then use AutoFill to complete the series. Figure
3.8 shows how AutoFill can be used to insert the numbers from 1 to 10 in a selected
range. You enter the first few numbers in the range A1:A3 to establish the pattern for
AutoFill to use, consecutive positive integers in this example. Then, you select the
range and drag the fill handle over the cells where you want the pattern continued. In
Figure 3.8, the fill handle is dragged over the range A4:A10 and Excel fills in the rest
of the series.

Figure 3.8 Fill series

18
Figure 3.9 shows some data formats that can be Auto filled based on initial patterns in
Excel. For instance, by Jan, Feb and Mar and dragging the fill handle, Excel will
automatically fill the subsequent months.

Figure 3.9 Autofill data format

19
4
Processing Data with Microsoft
Excel Functions
This chapter discusses how Functions support data processing in Excel. The chapter
covers:
 Overview of Excel functions
 Categories of functions
 How to use Excel functions
 Basic Excel functions
 Logical functions
 Comparison operators

4.1 Overview of Functions


Function is a named operation that returns a value. That is, a function is pre-written
Excel operation that augments formulas. Functions are used to simplify formulas,
reducing what might be a long formula into a compact statement. Functions can be
placed inside another function referred to as nested functions. For example, to add the
values in the range A1:A10, you could enter the following long formula:

=A1+A2+A3+A4+A5+A6+A7+A8+A9+A10

Or we could use the SUM function to accomplish the same task by this compact
formula:

=SUM(A1:A10)

4.2 Categories of Functions


Excel supports an extensive library of functions, organized into 12 categories. The
Functions are organized in the Function Library group on the FORMULAS tab. To
work with a particular Function, you can select it from the function category.
Thereafter, you can open the Insert Function dialog box to search for a particular

20
function. When you select a function, the Function Arguments dialog box opens.
Figure 4.1 shows the Excel Function categories and their respective description. For
instance, the Math & Trig category contains functions that can be used to perform
mathematical and trigonometry operations.

Figure 4.1 Excel Function categories

4.3 How to work with functions


Every function has to follow a set of rules, or syntax, which specifies how the
function should be written. The general syntax of all Excel functions is

=FUNCTION (argument1, argument2, ƒ1...)

where FUNCTION is the name of the function, and argument1, argument2, and so
forth are arguments, which are the numbers, text, or cell references used by the
function to return a value. ƒ1 represents another function what is nested in the original
Function. Arguments and nested Functions are always separated by a comma.

Not all functions have arguments. Some functions have optional arguments, which are
not required for the function to return a value, but can be included to provide more

21
control over how Excel calculates the returned value. If an optional argument is not
included, Excel assumes a default value for it.

There are two ways of using functions, you can either insert the function through the
formula tab or type it directly into a cell or the formula bar. These approaches are
discussed below.

Inserting a Function
The Function insertion method as presented in Figure 4.2 follows the steps below
 First, click in the cell you want the result to be
 Go to the Formula tab in the ribbon
 Sleet Insert Function command and a function dialog box will appear
 You can search for the Function you want to use of select it from the Function
categories and click OK.

22
Figure 4.2 Inserting a function

Typing a Function
Functions can be typed directly into a cell if you are familiar with the various
functions, which is often faster. To use the Function typing approach as presented in
Figure 4.3:
 Click in the cell the result will be placed
 Begin the function with an equal sign (=)
 Start typing the name of the Function and a list of possible functions will pop
up.

23
 Select the function you want to provide the necessary arguments

Figure 4.3 Typing Functions

4.4 Basic Excel Functions


Excel has some basic Functions to perform regular data processing tasks. These
Functions provide a fast and convenient way to perform basic data processing. These
basic functions are SUM, AVERAGE, MIN, MAX, COUNT, COUNTBLANK, and
COUNTA. The SUM function is used to calculate the total value of numbers in a cell
range. The AVERAGE function calculates the mean of numbers in a cell range. On
the other hand, the COUNT function is used to calculate the total number of numeric
items in a cell range. The MIN function determines the smallest numeric value in a
cell range while MAX determines the largest. The COUNTA Function calculates the
total number of alphanumeric items in a cell range while the COUNTBLANK
calculates the total number of blank spaces.

24
The example below shows how some these basic functions can be used in processing
data.
=SUM (A1:A10)
=COUNT (A1:A10)
=AVERAGE (A1:A10)
=MIN (A1:A10)

where (A1:A10) is the cell range the Function considers in the calculation. Figure 4.4
shows how the SUM function is used through the AutoSum command under the
Home Tab.

Figure 4.4 Using the SUM function

4.5 Logical Functions


A logical function determines if the value of a statement is true or false. These
functions help to make decision per a given condition. For instance, a logical function
can be used to determine the grade of a student in an examination based on marks
obtained. We will consider three logical Functions in this subsection - IF, Nested IF
and Lookup.

Using the IF Function


The IF function is used to determine the true or false value in a statement based on a
predefined criteria. The IF function returns one value if a condition is true and returns
a different value if that condition is false. The syntax of the IF function is:

25
=IF (logical_test, [value_if_true,], [value_if_false])

The logical_test is the condition, [value_if_true] is the true value if the condition is
met and [value_if_false] is the value if the condition is not met.

For instance, there is a rule in the University of Ghana that if a student’s mark is 50
and above, then the student has based but if the mark is below 50 then the student
fails. To determine if a student has passed or failed, the formula is expressed as:

=IF (A2>=50, “PASS”, “FAIL”)

where A2 is the cell holding the mark of the student, >= is the comparison operator,
50 is the mark used in the condition, PASS and FAIL are the true and false values.
The PASS and FAIL are put into double quotes because they are considered a string
or text values.

Using the Nested IF Function


The nested IF Function is simply an IF comprised of another IF functions. Thus, when
an IF Function contains another IF Function, we refer to that as a nested IF Function.
The syntax of the IF function is:

=IF (logical_test, [value_if_true,], IF (logical_test), [value_if_true],....,


[value_if_true])

For instance, if the grading system in University of Ghana states that a student’s mark
between 100 and 80 is grade A, 79 to 60 is B, 59 to 50 is C, and 49 is F. Using the
Nested IF Function the formula will be expressed as:

=IF (A2>=80, “A”, IF (A2>=60, “B”, IF (A2>=50, “C”, “F”)))

where A2 is the cell holding the mark of the student, 80, 60, 50 are the lower limits of
the grading system on which the condition is built, >= is the comparison operator and
A,B,C, and F are the grade values if the conditions are true or false.

26
Lookup Function
Lookup functions find values in a column or a list of items and insert them in another
location in the worksheet such as cells or in formulas based on a particular criterion.
An exact match lookup is when the lookup value must match one of the comparable
values in the lookup column. Simply, the LOOKUP function finds items from a list
based on a criterion and matches them with a corresponding value. An approximate
match lookup occurs when the lookup value falls within a range of numbers in the
first column of the lookup column. The syntax of the LOOKUP Function is:

=LOOKUP (lookup value, lookup_vector, [lookup_result])

Using the example in the Nested IF function above, the LOOKUP version of the
formula is expressed as:

=LOOKUP (A2, {0, 50, 60, 80}, {"F","C","B","A"})

where A2 is the cell containing the mark of the student, {0,50,60,80} is the lookup
vector or the values to check for and {"F","C","B","A"} is the lookup result or the
corresponding results to assign to the respective lookup vector.

4.6 Comparison Operator


A comparison operator is a symbol that indicates the relationship between two values.
Comparison operators are mostly used with logical functions to test the true or false
value of the result. Figure 4.5 shows the comparison operators used in Excel. For
instance the = operator is used to test of values in two cells are equal, if the values are
equal, the result is true, but if the values are not equal, the result is false.

Figure 4.5 Excel comparison operators

27
5
Processing Financial Data with
Microsoft Excel
This chapter discusses some useful financial and how they support data processing in
Excel. The chapter covers:
 Payment function
 Present and Future value functions
 Interest and Principal payment Functions
 Loan Amortization process

5.1 Overview of Financial Functions


As discussed earlier, Excel provides a range of financial functions to process financial
related data. We will discuss popular financial functions use in business and
accounting for various financial calculations, such as depreciation of an asset, the
amount of interest paid on an investment, and the present value of an investment,
loans and interest payments. These financial functions are the Payment(PMT), Future
Value (FV), Present Value (PV), RATE, Loan Duration (NPER), Interest Payment
(IPMT), and Principal Payment (PPMT). Figure 5.1 presents these functions, their
syntax, and description. We will also combine earlier principles from cell referencing
to develop a loan amortization table.

Figure 5.1 Excel financial functions

28
5.2 Payment Function
This function calculates the periodic payment on a loan or against an investment. It is
expressed as:

=PMT (rate, nper, pv, [fv=0], [type=0])

where PMT is the payment function, rate is the interest rate per period or the rate of
return of an annuity, nper is the total number of periods, fv is the future value and
type indicates where payments will be made at the end of the period (0) or at the
beginning (1). In Excel any argument placed in square brackets, e.g. [fv=0] are
considered optional. Thus, in the PMT function, fv and type are optional arguments
are can be ignored or represented by 0 in calculations.

For instance, the PMT function can help calculate how much Kofi will pay monthly if
he contracts GHS 50,000.00 from a bank for a period of 5 years at an annual interest
rate of 30% to buy a car assuming payment is made at the end of the month. From the
example, the rate is 30% or 0.3 per year, nper is 5 years translating into 60 months
(5*12), pv is GHS50,000.00- the amount being borrowed. Thus, the monthly payment
by Kofi will be expressed as:

=PMT (0.30/12,5*12,50,000)
=GHS 1,617.67

The rate of 30% is divided by 12 while the period of 5 years is multiplied by 12


because the PMT seeks to calculate monthly payment to be made by Kofi. This
conversion is important to note to avoid mistakes. Figure 5.2 shows how the car loan
calculation is done in Excel using the payment function. The PMT value is in the
negative because the payment is not an income, but rather an expense that must be
paid. Also, note that actual values are not used in the Excel formula but rather cell
names. Because it is important to make the formula dynamic to accommodate future
changes.

29
Figure 5.2 Car loan calculator using PMT Function

5.3 Rate Function


This Function calculates the interest rate on a loan or an investment based on constant
period and constant payments. Given that, the RATE function features in the payment
function calculation. We can make RATE the subject of that equation expressed as:

=RATE (nper, pmt, pv, [fv=0], [type=0])

Figure 5.3 presents the reverse engineered equation to calculate the RATE value
based on Kofi’s car loan example above. Note that the formula is multiplied by 12 to
convert the monthly interest rate into an annual rate of 30%. Also, note the negative
value of PMT must be used in the calculation to arrive at accurate figures.

Figure 5.3 Calculating interest rate using RATE function

30
5.4 NPER Function
Calculates the number of periods required to pay off a loan or investment. NPER is
expressed as:

=NPER (rate, Pmt, pv, [fv=0], [type=0])

Based on the example above the NPER value of 5 was calculated as presented in
Figure 5.4. It is important to note the formula is divided by 12 to arrive at the yearly
loan duration of 5 years. Again, the negative PMT value must be used in the
calculation to arrive at the correct answer.

Figure 5.4 Calculating loan duration using NPER function

5.5 PV Function
This function calculates the present value of a loan or investment based on periodic,
constant payments. PV is expressed as:

=PV (rate, nper, pmt, [fv=0], [type=0])

Based on the example above the PV of 50000 was calculated as presented in Figure
5.5 by providing the rate, nper, and pmt values.

31
Figure 5.5 Calculating present value using the PV function

5.6 IPMT and PPMT Functions


The IPMT and PPMT are the functions that constitute the PMT function. IPMT
calculates the amount of a loan payment devoted to paying the loan interest while
PPMT calculates the amount of a loan payment devoted to paying off the principal of
a loan. Thus, the summation of IPMT and IPMT values equals the PMT amount.
IPMT and PPMT are expressed as follows respectively:

= IPMT (rate, per, nper, pv, [fv=0], [type=0]) and

=PPMT (rate, per, nper, pv, [fv=0], [type=0])

where Per is the number of the payment period. Figure 5.6 shows IPMT and the
PPMT values based on the car loan example. Given that IPMT and PPMT make up
PMT, their values should add up to the PMT value. That is, PMT =IPMT+PPMT.
From the example -1250+ (-367.67) = -1617.76 which is the initial PMT value. It is
important to note the PER value in the formula is 1, indicating that the calculation is
for the first period of the loan.

32
Figure 5.6 Interest and principal payment calculation using IPMT and PPMT

5.7 Future Value


This Function calculates future value of an investment. It is expressed as:

=FV(rate, nper, pmt, [pv=0], [type=0])

where rate is the interest rate per period, nper is the total number of periods, pmt is the
payment in each period, pv is the present value of the investment, and type indicates
whether payments should be made at the end of the period (0) or the beginning of the
period (1).

Drawing from the example above, what if Kofi decides to rather invest a fixed amount
of GHS 1,617.67 monthly for the same period (5 years) and per the same interest rate
30% to enable him buy the car with his investment. In this case, we can use the FV
Function as presented in Figure 5.7. It is expressed as:

=FV (0.30/12,5*12, 1617.67)

= GHS 219,989.49

33
Figure 5.7 Investment calculation using FV Function

5.8 Loan Amortization


Loan amortization is a process of paying for a loan bit by bit. Based on this principle,
the loan amortization helps to calculate the periodic payments of a loan detailing the
interest and principal payments as the balance at the end of each period. Per our car
loan example stated above, a loan amortization table is developed to detail out the
loan payment schedule for the entire period. Figure 5.8 presents the loan amortization
table showing the periods, interest and principal payments, monthly payment, as well
as the balance at each period. Given that the loan is contracted for a period of 5 years,
the payment period is extrapolated to 60 months to represent the PER values. The
IPMT is calculated as:

=-IPMT ($B$4/12, C17, $B$3*12, $B$2)

where $B$4/12 is the absolute value of the interest rate divided by 12, C17 is the first
payment period (PER), $B$3*12 is the loan duration multiplied by 12 (NPER), and
$B$2 is the absolute value of loan amount (PV). The RATE, NPER, and PV values
are converted into absolute because they will remain constant through the entire
duration of the loan. The PER was not made absolute because the formula want Excel
to perform relative referencing on the other periods until the 60th month. Lastly, the

34
formula is negated (-) at the beginning, so that only positive values can be provided.
The same logic is what is applied to the PPMT calculation.
Thus, similarly, the PPMT is calculated as:

=-PPMT ($B$4/12, C17, $B$3*12, $B$2)

Given that PMT =IPMT+PPMT, the values of IPMT and PPMT are added to get the
PMT value. Thus, PMT is calculated as =D17+E17

The balance at the end of each period is calculated by subtracting the PPMT from the
PV because; the principal payment PPMT is what reduces the loan value. Thus, to get
the balance on a loan at a particular period, the principal payment must be subtracted
from the previous value. In our example in Figure 5.8, at period 0, the balance is still
GHS 50,000.00 because no payment has been made. However, under period 1, the
PMT is assumed to be paid, thus the balance is calculated as:

=G16-E17,  (50,000 – 367.76 = 49,632.33)

Using the AutoFill handle, the subsequent values of each column (IPMT, PPMT,
PMT and balance) can be generated automatically. If done correctly, the balance cell
of period 60 should be GHS 0.00 as presented Figure 5.8 below.

35
Figure 5.8 Loan Amortization Table

36
6
Using Charts to Process Data in
Microsoft Excel
This chapter discusses how Excel charts aid in data processing and visualisation. The
chapter covers:
 Overview of Excel charts
 Excel chart categories
 How to create Excel charts
 Formatting charts

6.1 Overview of Charts


Charts are graphical representation of data in Excel by symbols such as bar lines in a
line and pie. Charts provide an alternative representation of numeric data in order to
drive better understanding. Charts can exist as objects in a worksheet - normally
containing the source data - or they can ‘standalone’ in their own sheet. Charts can
also be easily altered and amended once they have been created.

6.2 Chart Categories


There are different types of Excel charts. The chart categories are column, line, pie,
bar, scatter, stock, doughnut, surface, bubble, and radar. Figure 6.1 shows the various
Excel chart categories and their description. These chart categories are designed for
appropriate data visualisation. As such, based on the type of data, appropriate chart is
needed to visualise the data. For instance, to visualise the gender distributions in a
class, the pie, bar and column charts may be more appropriate. You can apply a wide
variety of chart types to the selected data source. Excel supports 73 built-in charts
organized into 11 categories, but you can also create custom chart types based on the
built-in charts. For example, a pie chart provides the best way to show the breakout of
the asset data you selected. A pie chart is a chart in the shape of a circle (like a pie)
that shows the data values as a percentage of the whole. Each value in the data series
represents a slice of the pie. The larger the value, the larger the pie slice.

37
Figure 6.1 Excel chart categories

6.3 How to create Excel Charts


There are different methods of creating Excel charts. Two methods are presented
below.

Method 1
 First highlight the data to be visualised
 Go to the Insert tab and click on chart type that you wish to use
 Alternatively, click on the recommend chart command so that Excel can
suggest appropriate chart types for the data selected.

Figure 6.2 demonstrates how a column chart is created using method 1 explained
above.

38
2

4 3

Figure 6.2 Creating a Column chart using method 1

Method 2
 Go to the Insert tab on the ribbon
 Click on the chart type you wish to create for the design tab to become active
 Click on Select Data from the design tab to have the data source dialog box
appear
 Use the cursor to select the entire data to be visualised and Excel should
automatically guess the appropriate data to use for the Legend Entries (series)
column and the Horizontal category (Axis) Label.
 In some case, Excel may guess inaccurately, thus the add, edit, remove buttons
can be used to select the appropriate data

Figure 6.3 shows how a Pie chart is created based on method 2 outlined above.

39
Figure 6.3 Creating a pie chart using method 2

6.4 Formatting Charts


After creating charts, Excel provides a chart-formatting tab to add more details.
Charts include individual elements that can be formatted, including the chart area, the
chart title, the plot area, data markers, and a legend. You can choose which of these
elements to include in the chart as well as how each element looks. You can make
these changes using a built-in style that formats the entire chart or by selecting and
formatting an individual element.

To apply formatting to an individual chart element, you can double-click that chart
element to open a dialog box with format options specific to the selected element.
You can also open the dialog box by clicking the appropriate element button on the
format tab.

40
7
Processing Data with Databases:
An Overview of Microsoft Access
This chapter discusses how databases aid in data processing. Microsoft Access is used
as the database management systems for demonstration. The chapter covers:
 Overview of Databases
 Importance of a Database
 Basic Database Terminologies
 Introduction to Microsoft Access
 How to create an Access Database

7.1 Overview of Databases


Database is a self-describing collection of related records. A database contains the
definition of its structure referred as to a metadata. The purpose of a database is to
help keep track of things, and the most commonly used type of database is the
relational database. A relational databases store data in tables. A database usually has
multiple related tables that contain data about different things. For instance,
University of Ghana’s Database will have tables on Students, Lecturers, Programs,
Departments, Colleges, etc.

7.2 Importance of a Database


The main importance of a database is to:
 To keep track of events
 Stores complex data relationships
 Minimizes data redundancy
 Ensures proper data security
 Addresses data modification issues

41
7.3 Basic Database Terminologies
Entity
An entity is something of importance to a user that needs to be represented in a
database. An entity represents one theme or topic. Example of entities in University of
Ghana’s database will include Students, Grades, Courses, Departments, Staff, Halls,
etc.

Relation
A relation is a two-dimensional table that has specific characteristics. The table
dimensions, like a matrix, consist of rows and columns.

Employee Number First Name Last Name


100 Mary Abernathy
101 Jerry Cadley
104 Alex Copley
107 Megan Jackson
Figure 7.1 An example of a table

Attribute
An attribute is a characteristic of an entity. Thus, attributes describe an entity.
Attributes are represented by columns or fields in a relation. For instance, the
attributes of a student entity will include, student ID, first name, last name, date of
birth etc.,

Record
A record is an instance of an entity. It also shows the occurrence of an entity. Records
are represented by rows in a relation. Example of a record for a student entity is:
1020100 John Doe 12/12/1990

Key
A key is one (or more) column(s) of a relation that is (are) used to identify a row.
There are different types of keys in database management, such as primary, foreign
candidate, composite, surrogate etc.

42
A composite key contains two or more attributes that uniquely identify a record in a
table. A candidate key is potential primary key, but has not been selected yet. A
surrogate key is a unique, numeric value that is added to a table to serve as temporal
identify for records in a table. Surrogate key values have no meaning to users and are
usually hidden on forms, queries, and reports. A surrogate key is often used in place
of a composite key.

Primary key is a unique attribute chosen distinctively identify records in a relation or


table. If you know the value of the primary key, you will be able to identify a single
row. For instance, StudentID is a unique attribute to identify every student.

Foreign key is a primary key from one table placed into another table in order to
establish a relationship between the two tables. The key is called a foreign key in the
table that received the key

Figure 7.2 Primary and foreign keys

Relationships
Relationship refers to an association between two entities in a database. Given that
entities translate into tables, relationships are sometimes conceptualised at the table
level. For instance, (see Figure 7.2 above) an employee belongs to a department,
therefore, there is a relationship between employee (entity) and department (entity).

Referential integrity
Refers to a set of rules that a database enforces to maintain consistency between
related tables when you update data in a database. Referential integrity states that

43
every value of a foreign key must match a value of an existing primary key. For
instance, If EmpID = 4 in EMPLOYEE has a DeptID = 7 (a foreign key), a
Department with DeptID = 7 must exist in DEPARTMENT. The primary key value
must exist before the foreign key value is entered.

To sum up the discussion on the basic database terminologies, Figure 7.3 is presented.
From the figure, there are two tables; Supplier and Part. The columns of each table
represent the attributes or fields while the rows represent records or tuples. The
Suplier_Number and Part_Number are the respective primary keys of the two tables.
Given that there is a relationship between Part and Supplier, the supplier_Number is
placed in the Part table as foreign key.

Figure 7.3 Tables and the characteristic in a database

7.4 Introduction to Microsoft Access


Microsoft Access is a database management system (DBMS) use to create, process,
and administers databases. Access comprise 7 components for data processing,
namely Tables, Relationships, Queries, Forms, Reports, Macros, Modules. Access
stores database files with the .mdb extension. Access also accepts data from other
sources such as Excel, SQL etc. for manipulation. Access is considered a personal
DBMS due to some restriction in its use in large enterprises. Figure 7.4 shows an
Access window with a description of the various parts.

44
Figure 7.4 Microsoft Access Window

7.5 How to create an Access Database


To create an Access database, the program must be started. Thus, the discussion will

explain how to start and create Access databases. There are several ways to start

Access application. Two methods are presented here.

Method 1

• Press the Windows key from the keyboard or click on the Windows icon from
the task bar to bring up the start-up menu as presented in Figure7.5
• Go to All programs
• Select Microsoft Office folder and click on Microsoft Access from the list.

45
2
3

Figure 7.5 Starting Microsoft Excel

Method 2
To start Access using this method (see Figure 7.6)

• Press Windows key and R together from the keyboard. Alternatively, type
RUN in start-up menu search box
• Type MSACCESS in the RUN dialog box
• Press OK or enter from the keyboard

46
Figure 7.6 Run dialog box

Thereafter, the Access start-up window appears. Unlike other Microsoft office
programs, Access database must be created first before other manipulation can occur.
Figure 7.7 shows the Access start-up window and how a new blank database is
created by providing a database name in the file name and clicking the create button.
Alternatively, an existing Access template can also be used instead of a blank
database.

Figure 7.7 Access start-up window

47
8
Working with Microsoft Access
Table
This chapter discusses how Tables support data processing in Access. The chapter
covers:
 Overview of Tables in Access
 Defining a Table
 How to create Tables in Datasheet View
 How to create Tables in Design View
 Adding records Tables
 Defining Table Relationships

8.1 Overview of Access Tables


Tables are a major component of databases. They are the object that forms the
structure and hold data on entities in databases. For instance, they keep record of
students in a database, the student entity would be translated into the student Table.
Tables are made up of attributes, data types, identifiers, and records. The discussion
below explains some of these terminologies

8.2 Defining a Table


Before creating a table, there is a need to define the table by identifying the attributes
and their corresponding data types, relationships, as well as the identifiers. In this
subsection, let us consider a Visit Table of a hospital to explain the table definition
process.

First, we define the Table fields and their purpose in the table. For instance, there is a
VisitID which is a unique attribute to help identify records in Visit Table. Table 8.1
provides some fields and their purpose in the Visit Table.

48
Field Purpose

VisitID Unique number assigned to each visit; will serve as the table's primary
key
PatientID Unique number assigned to each patient; common field that will be a
foreign key to connect to the Patient table
VisitDate The date on which the patient visited the clinic

Reason Reason/diagnosis for the patient visit

Walkln Whether the patient visit was a walk-in or a scheduled appointment

Table 8.1 Sample table

One of the most important tasks in creating a table is deciding what names to specify
for the table’s fields. Keep the following guidelines in mind when you assign field
names:
 A field name can consist of up to 64 characters, including letters, numbers,
spaces, and special characters, except for the period (.), exclamation mark (!),
grave accent (`), and square brackets ([ ])
 A field name cannot begin with a space
 Capitalize the first letter of each word in a field name that combines multiple
words, for example VisitDate
 Use concise field names that are easy to remember and reference, and that
won’t take up a lot of space in the table datasheet
 Use standard abbreviations, such as Num for Number, Amt for Amount and
Qty for Quantity, and use them consistently throughout the database. For
example, if you use Num for Number in one field name, do not use the
number sign (#) for Number in another
 Give fields descriptive names so that you can easily identify them when you
view or edit records

8.3 Creating a Table in Datasheet View


Datasheet view shows a table’s contents in rows (records) and columns (fields). Each
column is headed by a field name inside a field selector. Each row has a record
selector to its left. Clicking a field selector or a record selector selects that entire

49
column or row (respectively). A field selector is also called a column selector. A
record selector is also called a row selector. Figure 8.1 shows the Visit Table in a
Datasheet View.

To create a table in Datasheet View:


 Click the Create tab on the Ribbon
 In the Tables group, click the Table button
 Accept the default ID primary key field with the AutoNumber data type, or
rename the field and change its data type, if necessary
 In the Add & Delete group on the Fields tab, click the button for the type of
field you want to add to the table (for example, click the Text button), and
then type the field name. Repeat this step to add all the necessary fields to the
table.
Or
 In the table datasheet, click the Click to Add column heading, click the type of
field you want to add from the list that opens, type the field name, and then
press the Tab or Enter key to move to the next column in the datasheet. Repeat
this step to add all the necessary fields to the table.
 In the first row below the field names, enter the value for each field in the first
record, pressing the Tab or Enter key to move to the next field.
 After entering the value for the last field in the first record, press the Tab or
Enter key to move to the next row, and then enter the values for the next
record. Continue this process until you have entered all the records in the
table.
 Click the Save button on the Quick Access Toolbar, enter a name for the table,
and then click the OK button.

50
Figure 8.1 Creating Table in Design view

Renaming the Default Primary Key Field


To rename the ID field to the VisitID field:
 Right-click the ID column heading to open the shortcut menu, and then click
Rename Field. The column heading ID is selected, so that whatever text you
type next will replace it
 Type VisitID and then click the row below the heading. The column heading
changes to VisitID, and the insertion point moves to the row below the
heading. Notice that the TABLE TOOLS tab is active on the ribbon. This is a
contextual tab, which appears and provides options for working with objects
selected. Figure 8.2 shows how to rename a field name in a Datasheet View.

Figure 8.2 Changing the default primary key in Datasheet View

Changing the Data Type of the Default Primary Key Field


Notice the Formatting group on the FIELDS tab (One of the options available in this
group is the Data Type option). Each field in an Access table must be assigned a data
type. The data type determines what field values you can enter in the field. The
AutoNumber data type automatically inserts a unique key for every record, beginning

51
with the number 1 for the first record, the number 2 for the second, etc. Figure 8.3
shows how to change a datatype in a Datasheet View.

Figure 8.3 Changing the default data type in a Datasheet View

Adding New Fields


When you create a table in Datasheet view, you can use the options in the Add &
Delete group on the FIELDS tab to add fields to your table. You can also use the
Click to Add column in the table datasheet to add new fields. Figure 8.4 shows how to
add new fields in the Datasheet View.

Figure 8.4 Adding new columns in Datasheet View

8.4 Creating a Table in Design View


Creating a table in Design view involves entering the field names and defining the
properties for the fields, assigning appropriate data type, specifying a primary key for
the table, and then saving the table structure. Figure 8.5 shows how a table is created
in the Design View.

52
 Click the Create tab on the Ribbon
 In the Tables group on the Create tab, click the Table Design button. A new
table named Table1 opens in Design view
 Type the field name, select appropriate data types, and provide a description of
the field. Note that the description field is optional
 Press the Tab key to advance to the next field until all the fields are provided.
 Finally, set the property for the fields

Defining Fields
When you first create a table in Design view, the insertion point is located in the first
row’s Field Name box, ready for you to begin defining the first field in the table.
 Enter values for the Field Name, Data Type, and Description field properties,
and then select values for all other field properties in the Field Properties pane.
These other properties will appear when you move to the first row’s Data
Type box.
 Identify all the fields needed to produce the required information. Organize
each piece of data into its smallest useful part
 Group related fields into tables
 Determine each table’s primary key
 Include a common field in related tables to create relationships
 Avoid data redundancy

Figure 8.5 Creating a Table in a Design view

53
Naming Fields and Objects
To name fields and objects, the following steps are recommended.
 Provide a name for each field, table, and other object in an Access database
 Assigning Field Data Types
 Each field must have a data type
 Data types are assigned automatically by Access or specifically by the table
designer
 The data type determines what field values you can enter in the field and what
other properties the field will have

Guidelines for Setting Field Properties


 Naming Fields and Objects
 You must name each field, table, and other object in an Access database
 Assigning Field Data Types
 Each field must have a data type
 Data types are assigned automatically by Access or specifically by the table
designer.

The data type determines what field values you can enter in the field and what other
properties the field will have. Figure 8.6 shows the various Access data types, their
description, and acceptable field size. For instance, the short text data type allows
associated fields to accept letters, digits, spaces, and special characters. The short text
data type also allows a field size of 0 to 255 characters. Thus, the values entered into a
short text data type field cannot be more than 255.

54
Figure 8.6 Access Data types

Setting Field Sizes


The Field Size property defines a field value’s maximum storage size for Short Text,
Number, and AutoNumber fields only. The other data types have no Field Size
property because their storage size, either is a fixed, predetermined amount or is
determined automatically by the field value itself

Setting the Caption Property for Fields


The Caption property for a field specifies how the field name is displayed in database
objects. If you do not set the Caption property, Access displays the field name as the
column heading or label for a field

Specifying the Primary Key


A primary key uniquely identifies each record in a table. Access does not allow
duplicate values in the primary key field. When a primary key has been specified,
Access forces you to enter a value for the primary key field in every record in the
table (entity integrity). You can enter records in any order, but Access displays them
by default in order of the primary key field values. Access responds faster to your

55
requests for specific records based on the primary key. Save the Table structure by
providing a name that reflects the entity. Figure 8.7 shows how to assign a primary
key to a table in the Design view.

Figure 8.7 Assigning a primary key

8.5 Adding Records to a Table


After a table is created, the next task is to enter the data into the table for further
processing. To add data to a Table, it must be opened in the Datasheet View. Table
8.2 provides a sample data based on the Visit table created earlier to demonstrate the
recording adding process.

VisitID PatientID VisitDate Reason Walkln


1550 22549 12/1/2015 Influenza Yes
1527 22522 11/9/2015 Allergies Yes
1555 22520 12/7/2015 Annual wellness visit No
1542 22537 11/24/2015 Influenza Yes
1530 22510 11/10/2015 Seborrheic dermatitis No
1564 22512 1/5/2016 Annual wellness visit No
1575 22513 1/13/2016 Broken leg Yes
1538 22500 11/17/2015 Migraine Yes
Table 8.2 Sample data for the Visit table

Once the table is opened in the Datasheet View, you can enter the data starting from
the VisitID column to the WalkIn. Figure 8.8 shows how records are added to an
Access Table.

56
Figure 8.8 Entering records to a table

Saving a Table
Records entered in an Access table are immediately stored in the database as they are
entered. However, the table’s design items such as the field names and characteristics
of the fields themselves, plus any layout changes to the datasheet are not saved until
you save the table. When you save a new table for the first time, you should give it a
name that best identifies the information it contains. Like a field name, a table name
can contain up to 64 characters, including spaces

8.6 Table Relationships


One of the most powerful features of a relational database management system is its
ability to define relationships between tables. You use a common field to relate one
table to another. The process of relating tables is often called performing a join. When
you join tables that have a common field, you can extract data from them as if they
were one larger table. For example, the Patients and the Visits tables can be joined
together using a common field like PatientID. Thereafter, a query, form, or report can
be used to extract selected data from each table, even though the data is contained in
two separate tables. Figure 8.9 shows Table relationships in Access. There are three
main Table relationships in Access, namely One-to-One, One-to-Many, and Many-to-
Many. These relationships are discussed below.

One-to-One
This relationship exists when one instance of a table has only one relationship with
one instance of another table. This means that at any point in time, the records in one
table can have only a single unique relationship with another record in a different
Table. For instance, if each student in the University of Ghana is given a laptop, then

57
there is a one to one relationship between a student and a laptop. Thus, a student
cannot have two laptops and one laptop cannot be assigned to two students.

Figure 8.9 Table relationships

One-to-Many Relationships
A one-to-many relationship exists between two tables when one record in the first
table matches zero, one, or many records in the second table, and when one record in
the second table matches at most one record in the first table. For instance, one
customer can make one or more purchases, but the purchases can only be attributed to
a single customer.

Many-to-Many
In this relationship, one or more instances of one table have a relationship with one or
more instance of another table. For instance, in the University of Ghana, one or more
students can register for one or more courses in a semester. This scenario creates a
many-to-many relationship among the students and the courses table.

58
9
Working with Microsoft Access
Forms

This chapter discusses Microsoft Access Form and how it aids in data processing. The
chapter covers:

 Overview of Access Forms


 Creating Access Forms
 Modifying a Form

9.1 Overview of Forms


Form is an Access object that enables data entry into tables. Even though data can be
entered into Tables, using the Datasheet View, a more convenient and appropriate
approach is to use Forms. With Forms, data can be entered into two or more tables at
the same time, whereas this is difficult with Tables. In addition, Forms also display
records in the Layout so that you can make design changes to the form while it is
displaying data, to enable you can see the effects of the changes you make
immediately.
There are many ways to create Access Forms; the discussion below will present so of
the approaches. It is important to note that a Table or query must be created first
before Forms can be created.

9.2 Creating Access Forms Using Form View


This is the simplest way to create an Access Form.
 Select the Table for which the Form is to be created in the object pane
 Click on the Create Tab in the ribbon
 Go to the Form category and click on Form

59
A new Form should be created automatically bearing the name of the table on which
the Form was created. Figure 9.1 shows a sample form created using the Form
approach.

Figure 9.1 Creating a Form using the Form View

9.3 Creating a Form using the Form Design View


To create a Form using the Form design,
 Click the Create Tab.
 Go to the Forms Group and click the Form Design button. The Form Design
window will display as presented in Figure 9.2

Figure 9.2 Form Group

 The Form Design Tools tab will also appear at the top of the ribbon. The three
tabs under this option are Design, Arrange, and Format.
Click the Form Design Tools: Design Tab if necessary. In the Tools Group,
click the Add Existing Fields button as presented in Figure 9.3. The Field List
Task Pane will display. This list contains a list of the tables in the database.
 Click the Show All Tables link in this task pane if the list of tables does not
appear.
 Click the plus (+) sign next to the Table you wish to use on the Form to show
the Field Names in the table.

60
Figure 9.3 Form Design Tools

 Drag a Field from the Table to the Form to be included. The label for the field
will appear to the left of the field control box.
 Repeatedly drag other Fields to be used for the Form to complete the design.
Instead of dragging the fields individually, the Shift key can be held down and
the last Field selected. The list of Fields should be highlighted and ready to be
dragged to the Form to complete the design.

9.4 Creating Forms Using Form Wizard


Under this approach, the Form creation process goes through a systematic procedure
referred to as a wizard. To create a Form using the Form wizard:
 Click the Create Tab on the ribbon
 Go to the Form group and select the Form Wizard. The wizard displays a
window as presented in Figure 9.4 for the Tables/Queries on which the Form
will be created to be selected. When a Table/Query is selected, the Field
within them appears in the Available Fields column.
 Select the Fields to be included in the form and click the button with the single
angle bracket.
 When appropriate Fields are selected, then click Next button
 Select an appropriate Layout from the templates presented in Figure 9.5

Figure 9.4 Form Wizard window

61
Figure 9.5 Layout Window of the Form Wizard

 Click Next to choose the Form item sort order or chose Finish to complete the
Form Wizard. The Form should now be created and populated by the data in
the Tables / Queries used. Figure 9.6 shows a final Form created using the
Form Wizard.

Figure 9.6 Sample Form created using the Form Wizard

9.5 Modifying Access Forms


Forms can be edited after they have been created. To modify a form:
 Open the form in either the Form Layout or Design View by clicking the View
button on the ribbon
 In the Tools Group, click the Property Sheet button
 In the Property Sheet window, select Form from the Selection type list.
 Select the Format tab, if necessary.
 Modify the Form by either removing or adding new Fields, changing Field
sizes, fonts, style etc.

62
10
Working with Microsoft Access
Queries and Reports

This chapter discusses how to retrieve and present data using Microsoft Access Query
and Report objects. The chapter covers:

 Overview of Microsoft Access Query


 How to create Queries
 Overview of Microsoft Access Report
 How to create Reports

10.1 Overview of Microsoft Access Query


A query is an Access object for reviewing, adding, changing, or deleting data from
Tables in a database. A query allows specific questions to be asked about data that
would be difficult to answer by looking at the table data directly. Queries also allow
data filtration, calculations, and summarization of data. You can also use queries to
automate many data management tasks and to review changes in your data before you
commit to those changes. The result of a query is referred to as a recordset because
the query produces a set of records that answers.

10.2 Creating and Running a Query


Creating Query using the Query Wizard
To create a query using the query Wizard:

 Select Create from the create tab


 Select Simple Query Wizard, and then select OK.
 Select the table or query that contains the field, and then add the field to the
Selected Fields list. Add as many fields as you want from as many tables as
you want. When you are finished, click Next and thereafter click Finish to run

63
the query. A recordset should be created with the result of the query. Figure
10. 1 shows the query wizard window for creating queries.

Figure 10.1 Query wizard

Creating Query using the Query Design


To create a Query in the Query Design:

 Click on the create Tab in the ribbon


 Go to the Query group and select Query Design
 Select the Tables/Queries you want to use from the show table dialog window
 Double click on the fields from the Table that you required from the
Table/Query selected in the previous step. Repeat this step until all desire
fields are selected.
 Click on the Run button under the design Tab in the ribbon.

64
 Add other query options such as sort, criteria, show and OR for specific
results.
Figure 10.1 shows how to create and run queries using the Query Design.

Figure 10.2 Query Design

10.3 Sorting Data in a Query


Sorting is the process of rearranging records in a specified order or sequence.
Sometimes you might need to sort data before displaying or printing it to meet a
specific request. To sort records, you must select the sort field, which is the field used
to determine the order of records in the datasheet

Data Type Ascending Sort Results Descending Sort Results

Short Text A to Z (alphabetical) Z to A (reverse alphabetical)


Number Lowest to highest numeric value Highest to lowest numeric value
Date/Time Oldest to most recent date Most recent to oldest date
Currency Lowest to highest numeric value Highest to lowest numeric value
AutoNumber Lowest to highest numeric value Highest to lowest numeric value
Yes/No Yes (checkmark in check box) then no values No then yes values

Table 10.1 Query result sorting per data type

65
10.4 Filtering Data
A filter is a set of restrictions you place on the records to temporarily isolate a subset
of the records. Filtrating allows you to view different subsets of displayed records so
that you can focus on only the data you need. An applied filter is not available the
next time you run the query or open the form (unless it has been saved). The simplest
technique for filtering records is Filter by Selection. This technique lets you select all
or part of a field value in a datasheet or form, and then display only those records that
contain the selected value in the field. Another technique for filtering records is to use
Filter by Form, which changes your datasheet to display blank fields. Figure 10.3
shows a query data filtration.

Figure 10.3 Filtering data

10.5 Defining Queries Record Selection Criteria


To tell Access which records you want to select, you must specify a condition as part
of the query. A condition usually includes one of the comparison operators. Figure
10.4 shows the operators, their meaning and an example of how they can use in a
query.

66
Figure 10.4 Query record selection criteria

10.6 Overview of Microsoft Access Report


A report is a formatted printout (or screen display) of the contents of one or more
tables or queries. Reports show each field in a column, with the field values for each
record in a row, similar to a table or query datasheet. Reports offer a more visually
appealing format for the data, with the column headings in a different colour, borders
around each field value, a graphic of a report at the top left, and the current day, date,
and time at the top right

10.7 Creating Reports


Creating Reports using the Report command
This is the simplest approach to create reports.
 First, select the table or query on which the report will be based.
 Click on Create Tab and go to the Report group
 Click on the Report button and a Report should be created based on the
Table/Query selected initially.

Creating Reports using the Report Wizard


To create a report based on the Report wizard, a systematic procedure is presented.
 Click on the Create Tab in the ribbon and go to the report group
 Click on the Report wizard for the window. The wizard displays a window as
presented in Figure 10.5 for the Tables/Queries on which the Report will be
created to be selected. When a Table/Query is selected, the Field within them
appears in the Available Fields column
 Select the Fields to be included in the Report and click the button with the
single angle bracket.

67
 When appropriate Fields are selected, then click Next button
 Select an appropriate Layout from the templates presented in Figure 10.6
 Click Next to choose the Report item sort order or Finish to complete the
Form Wizard. The Report should now be created and populated by the data in
the Tables / Queries used. Figure 10.7 shows a final Form created using the
Form Wizard.

Figure 10.5 Report wizard window

68
Figure 10.6 Report wizard layout window

Figure 10.7 Sample Report created using the wizard

10.8 Modifying Reports


Reports can be edited after they have been created. To modify a report:
 Open the Report in either the Report Layout or Design View by clicking the
View button on the ribbon
 In the Tools Group, click the Property Sheet button
 In the Property Sheet window, select Report from the Selection type list.
 Select the Format tab, if necessary.
 Modify the Report by either removing or adding new Fields, changing Field
sizes, fonts, style etc.

69

You might also like