intro to spreadsheets with ms excel a spreadsheet...

51
Intro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating tool. As word processing has largely replaced the use of typewriters, using a spreadsheet has many advantages as compared with using a hand calculator. Among the major advantages: unlike a typical hand calculator, a spreadsheet: Can produce a highly detailed document, with raw data, calculated data, graphs, and explanations; Can easily recalculate when data that a calculation depends upon is changed. You can start the Excel program by clicking Start, All Programs, Microsoft Office 2013, Excel 2013. The 2013 version presents a screen like that shown below.

Upload: danghuong

Post on 01-May-2018

233 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Intro to Spreadsheets with MS Excel

A spreadsheet, fundamentally, is a calculating tool. As word

processing has largely replaced the use of typewriters, using a

spreadsheet has many advantages as compared with using a

hand calculator. Among the major advantages: unlike a typical

hand calculator, a spreadsheet:

Can produce a highly detailed document, with raw data,

calculated data, graphs, and explanations;

Can easily recalculate when data that a calculation

depends upon is changed.

You can start the Excel program by clicking Start, All Programs,

Microsoft Office 2013, Excel 2013. The 2013 version presents a

screen like that shown below.

Page 2: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Notice at the bottom of the screen the tab labeled Sheet1.

Older versions of Excel initially present 3 tabs (for 3 different

worksheets). A worksheet is sort of an Excel document within a

workbook; the latter is an Excel data file. Thus, a workbook is

made up of worksheets, each of which typically appears as a

grid with lettered columns and numbered rows. The

intersection of a column and a row is a cell. A cell’s address

combines its column and row label. E.g., the cell in column G

and row 3 has the address G3. The “Namebox” shows the name

Formula bar

Page 3: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

(if one exists) or the address of the cell that currently has the

cursor.

You can edit a cell’s contents. A cell may have its display value

defined in any of several ways:

By a “raw data” value that you enter. E.g., you might enter

a text value (also known as a “character string”) of non-

numeric data, or a number.

By a formula, which is an instruction to the computer on

how to compute the value to be displayed.

Note the formula bar, which shows how the value of the cell

named in the Name Box is defined. When a cell is defined by a

formula, the formula bar will show the formula; the cell will

show the value of the formula. A cell may be edited in its own

space, or in the formula bar.

Formatting issues

How can we give a cell more space to show its value?

By placing the cursor at the right edge of a column whose

width we wish to change, in the row in which columns are

labeled, we can perform a drag-and-drop operation to

make the column wider or narrower.

By placing the cursor at the bottom edge of a row whose

height we wish to change, in the column in which rows are

Page 4: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

labeled, we can perform a drag-and-drop operation to

make the row taller or shorter.

Making a row taller does not, by itself, cause the data of a

cell to wrap around and make use of the space created to

display multiple rows within a cell. To cause the text to

wrap, you can click the Wrap Text button of the Home tab.

You can insert a worksheet into your workbook by clicking, on

the Home tab, the Insert drop-down arrow and choosing, from

the resulting menu, Insert Sheet. Alternately, click the circled +

button at the bottom of the workbook.

You can delete an unwanted worksheet as follows. The

worksheet to be deleted should have the cursor. On the Home

tab, click the drop-down Delete arrow, and choose Delete

Sheet from the resulting menu.

You can edit the name of a worksheet (which appears on the

worksheet’s tab) as follows. Double-click on the worksheet’s

tab; edit the name; strike Enter.

Number formats

When a cell with a numeric value displays a string of the #

character, the cell isn’t wide enough to display its value.

Note the home tab has several buttons for formatting numbers.

Page 5: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

The $ button (Currency or Accounting Number format) can

be applied to a cell so that if the cell has a numeric value,

it is displayed with a currency symbol (by default, the

dollar sign, but other currency symbols can be used). Also,

commas are used when appropriate. Notice also that a

negative number in this format does not display a leading

minus sign; instead, the absolute value is shown in

parentheses. Example:

General format Accounting Number format

Comma format

-87330.67 $ (87,330.67) (87,330.67)

The comma format (the button on the Home tab showing

a comma) is like Accounting Number without a currency

symbol.

The Percent format, induced by the button showing %,

causes a cell with a numeric value to display a percent

