introduction to excel - hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617gd... · introduction...

45
Part One Introduction to Excel October 2016 Written by N.Nilgün Çokça

Upload: lenguyet

Post on 08-Sep-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Part One

Introduction to Excel

October 2016

Written by

N.Nilgün Çokça

Page 2: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

EXCEL FOR ECONOMICS

CHAPTER ONE

INTRODUCTION TO MICROSOFT EXCEL

Introduction to Spreadsheets

A spreadsheet is the computerized equivalent of an accountant's ledger. As with the ledger, it

consists of a grid of rows and columns that enables you to organize data in a readily

understandable format.

"What is the big deal?" you might ask. The big deal is that after you change an entry (or entries),

the spreadsheet will, automatically and almost instantly, recomputed all of the formulas.

With a calculator and bottle of correction fluid or a good eraser, the same changes could also

be made to the ledger. But imagine for a moment a ledger with hundreds of entries, many of

which depend on the entry you wish to change. You can appreciate the time required to make

all the necessary changes to the ledger by hand. The same spreadsheet, with hundreds of entries,

will be recomputed automatically by the computer.

A worksheet is made up of columns and rows. The intersection of a column and a row forms a

block, or a cell. The border around the first cell on the worksheet tells you that this is the active

cell. This is the cell that will be affected by the next entry or command.

Each cell has a unique address, or reference. The cell reference of the active cell shows in the

Name box. The cell reference is A1 because the active cell is located in column A, row 1.

The mouse pointer has a plus-sign shape when it is in the worksheet area. The pointer changes

shape depending on its location and the action you are performing.

Row and Column Headings

A spreadsheet is divided into rows and columns, with each row and column assigned a heading.

Rows are given numeric headings ranging from 1 to 16.384 (the maximum number of rows

allowed). Columns are assigned alphabetic headings from column A to Z, then continue from

Page 3: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[3]

AA to AZ and then from BA to BZ and so on, until the last of 256 columns (column IV) is

reached.

The intersection of a row and column forms a cell, with the number of cells in a spreadsheet

equal to the number of rows times the number of columns. Each cell has a unique cell reference;

for example, the cell at the intersection of column A and row 9 is known as cell A9. The column

heading always precedes the row heading in the cell reference.

Formulas and Constants

A constant is an entry that does not change; that is, it may be a number, such as a student’s

grade on an exam, or it may be descriptive text (a label), such as a student’s name. A formula

is a combination of numeric constants, cell references, arithmetic operators, and/or functions

that display the result of a calculation. Every cell in a spreadsheet contains either a formula or

a constant.

A formula always begins with an equal sign; a constant does not. Consider, for example, the

formula in cell E3, =(B3+C3+2*D3)/4, which computes Student’s semester average. The

formula is built in accordance which counts the final twice as much as either exam. Excel uses

symbols +, -, *, /, and ^ to indicate addition, subtraction, multiplication, division, and

exponentiation, respectively and follows the normal rules of arithmetic precedence.

INTRODUCTION TO MICROSOFT EXCEL

Microsoft Excel is a Windows application, and thus shares the common user interface with

which you are already familiar.

Page 4: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[4]

Each window has its own Minimize, Maximize (or Restore), and Close buttons. Both windows

have been maximized and thus the title bars have been merged into a single title bar that appears

at the top of the application window. The title bar reflects the application (Microsoft Excel) as

well as the name of the workbook (Book1) on which you are working. A menu bar appears

immediately below the title bar. Two toolbars appear below the menu bar. Vertical and

horizontal scroll bars appear at the right and bottom of the document window.

The terminology is important, and we distinguish here between spreadsheet, worksheet, and

workbook. Excel refers to a spreadsheet as a worksheet. Spreadsheet is a generic term;

workbook and worksheet are unique to Excel. An Excel workbook contains one or more

worksheets.

The heavy border around cell E3 indicates that it (cell E3) is the active cell. Any entry made at

this time is made into the active cell, and any commands that are executed affect the contents

of the active cell. The active cell can be changed by clicking a different cell, or by using the

arrow keys to move to a different cell.

The displayed value in cell E3 is 88.0, but as indicated earlier, the cell contains a formula to

compute the semester average rather than the number itself. The contents of the active cell,

=(B3+C3+2*D3)/4, are displayed in the formula bar near the top of the worksheet. The cell

reference for the active cell appears in the Name Box at the left of the formula bar.

The Excel Workbook

An Excel workbook is the electronic equivalent of the three-ring binder. A workbook

contains one or more worksheet (or chart sheets), each of which is identified by a

tab at the bottom of the workbook. The worksheets in a workbook are normally

