MODULE 2: MODELING WITH SPREADSHEETS: WRITING

MODULE 2:
MODELING WITH SPREADSHEETS:
WRITING FORMULAS AND RELATIVE REFERENCING
Introduction
We just learned about representations that can be used to model in mathematics. In
addition, I hope you had an opportunity to develop your own opinions about the strengths
and weaknesses of these representations.
In this module, we are going re-visit each of the representations described in Module 1
using the spreadsheet technology. In the process, I will introduce you to different
features of spreadsheets and we will re-examine the strengths and weaknesses discussed
earlier. Our goal is to see if this technology changes these strengths and weaknesses in
any way or if it introduces new strengths and weaknesses as the spreadsheets are used to
solve problems.
Modeling with Spreadsheets
Spreadsheet programs can be used to model certain real-life phenomenon and they
include features that can be used to solve some of the problems associated with the
phenomenon. Microsoft Excel is one example of a spreadsheet program.
On your computer, open up your spreadsheet program (right now!).
Here is one example of a Microsoft Excel spreadsheet from a MacBook Pro, including
the headings for pull down menus.
Your spreadsheet may look different depending on which program you are using, which
version of Excel you are using, or whether you are using a PC or Macintosh computer.
But the basic design of all spreadsheets is the same: a table with columns labeled with
letters and rows labeled with numbers.
Exercise 2.1. Please look at the columns and rows in the figure above and take a guess at
where Column D and Row 5 will intersect.
The intersection between a column and a row is called a cell. For example, if you go to
Column D and move down the column until you hit Row 5, you will be in Cell D5:
Figure 2.1
Notice that when you are in Cell D5, the perimeter of the cell itself is highlighted, in this
case, in blue. Additionally, the Column heading (D) and the row heading (5) are also
highlighted, in this case, in dark gray.
You can maneuver your way around a spreadsheet by using left, right, up or down arrows
or by clicking in a cell of your choice with your mouse. Try doing this now, first by using
the arrows and then by clicking in different cells! Also, try typing in the names of
different cells that you land in. For example, in Figure 2.1, I typed in Cell D5. Locate a
few cells and label them so you can get practice negotiating the spreadsheet environment!
VIDEO 2.1 (Introduction to Spreadsheets. You will learn how to:
• make cells wider and thinner;
• work with the formatting palette;
• draw gridlines;
• format and align font;
• insert rows and columns;
• clear a spreadsheet
• add new speadsheets to a workbook;
Video 2.1 YouTube Link
Video 2.1 Elluminate Link
Table Representation Revisited
With Excel, we now have a ready-made table in which to input information. Let’s return
to the problem of modeling Nathan’s savings. Please label two cells Weeks and Savings,
and type in, by hand, the information we derived concerning Nathan’s Savings for a given
Week (do this now!):
Having created this table, you may be asking yourself, “So what’s the point of the
spreadsheet? Sure, it gives me a ready-made table, and it looks neater, but basically, it’s
the same as drawing a table and filling it in by hand!” And if you thought this, you would
be right! If we use Excel only to input information by hand, then the table representation
doesn’t change very much as far as its usefulness. Thankfully, Excel has two features
that change this and that radically transform the strengths and weaknesses of the table
representation to our benefit!
Writing Formulas and Relative Referencing
The first feature we want to investigate is that of writing formulas. To begin this
investigation, go back to your spreadsheet and look at the numbers in the Weeks Column.
How are the numbers related to each other? For example, if you look at Week 1, what
comes after 1? What comes after that? Explain this relationship in words.
Let’s try to write a formula that captures this relationship. Clear your prior spreadsheet.
Label your columns and input the initial condition into the top row (do this now):
Go to cell A3. You want to write a formula that tells Excel, “Please add 1 to the number
in the preceding cell” (this should produce a 1 in this cell). You can signal that you are
writing a formula by inputting an equals sign, “=”, into cell A3. Now, think about how
you might write a formula that says, “Add 1 to the contents of cell A2.”
One possibility for a formula is “=A2 + 1.” This can be read as, “Add 1 to the contents of
cell A2.” You can input this formula in one of two ways:
Step 1: Type in an “=”
One step (only longer!):
Step 2: Click on Cell A2 (A2 will
Type the entire formula by hand.
automatically appear after the “=”
That is, type in each of the individual
sign)
parts in “=A2 + 1”
Step 3: Type in “+1”
Your formula will look as follows in the cell:
Now, hit Return or Enter in Cell A3. When you do this, the formula in the cell disappears
and the number 1 appears. If you look in your Formula Bar (which is labeled with the
small icon fx) you will notice the formula remains displayed, even after you hit Enter.
 Formula Bar
Now comes the fun part! With Cell A3 selected, take your cursor and place it in the
lower right-most corner of cell A3. The cursor shape will change to a small black cross.
Hold the small black cross down with your mouse and drag down Column A for a few
rows. What happens? (!!!!!!)
VIDEO 2.2 • How do you input a formula?
• How do you drag down a formula?
• Displaying formulas
• CTR~ to straddle back and forth between formulas and numbers
Video 2.2 YouTube Link
Video 2.2 Elluminate Link
Exercise 2.2 Let’s try to describe the formula “=A2 + 1” in words. Given what happens
when you drag down, which is the better translation:
“Keep adding 1 to the contents of A2”
“Keep adding 1 to the cell above the one I am in”
Explain your choice.
Exercise 2.3 What formulas underlie cells A3, A4, A5, . . . .?
Exercise 2.4 Write a formula for cell B3 that generates Nathan’s Savings and drag it
down. Explain in words how the formula works. Also, explain what happens to the
letters and numbers in the cell references when they drag and why this makes sense.
VIDEO 2.3: Generate the Savings Column
• Drag it down
• Select both columns simultaneously and drag down really far!
• Freezing Panes
Video 2.3 YouTube Link
Video 2.3 Elluminate Link
Exercise 2.5 Recall the Table shortcoming that it’s hard to predict what is happening in
the long-run. For example, to see Nathan’s Savings at 50 weeks on a table drawn by
hand would take a long time. Does the spreadsheet address this shortcoming? Explain.
The exercises on Nathan’s Savings should have generated a table that looks as follows,
with corresponding underlying formulas:
Looking at the formulas, you will note that Excel adjusts the formula each time it dragged
down so that each formula could be interpreted as saying, “Add 1 to the cell above” (in
the case of the weeks) or “Add 2 to the cell above” (in the case of the Savings). Excel’s
ability to adjust its formulas in this way is called relative referencing. That is:
• the formula in cell A5 (“=A4 + 1”) relative references cell A4
• the formula in cell A8 (“=A7 + 1”) relative references cell A7
The formulas written above have the feature that they depend on values found in
preceding cells. In mathematics, such formulas have special names:
Definition: Formulas that consistently depend on immediately preceding values are
called recursive formulas.
Algebra Representation Revisited
We noted that a spreadsheet’s table format suggests the table representation. You might
also say that writing clear and appropriate headings for your spreadsheet elicits the words
representation. Is there any thing that you learned in the sections above that makes you
think of the other representations we discussed (algebra, graph)? Why?
What about the formulas? Do they evoke the algebra representation? One way to think
about this is to think of the cell references in the formulas as variables. For example, the
A2 in “=A2 + 1” can be thought of as a variable. Imagine substituting x for A2 in
“=A2 + 1.” The expression would become “= x + 1.” Now, imagine changing the values
of x to 0, 1, 2, 3, . . . (just as the value of the cell reference changes when you drag down).
What would the expression “= x + 1” become when x = 0, x = 1, x = 2. . . .?
In this section, we are going to develop this algebraic representation a bit further. We
continue with the problem of modeling Nathan’s Savings on Excel. In the sections
above, we modeled Nathan’s Weeks and Savings using recursive relationships. For
example, to model the weeks, we wrote the following recursive formula:
After entering and dragging this formula, we get the weeks:
Now, we want to generate the Savings differently. Let’s think of a formula for cell B2
that will generate the Savings. This time, however, we would like to do this nonrecursively, that is, without depending on preceding numbers. Instead, we would like the
formula to depend on the numbers in Column A or on the weeks.
Can you think of a way to do this? Can you write a formula for cell B2 that depends on
the number in cell A2 and models the Savings? Think about this before reading the hints
below.
Hint #1: Think back to our algebraic representation for Nathan’s savings. Do you
remember what it was? It was y = 2x + 5 where y is the Savings (the thing we’re trying to
model) and x is your week (our Column A). Any ideas for a formula?
Hint #2: Can you replace the x in y = 2x + 5 with a cell reference? Can you write a
formula yet?
Compare what you got to the design below. Explain your method and explain the method
below. Drag your formula down and see if it works!
Look at the formulas in Column B and their relationship to Column A. Explain, in
words, how the Column B formulas work.
Exercise 2.6 In this exercise, you will input words, numbers and formulas to generate a
table of Even numbers in Excel:
In particular, you will design two tables:
(a) one that generates the even numbers using a recursive formula,
(b) one that generates the even numbers using a non-recursive formula (HINT:
You will have to add another column of numbers to the spreadsheet above to
generate the even numbers non-recursively)
Video 2.4—Video examining Even number spreadsheet
Video 2.4 YouTube Link
Video 2.4 Elluminate Link
Exercise 2.7 Compare and contrast how recursive and non-recursive formulas reference
cells. Use the example above (in 2.6) to discuss your answer.