sign. E.g., the number .0875 in this format, if displayed

with enough digits, appears as

8.75%

Note the Increase Decimal and Decrease Decimal buttons.

These can be used to change the number of decimal

places, or significant digits, displayed. Notice that Excel

will often displayed a rounded value – e.g., the value

Page 6: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

discussed above might be displayed as 9% if we don’t

show many digits. However, if the cell is defined as 8.75%

or .0875, the latter value is used when the cell is involved

in a calculation.

Other number formats are available from the listbox at the

top of the Number section of the Home tab. For example:

o If you want to use the Accounting Number format

with a currency symbol other than the $, from the

listbox menu, choose More Number Formats. The

resulting dialogbox has a Number tab with a

Symbol listbox, from whose menu you can choose

a different currency symbol.

o Scientific: Although it may not look like the

notation you learned in a high school science

course, it really is the same scientific notation,

perhaps in a different format. For example, a cell

with the value 526973.17 is displayed in scientific

notation as

5.2697317E+05

which represents 5.2697317×10+05

- thus, the “E” is short for “times 10 raised to the

power”.

Notice that data aligns, by default, in a cell as follows: text to

the left, numbers to the right. This can create a misleading

Page 7: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

appearance in a wide column, especially in the hardcopy

version of a worksheet (which usually doesn’t show the grid).

E.g., the column header “Gross Income” shown above doesn’t

appear to be in the same column as the column of numbers

below and to the right of the header. You can change the

alignment of data in a cell by using the alignment buttons of the

Home tab. Boxer’s rule of thumb: column headers over

columns of numbers should be aligned right. As applied to the

example shown above, we get the much clearer version:

Page 8: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Formulas

A formula, in Excel, starts with an equal sign. Most formulas

involve calculations of arithmetic. The name or the address of a

cell is used as a variable for the value of the cell. The arithmetic

operators:

Page 9: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Operator Explanation Example + Addition; also, as a

leading unary operator

=B10+B11 =+4+B10

- Subtraction; also, as a leading unary operator

=I2-I1 =-10+B6

* Multiplication =I13*9%

/ Division =I3/I4 ^ Raised to the

power =I16^2

It is often tempting, when a calculation seems easy, to enter

the result of a calculation into a cell rather than a formula.

Usually, you resist this temptation. If a data value, say, in B2, is

changed, and another cell, say D2, depending on the value in B2

is defined by the numeric result of a calculation rather than by

a formula, then the change in B2 leaves D2 incorrect. You

might forget to make the correction; even if you remember to

do so, you have to take the time to do so, and you risk making

an error in the recalculation. By contrast, if cell D2 defined by

an appropriate formula, then a change in B2 causes D2 to be

recalculated quickly and automatically.

Page 10: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Copying formulas: A common situation: many cells are

calculated using the same logic, but not the same data.

Therefore, when you copy a formula, the formula isn’t copied

character for character; rather, its logic is copied, but

adjustments may appear in cell references. In particular, all

parts of a formula copy exactly, except for relative cell

references (the only kind we have used so far). These are

adjusted according to the column and row translations

between the source cell copied from, and the destination cell

pasted to. For example, in the following,

we want to copy from D2 to D3, D4, D5, etc. When we copy

from D2 to D3, the column translation is from column D to

column D, a translation by 0 columns. Therefore, there is no

Page 11: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

change (a change by 0 columns) in the column references of the

pasted formula. The row translation is from row 2 to row 3, a

translation of 3-2=1 – an increase – so all relative row

references in the pasted formula are increased by 1. Since the

copied formula is =B2-C2 the formula pasted into

D3 is =B3-C3

We have seen that the methods of Word may be used to copy a

cell. Also, if the source and destination cells of the intended

copy-and-paste form a contiguous rectangle, the tiny square in

the bottom right corner of the source cell(s) is a copy-and-paste

handle that can be dragged-and-dropped over the destination

cell(s) to achieve a copy-and-paste operation.

Functions

These are shortcuts to common calculations in formulas. A

function can be used the format

functionName(parameterList)

where the list of “parameters” or “arguments” represents the

data that the function operates upon. A parameter list is

occasionally empty. More often, there are one or more

parameters. If more than one parameter, adjacent parameters