related to one another; for example, each worksheet may contain the sales for a

specific division within a company. The advantage of a workbook is that all of its

worksheets are stored in a single file, which is accessed as a unit.

The status bar at the bottom of the worksheet keeps you informed of what is happening as you

work within Excel. It displays information about a selected command or an operation in

progress. It also shows the status of the keyboard toggle switches, such as the Caps Lock key

or the Ins key, neither of which has been toggled on.

Page 5: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[5]

Toolbars

Excel provides several different ways to accomplish the same task. Commands may be accessed

from a pull-down menu, from a shortcut menu (which is displayed by pointing to an object and

clicking the right mouse button), and/or through keyboard equivalents. Commands can also be

executed from one of many toolbars that appear immediately below the menu bar. The Standard

and Formatting toolbars are displayed by default.

The Standard toolbar contains buttons corresponding to the most basic commands in Excel-for

example, opening and closing a workbook, printing a workbook, and so on. The Formatting

toolbar appears under the Standard toolbar, and provides access to common formatting

operations such as boldface, italics, or underlining.

The toolbars may appear overwhelming at first, but there is absolutely no need to memorize

what the individual buttons do. That will come with time. Indeed, if you use another office

application such as Microsoft Word, you may already recognize many of the buttons on the

Standard and Formatting toolbars.

Entering Data

Data is entered into a worksheet by selecting a cell, then typing the constant or formula that is

to go into that cell. The entry is displayed in the formula bar at the top of the window as it is

being typed. The entry is completed by pressing the enter key, which moves the active cell

immediately below the current cell, or by pressing any of the arrow keys to move to the next

cell in the indicated direction. Pressing the right arrow key, for example, completes the entry

and moves the active cell to the next cell in the same row. You can also complete the entry by

clicking in a new cell, or by clicking the green check that appears to the left of the formula bar

as data is entered.

Save often.

A loss of power, whether it's your fault or the power company's can destroy a

creative masterpiece. The best insurance is to save your work constantly and, in

addition, to save your work whenever you are interrupted by a phone call, the

doorbell, etc.

Page 6: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[6]

To replace an existing entry, select the cell by clicking in the cell, or by using the keyboard to

move to the cell. Type the corrected entry (as though you were entering it for the first time),

then complete the entry as described above.

MATHEMATICAL FUNCTIONS AND FORMULAS

Excel is NOT a statistics or econometrics software package it is a very powerful

spreadsheet program in which you can set up worksheets containing numbers and

formulas, create graphs and print the results.

In Excel when you want to write an equation you must start with “=” (equal to)

5+24 you must write 5+2^4

In mathematical form whether + or – sign would do the same. +A5-2^5

5^1/2 or 5^0,5 or SQRT(5)

The order of mathematical functions are:

( ) in side of parenthesis

- negative

% percentage

^ power

/,* division, multiplication

+, - sum, subtraction

Page 7: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[7]

Examples:

1

=5+2*3^(1/2) 8,46

2

=(5^3-4^3)/(105+8^(1/3)) 0,57

3

=(3+5^0.5+1/(1+6^0.5))/(2+1/(1+3^0.5)) 2.335548

4

=(3+7^0,5+(12%-9^0,5)/6^3)/(8-4/(1+3^0,5)) 0,861766

5

=(8-(4/(3^0,5)))//(3-7^0,5+(12%-9^0,5)/6) -51,9748

Creating a Table of One Variable Function

y=x2 y=x3

x=1,2,3…….10 x2=? x3=?

Steps for creating a table of x2, x3.

Step 1. Click A1 and type X, in to B1 type X^2, into C1 type X^3.

Step 2. Write 1 to 10 in cells A3:A12 by using Edit/Fill/Series Command.

Edit/Fill/Series

Type 1 into A3 click Edit menu

select Fill/Series command

Select Column as Series in,

Page 8: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[8]

Linear as Type,

Step Value: 1

Stop Value: 10

Click OK

Step 3. Click cell B2 and type =A2^2

Click cell C2 and type =A2^3

A2 must be empty.

Step 4. Highlight A2:C12 select Data menu Table command.

Click into Column input cell then click A2, then OK.

Page 9: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[9]

Creating Table of Two Variables Function

x=1,2,3,...,5

Y=1,2,3,...,6

U(3,4)=? U(5,2)=? U(5,6)=?

U(x,y)= x / 2+y2

x=1,2,3……5 y=1,2,3……6

Steps for creating table of U(x,y):

Step 1. Write x variables into B1:F1, and y variables into A2:A7 by using Fill/Series command.