are separated by a comma. A parameter may be any of

A constant, like 75.2 or “hello” (without the quotation

marks)

Page 12: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

A cell, in which case the value of cell is used by the

function. Thus, you can think of a cell reference as a

variable – a symbol for the value of the cell.

A complex expression, such as A5+B6

A cell range. This is a rectangle of contiguous cells. Notice

that cell range is completely determined by the cells in its

top left corner and lower right corner; therefore, we

specify a cell range in notation of the form

topLeftCorner:bottomRightCorner

E.g., below, we see pictured

the cell range D10:E16

Page 13: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

When a cell range is a parameter of a function, the function

operates on every cell of the range.

Some important functions:

SUM() – may have arbitrarily many parameters. It adds all of

those parameters that have numeric values, ignoring any

parameters that don’t have numeric values. Notice also that

the Autosum button of the Home tab can be used as a shortcut

for editing the use of the SUM function into the current

formula. When you use this button, Excel will guess a cell range

as the parameter list. If Excel’s guess is wrong, you can easily

correct it. For example, the formula

=SUM(B2:M2)

adds all of the values in those of the cells B2:M2 that have

numeric values.

MAX() – computes the maximum value among its parameters.

It yields the highest value among all of those parameters that

have numeric values, ignoring any parameters that don’t have

numeric values. For example, the formula

=MAX(B2:B13)

computes the largest numeric value found among cells B2:B13.

MIN() – computes the minimum value among its parameters. It

yields the lowest value among all of those parameters that have

Page 14: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

numeric values, ignoring any parameters that don’t have

numeric values. For example, the formula

=MIN(B2:B13)

computes the smallest numeric value found among cells

B2:B13.

AVERAGE()– computes the average value among its those

parameters with numeric values, ignoring any parameters that

don’t have numeric values. For example, the formula

=AVERAGE(B2:B13)

computes the average numeric value found among cells

B2:B13. Notice that you might be tempted to compute an

average by using the form

=SUM(parameterList)/count(parameterList)

where, in the denominator, you use a literal constant (e.g., 8 if

there are 8 items you wish to average).

There are two problems with the latter form:

1. If you do the counting yourself, you could easily miscount.

2. The count may change if data changes cause a cell to

switch between numeric and non-numeric.

MEDIAN() – this gives the middle value among the parameters.

Both median and average are “measures of central tendency,”

Page 15: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

but the median is less susceptible to distortion by extreme or

“outlying” values.

Notice that several of the functions discussed above are on the

menu obtained from the Autosum drop-down arrow. Selecting

from this menu is a shortcut for using the selected function in

the formula being edited.

In the worksheet shown below, copying O2 down column O

yields the division-by-0 error message:

We saw that this problem is caused by the failure of the copy-

and-paste operation to hold fixed the denominator of the

formula. We want the denominator to hold fixed at N15;

however, we saw it was adjusted to N16, N17, etc.

Page 16: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

We see, then, that we need a different kind of cell reference,

one that will stay fixed through copy-and-paste operations. We

use the dollar sign in front of the column reference to hold the

column fixed; use the dollar sign in front of the row reference

to hold the row fixed. Such a reference is a fixed or absolute

reference, in contrast to the relative references used up until

now. Thus, a cell (e.g., G5) can appear in a formula in any of

the following notations:

G5 – relative in column, relative in row

$G5 – fixed in column, relative in row

G$5 – relative in column, fixed in row

$G$5 – fixed in column, fixed in row

Recall that when a formula is copied from one cell to another,

relative column references are adjusted by the column

translation between the source and destination cells of the

copy-and-paste, and relative row references are adjusted by

the row translation between the source and destination cells of

the copy-and-paste. All other parts of the formula, including

fixed references, are copied without modification. For

example, suppose we copy a formula from B16 to D20. Note

the column translation is from column B to column D, or 2

columns to the right. Therefore, relative column references are

adjusted by 2 columns to the right in the pasted formula.

Similarly, the row translation, from row 16 to row 20, is an

Page 17: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

increase of 20-16=4 rows. Therefore, relative row references in

the formula are increased by 4. Therefore,

If the copied formula in B16 is Then the pasted formula in D20 is

=B10*C4 =D14*E8 =B$10*C4 =D$10*E8

=$B10*C4 =$B14*E8 =$B$10*C4 =$B$10*E8

In the worksheet shown below, it appears that there is an error

of one cent in the value in E9:

This is because our formulas calculated numbers whose exact

values require more than 2 decimal places. In the total, these

Page 18: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

fractions of a cent built up into the appearance of a 1 cent

error. We should realize that there is a difference between

rounding off a displayed value, and rounding off a calculated

value. It was the set of calculated values, not their rounded

displays, used in computing the total shown above. Therefore,

we’re ready to face the question of how to round off a

calculated value. The ROUND function is the key. Its format:

ROUND(expressionOfConcern, decimalPlaces)

where “expressionOfConcern” is the expression whose value

we’re concerned with, to be rounded off to the number of

decimal places indicated by the 2nd parameter. Therefore, in E2,

instead of using the formula =D2*B$14 shown

above, a better formula:

=ROUND(D2*B$14, 2)

Suppose, instead, the rules by which taxes are computed are,

as shown below:

Page 19: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

To obtain a formula for E2 (that should be copyable down

column E), we start from the principle that

Tax = net income * tax rate

The first factor, in E2, would be D2, as before. What about the

2nd factor? There are 2 possibilities. We need a function that

can correctly choose the tax rate. The IF function has this

capability. Its format:

IF(trueOrFalseExpression, expressionForTrue,

expressionForFalse)

where

Page 20: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

trueOrFalseExpression – an expression by which we decide

between 2 possibilities. The expression evaluates as either

TRUE or FALSE.

expressionForTrue – expression the function evaluates if

the first parameter is TRUE

expressionForFalse - expression the function evaluates if

the first parameter is FALSE

Thus, a formula for E2 above:

=ROUND(D2 * IF(D2>B$14, B$15, B$16), 2)

The first parameter of the IF function has the “Logical” data

type (this means having value TRUE or FALSE). Logical

expressions are often comparisons. The comparison operators:

Operator Meaning Example

> Is greater than D2>B$14 >= Is greater than or

equal to D2>=B$14

< Is less than A25<0 <= Is less than or equal

to J8<=K12

= Is equal to L3=M4 <> Is not equal to K7 <> M7

Suppose, in our Grades worksheet, we want to compute (by

formula) a student’s grade (in a copyable fashion).

Page 21: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Theoretically, we could nest multiple occurrences of the IF

function. That is, given a worksheet like the following,

we might use something like:

=IF(O2>=96%, “A+”, IF(O2>=90%, “A”, …))

where the “…” would have to be filled in with additional uses of

the IF function to distinguish among all grade possibilities. But

the resulting formula would be long, ugly, and error-prone.

The VLOOKUP function is often an alternative to multiple

nestings of the IF function when we need a formula that can

choose among 3 or more possibilities. Suppose further

development of our worksheet yields the following:

Page 22: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Roughly, the above shows how the VLOOKUP function works.

This function takes the following form:

VLOOKUP(lookupValue,

rangeOfStandardsAndCorrespondingResults,

relativeColumnIndex)

where

Example:

For the student with the 89% average,

look up this average in the list of

standards, find that it falls between the

88% and 90% standards, and conclude

that the student has an A- grade

corresponding to the 88% criterion.

Page 23: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

lookupValue – a data value to be looked up in a list of

standards. In the example above, use the student’s

percentage for this purpose.

rangeOfStandardsAndCorrespondingResults – a cell range

of, typically, at least 2 columns. The first column of the

range is a list of standards. In order to guarantee correct

results, this list must be in ascending order. Other columns

of the range are for results that correspond, respectively

by row, to standards of the first column.

relativeColumnIndex – number of the relative position,

within 2nd parameter, of the column with the desired

result.

Thus, for the problem discussed above, we get a worksheet like

the following:

Page 24: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

In particular, notice the formula in P2:

=VLOOKUP(O2,R$3:S$15,2)

since O2, the student’s percentage, is the appropriate lookup

value;

R3:S15 is the appropriate range of standards (column R) and

corresponding results (column S) – we used R$3:S$15 to hold

the rows fixed when we copied the formula from P2 to cells of

other rows;