Step 2. Write formula x/2+y2 using Z1 for x, Z2 for y.

=Z1/(2+Z2^2) Z1 and Z2 are must be empty.

Step 3. Highlight A1:F7 select Data/Table.

Row input cell : Z1 as X

Column input Cell : Z2 as Y

Page 10: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[10]

Then click OK.

C6 0,0740741 is for X=2 and Y=5 U(2,5)= 2/(2+5^2) 0,0740741

You can download Excel spreadsheet for these applications from the website. Excel_app_I.xlsx

Page 11: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[11]

Matrix

The most general concept to introduce in the new algebra is that of a matrix of any dimensions.

A matrix is an ordered arrangement (not a single value) of a set of elements.

Definition: A matrix of order m x n is a set of m x n elements form the field F of real numbers,

arranged in rectangular from in m rows and n columns; it is denoted

𝐴 = [𝑎𝑟𝑠] [

𝑎11 𝑎12 ⋯ 𝑎1𝑛

𝑎21 𝑎22 ⋯ 𝑎2𝑛

⋮ ⋮ ⋯ ⋮𝑎𝑚1 𝑎𝑚2 ⋯ 𝑎𝑚𝑛

]

where r=1.2…….m denotes the rows and s=1.2……m the columns.

The order of the matrix, if not obvious, must always be specified and this can be done by giving

the range of values taken by r and s. the matrix is square when m=n and rectangular when mn;

in the latter case, m may be greater or less than n. There is no particular geometrical or

diagrammatic interpretation of a matrix and the terms “square” and “rectangular” are simply

convenient expressions of the “shape” of the block of elements concerned.

Among the numerous kinds of matrices, the following cases are of particular importance in

practice:

(i) Zero Matrix: 0 = [0] = [

0 0 ⋯ 00 0 ⋯ 0⋮ ⋮ ⋯ ⋮0 0 … 0

]

𝑚𝑥𝑛

of order m x n

All the elements are zero and, if their number is not obvious, it is necessary to specify.

(ii) Unit Matrix: this is a square matrix of any order n x n:

𝐼 = [𝛿𝑟𝑠] = [

1 0 ⋯ 00 1 ⋯ 0⋮ ⋮ ⋯ ⋮0 0 … 1

]

𝑟𝑥𝑠

(r, s= 1, 2, ….. n)

Page 12: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[12]

The principal of I has entries 1; all other elements are 0. There is not just one unit matrix I; there

is such a matrix for each order n x n and the order must be understood or specified.

Matrix Sum

Cij=Aij+Bij i=1,2,3…….m

j=1,2,3……..n

2x32x3141210

864

864

235

BA

𝐴 + 𝐵 = 𝐶 = [9 9 10

14 18 22]

Select area for new matrix then type “=” highlight the area of matrix A, type “+”, highlight area

of matrix B.

Then to finish press Ctrl+Shift+Enter all together. You will get the result.

Data\Consolidate

Example: we have three electronic product A, B, C and we want to take the sum of three product

which sold in Ankara, İstanbul and İzmir in January, February and March.

Insert the number of sold products in matrix form.

Page 13: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[13]

Highlight F8:H10, then Select Data menu Consolidate command.

. 𝐴𝑛𝑘𝑎𝑟𝑎 İ𝑠𝑡𝑎𝑛𝑏𝑢𝑙 İ𝑧𝑚𝑖𝑟𝐴 2200 4150 1700𝐵 1650 1800 1400𝐶 1050 2200 1100

Sum for function. Click into reference section and highlight the area of matrix A click add

button. And do the same steps for matrix B, and C. then click on OK button. You will see the

result:

Matrix Multiplication

A=[arp] is conformable with B=[bps] if A has as many column as B has rows:

A of order m x k and B of order k x n for any m and n. Then product AB is then the matrix

C=[crs] of order m x n, where crs is the inner product

k

p

psrpba1 .

i.e. C=AB implies bac ps

k

prprs

1

An alternative expression of the definition is in terms of inner products of vectors. If A is of

order m x k and B of order k x n, then the (r,s)th element in the product AB is the inner product

of the rth row of A, ar=(ar1,ar2, …..ark), with the sth column of B, bs=(b1s,a2s,…..bks). then

the rule of “across and down” or of “row and column” implies that vectors across A are taken

with vectors down B.

Page 14: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[14]

In application of the definition, the first step is to check that the matrices to be multiplied are

indeed conformable. For example, matrices A and B of (3x2) and (2x2) respectively are

conformable and give a product AB of order (3x2). Put briefly: order (3x2) with order (2x2)

gives order (3x2). The second step is to apply the rule of “across and down”. The product AB

is obtained most easily by writing the definition in the form

[arp] x [bps] = [(

k

p

psrpba1

)]

Any one element of the product comes from a row of A matched off with a column of B; if the

element is the (r,s)th, then it comes from the rth row of A and the sth column of B. for example

02

10

22

02

10

10

01

12

AmxnxBnxk = Cmxk

The leading element in the product is the inner product formed from the first row (2,1) of A and

the first column (0, -2) of B:

2 x 0 + 1 x (-2) = -2

and similarly for the other elements.

22

23

2x3 58

64

53

564511

262312

x

x

CBA

Page 15: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[15]

But we just write the matrix in Excel then select area for matrix C. Select Function command

from Insert Menu.

Select Math & Trig / MMULT for

matrix multiplication.

Type area of matrix A(B1:D2) in Array 1, and matrix B(B4:C6) in Array 2. Press OK.

Click once to end of formula

box. And press Ctrl+Shift+Enter all together.

Page 16: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[16]

Matrix Transpose

A new process, not to be found in elementary algebra, can now be introduced into matrix

algebra. A given matrix of order mxn consists of mxn elements arranged differently, in n rows

and m columns, by simply interchanging the rows and columns. The result is a different matrix

of order nxm. It is called the transpose of the original matrix.

The transpose of a matrix A=[ars] of order mxn is the matrix A’= [asr] of order nxm.

The notation is simple; the addition of a prime to any matrix indicates transposition of rows and

columns, e.g. (AB)’ is the product matrix AB with rows and columns transposed.

642

531A ,

65

43

21'A

𝐴 = [2 5 83 2 6

]

Select area of transpose matrix (E1:G3) then type =TRANSPOSE(A1:C3) Ctrl+Shift+Enter.

𝐴𝑇 = [2 35 28 6

]

Inverse Matrix

The general form of a matrix, as considered so far, is rectangular its order is mxn where m is

generally not equal to n. In the present section, particular attention is paid to case m=n, to a

square matrix of order nxn.

If A=|A|=|ars| is the determinant obtained from A, then A is singular when A=0 and non-

singular when A0.

A-1 inverse of A: AA-1=A-1A=I

The matrices A and B must be square and A0.

Page 17: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[17]

AAA

AAA

AAA

nnnn

n

n

rs

AA

AA

21

22212

12111'

1 1

(A0)

In Excel to take inverse matrix write matrix A

6512

386

195

A

in toA1:C3 then highlight area (B6:D8 ) for inverse matrix.

Insert /Function/ Math&Trig || Select MINVERSE

Select area of matrix A into Array.

Ctrl+Shift+Enter to see the result:

-0,158 0,1228 0,0877

A-1= 0,1805 -0,045 -0,053

-0,165 0,208 -0,035

Page 18: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[18]

Linear Equations and Their Solution

[

𝑎11𝑥1+𝑎12𝑥2 + ⋯ + 𝑎1𝑛𝑥𝑛 = 𝑦1

𝑎21𝑥1+𝑎22𝑥2 + ⋯ + 𝑎2𝑛𝑥𝑛 = 𝑦2

⋮ ⋱ ⋮𝑎𝑚1𝑥1+𝑎𝑚2𝑥2 + ⋯ + 𝑎𝑚𝑛𝑥𝑛 = 𝑦𝑚

]

18

0

11

3425

25

321

322

321

xxxxxxxxx

to solve these equations we will write them in matrix form:

? X

18

0

11

b

3-14-

251

125

3

2

1

XXX

A

AX=b

A-1AX=A-1b

IX=A-1b

X= A-1b

Example 1.

4𝑥 + 3𝑧 + 5𝑡 = 25𝑥 − 𝑦 − 5𝑧 + 2𝑡 = −94𝑥 + 3𝑦 + 𝑡 = 37𝑥 + 2𝑦 + 9𝑡 = 14

} ?

Example2.

Page 19: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[19]

5𝑥 + 𝑦 + 8𝑧 = 464𝑥 − 2𝑦 = 126𝑥 + 7𝑦 + 4𝑧 = 50

} ?

You can download Excel spreadsheet for these applications from the website.Excel_app_II.xlsx

Page 20: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[20]

Equations with one unknown

y=x2-2x+1 to find x ‘s we must calculate a

acbb

2

42

In Excel to solve this equation we will take A1 as x; so

Click in C1 and type formula

=A1^2-2*A1+1

Give command Solver from Tools menu.

When you press Solve button you will see the root of the X in A1 and result of y in C1.

Nonlinear Equations

x2-y-1=0