2 is the relative column index, since the desired result is in the

2nd column of the range specified by the 2nd parameter.

Page 25: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Imagine yourself charged with the task of determining pay

raises for a small staff of employees. You are subject to the

following constraints:

The total of the raises must be at least 3.25% of the base

year’s total of salaries.

The total of the raises must be at most $500 over 3.25% of

the base year’s total of salaries.

Employees are rated from 1 (bad) to 5 (excellent). The

higher the rating, the higher the employee’s percentage

increase.

In the worksheet shown below,

in order to have a valid solution, we need

Page 26: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

E12 < E10 < E13

Recall that a chain of equations or inequalities is an

abbreviation. The above is an abbreviation for

E12 < E10 and E10 < E13.

In Excel, the AND operator is a function – a Logical function of

an arbitrary number of Logical parameters. If every parameter

is TRUE, then the AND function has the value TRUE; otherwise

(i.e., if any parameter is FALSE), the AND function has the value

FALSE. Thus, for 2 parameters, the AND function is described

by the following patterns:

x y AND(x,y) – think of this as “x and y”

OR(x,y) – think of this as “x or y”

NOT(x)

TRUE TRUE TRUE TRUE FALSE TRUE FALSE FALSE TRUE FALSE TRUE FALSE TRUE TRUE

FALSE FALSE FALSE FALSE

So, for cell E14 as shown above, to test for a valid solution, we

can use the formula

=AND(E12<=E10, E10<=E13)

This yields the following worksheet:

Page 27: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Better: since we should also have

I2 < I3 < I4 < I5 < I6

a better formula for E14 is

=AND(E12<=E10, E10<=E13, I2<=I3, I3<=I4, I4<=I5, I5<=I6)

One method of solving our pay raises problem: Take advantage

of the spreadsheet’s capability for recalculation and experiment

with the numbers in column I.

Other Logical functions include:

OR – a function of arbitrarily many Logical parameters

(often, 2 parameters). It follows a pattern similar to that

of the AND function: If any parameter is TRUE, the OR

Page 28: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

function is TRUE; otherwise (i.e., if all parameters are

FALSE) the OR function is FALSE.

NOT – a function of 1 logical parameter. It yields the

logical opposite of its parameter’s value.

Another method of solving the pay raises problem: since a

spreadsheet is a calculating tool, we can use it to solve an

equation, an inequality, or a system of equations or

inequalities. The tool used for this purpose is the Goal Seek

tool, found on the Data tab by clicking What-If Analysis, Goal

Seek. Formulas imply equations or inequalities among the cells

of the worksheet. If, e.g., we fill in all but one of the

percentage increases in column I, we can use the Goal Seek tool

to find an acceptable value for the missing data value.

For example, given the worksheet shown below,

Page 29: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

we can use the Goal Seek tool to find an appropriate value for

E6, one that will yield a valid solution to the pay raises problem,

as follows:

After clicking as described above, we get the Goal Seek

dialogbox:

Page 30: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

We must fill in the three textboxes of the dialogbox:

Set cell: give the name or address of a cell that you wish to

take a certain numeric value that it doesn’t currently have.

To value: the value you want the cell given for the first

textbox to have. In the current example, we might use E10

for the Set Cell entry, and, say, 15000 (or any other

number between the values shown in E12 and E13) as the

To Value entry.

By Changing Cell: give the name or address of the cell with

the unknown value – in current example, I6.

After filling these textboxes, click OK. Excel then computes and

displays its solution, which you can then approve or disapprove

Page 31: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

via the OK or Cancel buttons, respectively. For example, we got

the following:

An amortization schedule is a worksheet that studies how a

loan is repaid. Important uses of an amortization schedule

include:

Taxes – a schedule show interest payments, that, often,

are tax-deductible.

Loans are often refinanced, especially when prevailing

interest rates decrease. The value owed on the initial loan

can be obtained from an amortization schedule; this value

then becomes the principal of a new loan, at the new

interest rate, replacing the initial loan.

Page 32: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Many loans are structured as “ordinary annuities.” An ordinary

annuity is governed by the following rules:

An interest period coincides with a payment period.

The periodic payment is due at the end of the period (i.e.,

on the last day of business of the period).