3x-2y2-25=0

To solve these equations

click A1 and type formula =F1^2-F2-1

click A2 and type formula =3*F1-2*F2^2-25

by this typing F1 represents x, F2 represents y.

Page 21: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[21]

Then select Solver from Tools menu

When you press Solve button you will see the result of equations. A1 equation 1; A2 equation

2, F1 x, F2 y.

Linear Programming

Consider the problem of nutrition in its economic aspects. A consumer buys a range of foods:

breads, meat, milk and so on. In determining his purchases, e.g. given prices on the market and

his income, his “preferences” for the various foods are taken into account, as in the usual theory

of consumer behavior. What are these “preferences”? In part, they are his tastes in food and his

habits in consumption. But, in part, they may also be an expression of his nutritional needs in

terms of calories, protein, vitamins and so on.

The problem is one of transformation: the foods bought at market prices are transformed into

intake of nutrients. There are two sides to the problem: the consumers’ diet is specified as to

aggregate content of calories, grams of protein, and so on; foods are then bought at given market

prices to minimize the cost of achieving the given nutritional content. The given technical data

of the problem consist of the specification of the nutrients in one unit of each food; this is a

Page 22: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[22]

transformation function, here assumed can be achieved in all kinds of ways by buying foods in

various quantities. A feasible solution of the problem is any such set of purchases. The problem

is then resolved, and an optimum feasible solution obtained, if the set of purchases for smallest

cost is found.

Our target is minimizing the cost and while minimizing it we have restricts.

DK-1 X

BW-10 Y

Z=500X+600Y

40X+60Y 480 passenger X 0

30X+15Y 180 cargos Y 0

Steps for solving in Excel

(1) Type X= in C1 Y= in C2 Z= in E1

(2) =40*D1+60*D2 into C4

(3) =30*D1+15*D2 into C5

(4) =500*D1+600*D2 into G1

D1 represents X; D2 represents Y.

Example:

An airway firm has two different types of planes. DK-1 and BW-10. DK-1 can carry 40

passengers, 30 tons cargo. BW-10 can carry 60 passengers, 15 tons cargo.

Airway firm has signed an agreement to carry minimum 480 passengers and minimum of 180 tons

cargo for everyday. Fly cost for DK-1 is 500$ and for BW-10 is 600$.

For minimum total cost how many flight must be done with each plane?

Page 23: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[23]

Select Solver from Tools menu.

See the results X=3 in D1

Y=6 in D2

Z=5100 in G1

Cost of DK-1 = 480 in C4

Cost of BW-10 = 180 in C5.

Page 24: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[24]

Adding Solver Commands to Data menu

Office button ~ Excel Options (in 2007)

File menu ~ Options (in 2010)

Select Add-Ins

Page 25: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[25]

Click to Go…

Click to Solver and then OK

Page 26: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[26]

To solve this transportation problem as a LP model requires us to define the decision variables

to be the amount shipped from each plant to each location. It will be convenient to use a bit

different notation for this model; using subscripts to keep track of plants and warehouses Xi,J

will denote the amount shipped from Plant i to Warehouse j. For example:

X Plant1 to Warehouse1: X11 = Amount shipped from Plant1 to Warehouse1

X Plant2 to Warehouse3: X23 = Amount shipped from Plant2 to Warehouse3

This model requires six decision variables. In the following model, you see that the specification

becomes a bit tedious with so many variables. To make the formulation simpler we have not

listed all of the non-negativity constraints together on one line.

𝑍 = 10𝑋1115𝑋1213𝑋138𝑋2120𝑋2211𝑋23(𝑡𝑜𝑏𝑒𝑚𝑖𝑛𝑖𝑚𝑖𝑧𝑒𝑑)

1𝑋11+𝑋12+𝑋13 ≤ 1.200 (𝑃𝑙𝑎𝑛𝑡 1 𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦)

1𝑋21+𝑋22+𝑋23 ≤ 1.800 (𝑃𝑙𝑎𝑛𝑡 2 𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦)

1𝑋11+𝑋12 ≤ 1.000 (𝑊𝑎𝑟𝑒ℎ𝑜𝑢𝑠𝑒 1 𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦)

1𝑋12+𝑋22 ≤ 1.000 (𝑊𝑎𝑟𝑒ℎ𝑜𝑢𝑠𝑒 2 𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦)

1𝑋31+𝑋32 ≤ 1.000 (𝑊𝑎𝑟𝑒ℎ𝑜𝑢𝑠𝑒 3 𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦)