All payments are of the same size (with the possible

exception of the last payment, which may be slightly

different due to a buildup of rounding).

Excel has a “payment” function that is used to compute the

signed periodic payment of an ordinary annuity. Its form:

PMT(periodicInterestRate, #interestPeriods,

signedPresentValue)

where

periodicInterestRate is the rate of interest charged per

interest period (in our example, the monthly rate);

#interestPeriods is the number of interest periods until the

loan is repaid (e.g., a 5-year loan with monthly payments

has 5*12=60 periods)

signedPresentValue is

o signed because you might want to use a + or – sign to

indicate which way the money is paid (for a similar

reason, the value of the function is signed). The value

of the function and this parameter will have opposite

Page 33: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

signs, so, to make the value of the function positive,

this parameter should be negative.

o presentValue: current value of the future payments,

discounted by the interest rate. At the beginning of

the loan, this is equal to the principal of the loan.

Thus, in the worksheet partially shown below,

an appropriate formula for C7 is

=PMT(I2, 60, -C4)

A modern spreadsheet program can generate a “chart” or

“graph” to illustrate relationships among the numbers of a

worksheet. To generate a chart:

Page 34: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Block the data you want the chart to be based upon. This

should typically include certain text data, as well as

numbers – the text data you want to use is explanatory

(e.g., row headers and column headers).

On the Insert tab, click the buttons and make the menu

selections corresponding to the type of chart you wish to

create.

As a result, a chart is created as a graphical object in the

worksheet it’s based upon. For example, a worksheet with the

following data (notice the following shows you can copy from

the cells of a worksheet into a Word document – the copied

cells enter the Word document as a Word table)

Model September October November December

Ford 13,983 12,095 12,784 14,021

Toyota 15,034 15,329 14,832 15,832

Chevy 10,347 10,448 10,582 11,204

Cadillac 4,902 4,706 4,892 4,901

Totals 44,266 42,578 43,090 45,958

can generate the following “clustered column” chart (notice the

following shows that an Excel chart can be copied into a Word

document):

Page 35: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

The chart above was created when the blocked cells included

row and column headers. If, instead, we did not include under

the block the row and column headers, but otherwise created

the same chart, it would look like the following:

Thus, failure to block the row and column headers caused us to

create a chart in which the labels and legends are useless as

explanations of the chart.

-

5,000

10,000

15,000

20,000

September October November December

Chart Title

Ford Toyota Chevy Cadillac

-

2,000

4,000

6,000

8,000

10,000

12,000

14,000

16,000

1 2 3 4

Chart Title

Series1 Series2 Series3 Series4

x-axis labels

legends (color code explanations)

Page 36: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Once a chart is created, it is usually possible and desirable to

improve its appearance in various ways.

One way to improve a chart is to give it a useful chart title, one

with more explanation than the default text, “Chart Title”. The

chart title appears in a textbox on a chart, and can be edited in

familiar fashion. E.g., the 1st chart shown above can be

modified as the following.

When the cursor is on a chart in a workbook, the Chart Tools

tabs (Design and Format) appear. These have many tools for

altering the appearance of a chart.

E.g., the numbers shown will often have multiple possible

interpretations, not all correct; it may be desirable to add an

-

2,000

4,000

6,000

8,000

10,000

12,000

14,000

16,000

September October November December

4-month sales of selected models

Ford Toyota Chevy Cadillac

Page 37: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

“axis title”. On the Design tab, you can click Add Chart Element,

Axis Titles, Primary Vertical; a textbox displaying vertical text is

then displayed, and you can edit this axis title as useful, e.g.,

If, instead of Primary Vertical, you chose Primary Horizontal,

edited the resulting title, and dragged it to the top of the y-axis,

the chart would appear as follows:

-

2,000

4,000

6,000

8,000

10,000

12,000

14,000

16,000

September October November December

Un

its

sold

4-month sales of selected models

Ford Toyota Chevy Cadillac

Page 38: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Suppose, instead of having a cluster for each month, you would

prefer a cluster for each model, with each model’s cluster

having a column for each month. With the cursor on the chart

in the worksheet, click Switch Row/Column. In the case of the

chart above, this modifies the chart to appear as:

-

2,000

4,000

6,000

8,000

10,000

12,000

14,000

16,000

September October November December

Units sold4-month sales of selected models

Ford Toyota Chevy Cadillac

Page 39: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

You could reasonably argue that both of the arrangements

made possible by the Switch Row/Column button are sensible.

Sometimes, one arrangement will make sense and the other

won’t.

Suppose a data value that a chart depends on is changed. Will

the chart modify automatically? Yes – this is part of a

spreadsheet’s ability to recalculate.

Suppose you wish to create a chart based on non-contiguous

data. E.g., suppose you want to focus, in the worksheet shown

above, on the September and December data. Thus, we want

to create a chart based on columns A, B, and E only.

-

2,000

4,000

6,000

8,000

10,000

12,000

14,000

16,000

Ford Toyota Chevy Cadillac

Units sold4-month sales of selected models

September October November December

Page 40: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

One way: If you hold down the Ctrl key as you block data,

non-contiguous data can be blocked. Proceed to create

the chart “as usual.”

Another way: Block a contiguous block of data that

includes the data you want the chart based on; create the

chart “as usual”; click Select Data to obtain the dialogbox

shown below, and

use the Remove button to remove the unwanted data

series (October and November). In order to do that, you

may have to (we do in the current example) use the Switch

Row/Column button. The series to leave checked are those

you DON’T wish to remove when you click the Remove

button.

Page 41: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

The chart shown below, created from non-contiguous data,

is a “stacked column” chart. As this example demonstrates, a

stacked column chart is typically used to show how

components contribute to a total.

A line chart, as shown below, is often used to show

-

10,000

20,000

30,000

40,000

50,000

September December

Units sold Season start sales

Ford Toyota Chevy Cadillac

-

2,000

4,000

6,000

8,000

10,000

12,000

14,000

16,000

September October November December

Un

its

sold

Sales of US models

Ford Chevy Cadillac

Page 42: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

how quantities change with respect to time (here, with respect

to months). Often, only one of the arrangements made possible

by the Switch Row/Column button makes sense for a line chart.

A pie chart, as shown below, is often used to illustrate the

proportions of a total contributed by individual components of

the total. This is especially true if you choose a style in which

the pie slices are labeled by their respective percentages.

A “scatter chart” is typically used to “graph data points” – e.g,

the chart shown below

31%

34%

24%

11%

December auto sales

Ford

Toyota

Chevy

Cadillac

Page 43: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

plots the data values for Deductions and for State income tax

against individual clients’ Gross income. Note this chart type is

an exception to the guideline stated earlier that you should

include under the block row and column headers; we saw that

doing so may yield bad labels and/or legends. The useful

legends we got in the chart shown above came when we

clicked Add Chart Element; Legend; and chose a location for the

legends (this choice can be changed, as above, by drag-and-

drop).

A high-low-close stock chart, such as is illustrated below,

$-

$100,000.00

$200,000.00

$300,000.00

$400,000.00

$500,000.00

$- $100,000.00 $200,000.00 $300,000.00 $400,000.00 $500,000.00 $600,000.00 $700,000.00 $800,000.00 $900,000.00

Gross income

Income tax data - selected clientsDeductions

State income tax

Page 44: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

is typically used to illustrate changes in the value of a share of

stock or other financial asset for a time period. The chart is

based on data satisfying the following requirements: for each

“company,” there is a series of 3 numeric values, listed in the

worksheet in the following order: a high value (e.g., the high

price for the time period), followed by a low value (e.g., the low

price for the time period), followed by an intermediate value

(e.g., the closing price, which logically is somewhere between

$-

$10.00

$20.00

$30.00

$40.00

$50.00

$60.00

$70.00

$80.00

Apple Computer Verizon Nike Adidas

Selected stock prices - February 31

High Price Low Price Closing Price

Page 45: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

the high and the low prices). For each “company” the chart

shows a vertical line segment, such that

The high point of the segment has height equal to the

high data value.

The low point of the segment has height equal to the

low data value.

There is a marked point on the line segment whose

height is equal to the intermediate data value.

Note your computer doesn’t know, nor does it care, if the data

for a high-low-close stock chart represents stock prices. As long

as the conditions stated above in italics are satisfied, the data

may be used for a high-low-closed stock chart.