𝑋11, 𝑋12, 𝑋13, 𝑋21, 𝑋22, 𝑋23 ≥ 0 (𝑁𝑜𝑛 − 𝑛𝑒𝑔𝑎𝑡𝑖𝑣𝑖𝑡𝑦𝑐𝑜𝑛𝑠𝑡𝑟𝑎𝑖𝑛𝑡𝑠)

Example 1. Transporting Refrigerators

Suppose GE wishes to determine a shipping schedule to deliver 3000 side-by-side refrigerators

from two plants to three regional warehouses. The cost of shipping a refrigerator (via truck) from

each plant to each warehouse is given here:

To Warehouse

From Plant 1 2 3

1 10 15 13

2 8 20 11

Plant 1 can supply 1.200 of the total demand for refrigerators, and Plant 2 can supply 1.800. If

each of the three warehouses requires 1.000 refrigerators, what is the optimal shipping plan?

Page 27: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[27]

Page 28: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[28]

X: # of acres of Corn

Y: # of acres of Wheat

P: Profit

X Y Constraints

Acres x y ≤100

Expenses 120x 210y ≤15.000

Yield 110x 30y ≤4.000

P 143x 60

Mathematical Form:

𝑋 + 𝑌 ≤ 100120𝑋 + 210𝑌 ≤ 15.000110𝑋 + 30𝑌 ≤ 4.000(110𝑥1,30)𝑋 + (30𝑥2)𝑌 → 𝑚𝑎𝑥.

Example 2.A farmer has 100 acres on which to plant two crops: corn and wheat. To

produce these crops, there are certain expenses, as shown in the table:

Item Cost per acre Item Cost per acre

Corn Wheat

Seed $ 12 Seed $ 40

Fertilizer $ 58 Fertilizer $ 80

Planting/care/harvesting $ 50 Planting/care/harvesting $ 90

Total $ 120 Total $ 210

After the harvest, the farmer must usually store the crops while awaiting favorable market

conditions. Each acre yields an average of 110 bushels of corn or 30 bushels of wheat. The

limitations of resources are

Available capital: $ 15.000

Available storage facilities: 4000 bushels

If the net harvest profit (after all expenses have been subtracted) per bushel of corn is $

1,30 and for wheat is $ 2,00, how should the farmer plant the 100 acres to maximize

profits?

Page 29: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[29]

Page 30: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[30]

In formulating the LP model for this problem, some may have difficulty specifying the first

constraint. This constraint says that the sums of 42X and 30Y must at least equal 35(X+Y).

Thus, the first constraint can be written in either of the following two ways:

42X+30Y ≥ 35(X+Y) or

7X – 5Y ≥ 0

Constraints are:

X+Y ≥ 13

42X+30Y ≥ 35(X+Y) 7X – 5Y ≥ 0

Target:

Z = 60X+20Y Minimum Cost

Example 3.A company making animal feed uses two ingredients (X and Y) in one of their

best-selling products. A decision must be made regarding the amount of X and Y (measured

in tons) to include in the mix of this product to minimize total cost. Ingredient X costs the

company 60$ per ton, and ingredient Y costs 20$ per ton. The constraints on the mix each

day follow:

1. Company policy is that the mix must have an average of 35 units per ton of a nutritional

ingredient. Ingredient X provides 42 units per ton of this ingredient, whereas ingredient Y

provides 30 units per ton.

2. The company must make at least 13 tons each day: hence they consider X+Y13 to be

constraint.

A decision must be made regarding the amount of X and Y (measured in tons) to include in

the mix of this product to minimize total cost.

Page 31: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[31]

#REF “Illegal Cell Reference”

The #REF! error occurs when you refer to a call that is not valid. The error is displayed

whenever Excel is unable to evaluate a formula because of an illegal cell reference. The most

common cause of the error is deleting the row, column, or all that contained the original cell

reference.

Page 32: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[32]

X: Number of deluxe models sold

Y: Number of standard models sold

Z= $120X+$80Y

1. Hours: 2X+1Y ≤ 80

2. # Deluxe: X ≤ 30

3. Mix of deluxe and standard Policy: X ≥ 1/2Y X – ½ Y ≥ 0

4. X , Y ≥ 0

Example 4.Transco, Inc. makes a deluxe and a standard model of a Global positioning

System (GPS) –a handle device for navigating via a system of 24 Satellites. They are

currently trying to determine the optimal number of each model to produce each day. Their

profit is $ 120 for each deluxe model and $ 80 for each standard model.

Transco has 80 working-hours per day available (that is, 10 people working 8-hours shifts

per day) producing a deluxe model takes 2 hours, whereas producing a standard model

takes 1 hour.

No more than 30 deluxe models per day can be produced, and company policy is that the

number of deluxe models produced must be at least half of the number of standard models.

(For example, if 20 standard models are produced, the number of deluxe models must be

at least 10.) The company can sell all of the GPS models it produces.

Page 33: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[33]

# of deluxe sold : 20

# of standard sold : 40

Profit : 5600 $

You can download Excel spreadsheet for these applications from the

website.Excel_app_III.xlsx

Page 34: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[34]

Pivot Tables

A pivot table extends the capability of individual database functions by presenting the data in

summary form. It divides the records in a list into categories, then computes summary statistics

for those categories.

A pivot table is created by using the Pivot Table Wizard, which prompts you for the information

to develop the pivot table. You indicate the field names for the row and column labels. You

also indicate the field on which the computation is to be based and means of computation. The

Pivot Table Wizard does the rest. It creates the pivot table in its own worksheet within the same

Workbook as the list on which it is based.

Pivot tables provide the almost in flexibility, in that you can vary the row or column categories

and/or the way the statistics are computed. The pivot table dialog box shows just how easy it is

to create a pivot table. The field names within the associated list appear at the right of the dialog

box. To create the pivot table, you simply drag a field name(s) to the row, column, or data areas

of the table. Click the Next command button to supply the finishing touches to the pivot table,

after which the pivot table will appear in its own worksheet.

Once a pivot table has been created, you can easily add or remove categories by dragging the

field names on or off the table within the PivotTable Wizard. You can also switch the orientation

(pivot the table) by dragging a field to or from the row or column area. And finally, you can

Page 35: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[35]

modify the worksheet on which the pivot table is based then refresh the pivot table to reflect

the changes made to the worksheet.

Cross-Tabulation:

Suppose you have been looking at a university department’s web page which lists staff

alphabetically by name, and gives an indication of their position in the department ( showing

who is a Professor, a senior lecturer or ordinary lecturer). You notice that of the twenty staff

listed six are women, but only one of the four Professors is a woman. You decide to investigate

the relationship between position and gender more systematically.

You enter the person’s name, gender and position into a spreadsheet as shown in Figure

What you need to do is to draw up a table, known as a contingency table, which has two columns

to distinguish the gender of the individuals and three rows to distinguish the staff according to

their position or status.

The table would show the number of cases falling into each two-way category. Now with a

small data set such as we have here it is easy enough just to count up the cases manually.

Excel steps for count up gender and position for staffs.

Select through B1:C21 then Data menu Pivot Table wizard.

Page 36: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[36]

Put Gender to column and Position to row, and again Position to data. E1, an area of the

worksheet where you would like the table to appear.

You can also download sample spreadsheet to try these methods yourself.

(CrossTabulation.xlsx)

What is a Pivot Table?

Pivot tables are an Excel feature that you should learn how to use. Instead of analyzing rows

upon rows of records, a pivot table can aggregate your data and show a new perspective and

few clicks. You can also move columns to rows or vice versa. The problem is people believe

creating a pivot table is too difficult to learn.

You might think of a pivot table as a user created summary table of your original spreadsheet.

You create the table by defining which fields to view and how the data should be displayed.

Based on your field selections, Excel aggregates and organizes the data so you see a different

view of your data.

As example, I’ve uploaded a sample spreadsheet of 4000 fictitious voters, which includes the

following data fields:

Voter ID

Party Affiliation

Page 37: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[37]

Their precinct

Age group

When they last voted

Years they’ve been registered

Ballot status

Looking at the first 20 data records, you can see the data is boring. It’s enough to make you roll

your eyes and fall asleep. In this format, the key question it answers is how many voters exist

in all the precincts.

Using Excel pivot tables, you can organize and group the same data in ways that start to answer

questions such as:

Page 38: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[38]

What is the party breakdown by precinct?

Do voters use permanent absentee ballots?

Which precincts have the most Democrats?

How many voter pamphlets do I need for Precinct 2416?

Do 18-21 year olds vote?

A pivot tables allow you to group the spreadsheet or external data source by any of your data

fields. The thumbnail below shows a count of voters by party by precinct.

Using a pivot table, I can continue to slice the data by selecting additional fields from the

PivotTable Field List. For example, I can take the same data and segment by voter age group.

Page 39: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[39]

Understanding the Pivot Table Structure

In the thumbnail above, I’ve labeled the main areas of the pivot table.

1. PivotTable Field List – this section in the top right displays the fields in your

spreadsheet. You may check a field or drag it to a quadrant in the lower portion.

2. The lower right quadrants - this area defines where and how the data shows on your

pivot table. You can have a field show in either a column or row. You may also indicate