It’s often desirable to sort data in a worksheet. This can be by

blocking the data series you wish to sort by, and, on the Home

tab, click Sort and Filter; from the resulting menu, choose A-Z

for alphabetical or ascending numeric order, or Z-A for reverse

alphabetical order or descending numeric order. The Sort

Warning dialogbox, shown below, appears.

Page 46: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Usually, you should choose “Expand the selection.” What this

means is that as data is rearranged in the (usually, column)

blocked, corresponding rearrangement of data occurs in the

other columns (e.g., so that as “Apple Computer” is moved to

A3, the company’s prices are also moved to row 3). Otherwise,

data is only rearranged in the blocked column.

A cell can be given a name by entering the desired name into

the Name Box. This is often useful in large worksheets, because

a cell you might want to use in a formula might be

inconveniently offscreen as you edit the formula; a well-chosen

name might be more easily remembered than the cell’s

address. A cell’s name can be used as a reference to the cell in

a formula. A cell’s name in a formula is copied in copy-and-

Page 47: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

paste operations, so, effectively, using a cell’s name in a

formula is to refer to the cell via a fixed reference. You can also

give a name to a range of data.

A common situation: The data you want to process in a

workbook is so voluminous that, rather than put it all into a

single worksheet, you prefer to break it into multiple

worksheets, so that the workbook is easier to read (especially,

in hardcopy). For example, you might prepare income tax

returns, using a different worksheet for each tax schedule you

use. This raises the following question: how does a formula

refer to a cell of a different worksheet? We see that if cell C2 of

our Schedule 1040 worksheet need to have the value of C10 of

the Schedule B worksheet, then C2 of our Schedule 1040

worksheet can use the formula

='Schedule B'!C10

More generally, a reference in a formula to a cell of a different

worksheet takes the form

‘nameOfSourceWorksheet’!cellReference

where the cell reference could be an address or a name, and

could be relative or fixed. E.g., other possibilities for the

formula above, depending on our copy-and-paste needs:

='Schedule B'!C$10

='Schedule B'!$C10

Page 48: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

='Schedule B'!$C$10

We have emphasized the power of a spreadsheet to

recalculate. However, on (perhaps rare) occasions, you will

want to disable recalculation (temporarily). This is because

recalculation takes time; if you work on a large workbook and a

slow computer, recalculation might take an unacceptable

amount of time when you are editing a series of data values.

Suspension of automatic recalculation can be done as follows:

on the Formulas tab, click Calculation Options, Manual. As a

result, recalculation will not take place until you “manually”

signal that you want it to take place. There are multiple ways

of requesting manual recalculation, including

Click the Calculate Now button; or

Press the F9 key; or

Switch back to automatic recalculation (typically, when

you no longer need manual recalculation) by clicking

Calculation Options, Automatic.

Note you usually will want to switch eventually to automatic

recalculation so that upon further changes in data, you can be

sure that formulas will recalculate.

Often, a worksheet is so large that cells you would like to view

simultaneously are too far apart to be seen simultaneously.

E.g., in the worksheet partially shown below,

Page 49: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

we can’t see the student’s last name (column A) and the

student’s grade (column R) simultaneously. This would make it

easy for the instructor to record grades in the University’s

student records incorrectly.

Excel offers the following solution to this problem. You can

split your view of a worksheet both horizontally and vertically,

creating 4 “sub-worksheets.” Scrolling can take place

independently on the left and right sides of the vertical split,

and above and below the horizontal split. You can take

advantage of this to keep, say, columns A and R in view

simultaneously.

Page 50: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

Here’s how it works. Put your cursor in the top left corner of

the bottom right subworksheet to be created. On the View tab,

click Freeze Panes, and choose Freeze Panes from the resulting

menu. E.g., with the cursor in C2, we froze the panes to get the

following:

Now, moving to R2 yields a view in which column C has

disappeared but columns A and B remain visible:

Page 51: Intro to Spreadsheets with MS Excel A spreadsheet ...purple.niagara.edu/boxer/essays/132/notes/13Excel.pdfIntro to Spreadsheets with MS Excel A spreadsheet, fundamentally, is a calculating

To remove the split, click the Freeze Panes button and select

Unfreeze Panes from the resulting menu.