if the data should be counted, summed, averaged, filtered and so on.

3. The red outlined area to the left is the result of your selections from (1) and (2). You’ll

see that the only difference I made in the last pivot table was to drag the AGE GROUP

field underneath the PRECINCT field in the Row Labels quadrant.

How to Create a Pivot Table

There are several ways to build a pivot table. Excel has logic that knows the field type and will

try to place it in the correct row or column if you check the box. For example, data that is

numeric such as Precinct counts tends to appear to the right in columns. Data, which is textual,

such as Party would appear in rows.

While you can simply check fields to display and let Excel build your pivot table, I prefer to

use the “drag and drop” method. This is partly because I like to visualize my data in columns

and rows. I think it may also be easier if you have fields, which can appear to be numbers like

a precinct value.

Page 40: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[40]

Open your original spreadsheet and remove any blank rows or columns.

Make sure each column has a heading, as it will be carried over to the Field List.

Make sure your cells are properly formatted for their data type.

Highlight your data range, Click the Insert tab.

Select the PivotTable button from the Tables group.

Select PivotTable from the list.

The Create PivotTable dialog appears.

Page 41: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[41]

Double-check your Table/Range: value.

Select the radio button for New Worksheet.

Click OK.

A new worksheet opens with a blank pivot table. You’ll see that the fields from our source

spreadsheet were carried over to the PivotTable Field List

Drag an item such as PRECINCT from the PivotTable Field List down to the Row

Labels quadrant. The left side of your Excel spreadsheet should show a row for each

precinct value. You should also see a checkmark appear next to PRECINCT

Page 42: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[42]

The next step is to ask what you would like to know about each precinct. I’ll drag the

PARTY field from the PivotTable Field List to the Column Labels quadrant. This will

provide an additional column for each party. Note that you won’t see any numerical data

To see the count for each party, I need to drag the same field to the Values quadrant. In

this case, Excel determines I want a Count of PARTY. I could double-click the entry

and choose another Field Setting. Excel has also added Grand Totals.

Page 43: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[43]

As you build your pivot table, you’ll probably think of additional ways to group the information.

For example, you might want to know the Age Range of voters by Precinct by Party. In this

case, I would drag the AGE GROUP column from the PivotTable Field List down below the

PRECINCT value in Row Labels.

Page 44: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

Learning Excel

[44]

Each age group is broken out and indented by precinct. At this stage, you might also be thinking

of usability. As with a regular spreadsheet, you may manipulate the fields. For example, you

might want to rename “Grand Total” to “Total” or even collapse the age values for one or more

precincts. You can also hide or show rows and columns. These features work the same way as

a regular spreadsheet.

One area that is different is the pivot table has its own options. You can access these options by

right-clicking a cell within and selecting PivotTable Options… For example, you might only

want Grand Totals for columns and not rows.

There are also ways to filter the data using the controls next to Row Labels or Column labels

on the pivot table. You may also drag fields to the Report Filter quadrant.

Troubleshooting Pivot Tables

You might encounter several “gotchas” with this example file or another spreadsheet.

Sometimes when you move around your pivot table the PivotTable Field List disappears. To

get it back, click any cell with a value.

You can also move or “pivot” your data by right clicking a data field on the table and selecting

the “Move” menu. From here, you can move a column to a row or even change the position.

An example of this might be the values for “LAST VOTED” since Excel will sort by the month

first. You might prefer to move the data so the election dates are in a chronological order.

Pivot tables may not make the election data exciting, but it can make the analysis process easier.

Without these tables, you’d probably spend more time filtering, sorting and subtotaling. The

other benefit is that it’s easy to start over by deselecting fields or moving them to another

location. Feel free to download the tutorial spreadsheet below and play with the data. This will

probably be the only time you’re allowed to manipulate election data.

You can also download sample spreadsheet to try these methods yourself.

(PivotTableExample.xlsx)

Page 45: Introduction to Excel - Hacettepeyunus.hacettepe.edu.tr/~ncokca/kndnt/201617GD... · Introduction to Spreadsheets A spreadsheet is the computerized equivalent of an accountant's ledger

N. Nilgün Çokça

[45]

An Example for Pivot Table

Staffs in a company have been sent a questionnaire asking them whether or not have received

any IT training. The questionnaire also asks respondents to indicate their gender, status in the

company (junior or senior) and their employment mode (Full-time or Part-time). The results for

one branch are shown in the table below:

Use PivotTable Wizard to produce contingency tables showing IT training responses cross-

tabulated against each of the other variables.

You can also download sample spreadsheet to try these methods yourself. (ITtraining.xlsx)