You are on page 1of 37

Econ 102A Statistical Methods for Social Scientists Page 1 of 37

Econ 102A Excel Functions and Tools

Econ 102A requires knowledge of various Excel functions and tools. This document attempts
to explain and summarize your responsibilities in this regard. Though some of the functions
and tools may not be explicitly used in Econ 102A (due to time constraints), I have included
them just in case. The information is presented in the following general categories:

• Basic Excel Functions

SUM MAX
PRODUCT MIN
SUMPRODUCT

• Excel Functions Commonly used in Simulation

RAND IF( … IF( … )) SUMIF


RANDBETWEEN IF(AND … ) LOOKUP
IF IF(OR … ) LOOKUP(RAND( ) … )
IF(RAND( ) … ) COUNTIF

• Excel Functions Commonly used in Sampling

AVERAGE STDEV
VARP COVAR
VAR CORREL
STDEVP

• Excel Functions Relating to Binomial Distributions

FACT CRITBINOM
COMBIN CRITBINOM(… RAND( ))
BINOMDIST

• Excel Functions Relating to Normal Distributions and T-Distributions

NORMDIST NORMINV(RAND( ) … )
NORMSDIST TDIST
NORMINV TINV
NORMSINV

• Useful Excel Tools

Solver
Data Tables
Page 2 of 37

Basic Excel Functions

• SUM( … )

The SUM function adds up a range of cells or specific numbers. One specifies the range or
specific numbers within the parentheses.

Example:

A B C
1 3 Here we are adding specific numbers
2 -8 instead of referencing a range of cells.
3 15 The formula underlying cell C7 is:
4 6
5 12
= SUM(2, 4, 6)
6
7 28 12

Here we are adding cells A1 through A5.


The formula underlying cell A7 is:
=SUM(A1:A5)

• PRODUCT( … )

The PRODUCT function multiplies ranges of cells or specific numbers. One specifies the
range or specific numbers within the parentheses.

Example:

A B C
1 3 Here we are multiplying specific numbers
2 -8 instead of referencing a range of cells.
3 15 The formula underlying cell C7 is:
4 6
5 12 = PRODUCT(2, 4, 6)
6
7 - 25920 48

Here we are multiplying cells A1 through


A5. The formula underlying cell A7 is:
= PRODUCT(A1:A5)
Page 3 of 37

• SUMPRODUCT(array 1, array 2, … )

The SUMPRODUCT function multiplies corresponding components in arrays and then


calculates the sum of the products.

Example 1: You have invested in five separate stocks, each with a varying number of
shares. At the close of a given day’s market activity, you record the price per share for
each of these stocks. Calculate your total holdings in the five stocks collectively.

A B C
1 Shares Owned Price Per Share
2 Stock 1 684.151 $12.97
3 Stock 2 163.603 $48.18
4 Stock 3 517.195 $24.68
5 Stock 4 1,138.028 $10.99
6 Stock 5 857.686 $12.35
7
8 Total Holdings $52,619.55

Here we are multiplying Column B cells with


corresponding Column C cells and summing the
results. The formula underlying cell C8 is:
= SUMPRODUCT(B2:B6,C2:C6)

Example 2: A certain theater is showing the latest Disney movie at both 3:00pm and
6:00pm. Tickets for the 3:00pm showing are at the regular rates of $6.00 for children and
$8.00 for adults. All tickets for the 6:00pm showing are sold at a 20% discount with
respect to the regular rates. The 3:00pm showing attracted 34 adults and 47 children while
the 6:00pm showing attracted 56 adults and 78 children. Determine the collective revenue
earned from ticket sales among these two separate showings.

A B C
1 Attendance This example emphasizes that the
2 3:00pm 6:00pm inputs need not be in a single
3 Adults 34 56 column or row in order to have
4 Children 47 78 compatible multiplication. The
5 formula underlying cell C11 is:
6 Ticket prices
7 3:00pm 6:00pm = SUMPRODUCT(B3:C4,B8:C9)
8 Adults $8.00 $6.40
9 Children $6.00 $4.80
10
11 Total Ticket Revenue $1,286.80
Page 4 of 37

A useful fact about the SUMPRODUCT function is that one can arithmetically transform
the arrays before the multiplication is performed. This transformation can be done directly
within the SUMPRODUCT function as opposed to creating new calculations on the
spreadsheet.

Example 3: A weatherman records the noontime temperature (in degrees Fahrenheit) for
50 consecutive summer days in a particular city. The frequency for each temperature is
shown in the spreadsheet below. Determine the average temperature in degrees Celsius
across the 50 days.

A B C
1 Days Temp (Fahr) The formula underlying cell C18
2 1 66 is:
3 2 68
4 4 70 = SUMPRODUCT(B2:B14/B16,
5 5 71 5/9*(C2:C14-32))
6 5 72
7 4 74 Notice that, in the first array
8 8 77 within the SUMPRODUCT
9 6 78 function, each number of days is
10 4 79 divided by 50 to find the
11 3 81 proportionate frequency.
12 5 84
13 2 88 In the second array temperature is
14 1 94 being converted from Fahrenheit
15 to Celsius via the formula:
16 Total 50
17 Celsius = 5/9 * (Fahrenheit – 32)
18 Average in Celsius 24.7333 After both arrays have been
appropriately transformed, the
SUMPRODUCT delivers the
average temperature, expressed in
Celsius degrees.

• MAX( … ) and MIN( … )

The MAX and MIN functions return the largest and smallest numbers (respectively) among
the numbers or arrays specified within the parentheses.

Example: An instructor records both midterm and final examination scores among his
students. Both exams are worth 100 points. Determine the highest and lowest examination
scores (treating both midterm scores and final exam scores as one collective group) among
all the students.
Page 5 of 37

A B C D
1 Student Midterm Score Days Absent Final Score
2 1 93 0 82
3 2 89 1 98
4 3 74 0 81
5 4 55 1 67
6 5 72 1 60
7 6 87 2 74
8 7 91 0 94
9 8 68 3 58
10 9 52 4 73
11 10 75 2 81
12
13 Maximum 98
14
15 Minimum 52

The formula underlying cell D13 is:


= MAX(B2:B11, D2:D11)
This function locates the highest overall exam score.

The formula underlying cell D15 is:


= MIN(B2:B11, D2:D11)
This function locates the lowest overall exam score.
Page 6 of 37

Excel Functions Commonly used in Simulation

• RAND( )

RAND( ) generates a random number between 0 and 1. The RAND( ) function is vital to
all spreadsheet simulations. Specifically, suppose we have Event A with probability p of
occurring. We can use the RAND( ) function to generate a random number which, in turn,
determines whether or not Event A happens for a single trial. More precisely, Event A is
said to happen if RAND( ) generates a number strictly less than p, whereas Event A does
not happen if RAND( ) generates a number greater than or equal to p.

The RAND( ) function can also be used to resolve probabilistic issues having more than
two outcomes as seen in the following example.

Example: Consider ten economics students who are about to begin Econ 102A. The
administration decides to randomly assign them to the three instructors teaching the course.
The RAND( ) function can be used to make the allocation. Specifically, each student is
assigned an individual random number and, based on the number, will be assigned to the
instructors in accordance with the following table:

If the student’s random number is …. The student is assigned to ….

0 ≤ RAND( ) < 1/3 Professor A

1/3 ≤ RAND( ) < 2/3 Professor B

2/3 ≤ RAND( ) < 1 Professor C

The spreadsheet might then look like:

A B
1 Student Random Number The formula underlying each of
2 Student 1 0.905541924 cells B2 through B11 is:
3 Student 2 0.105900014
4 Student 3 0.505287835 = RAND( )
5 Student 4 0.98370902
6 Student 5 0.160156959
In accordance with these random
7 Student 6 0.801843016 numbers, Students 2, 5 and 10
8 Student 7 0.343651266 would be assigned to Professor A,
9 Student 8 0.687064665 Students 3, 7 and 9 would be
10 Student 9 0.486409795 assigned to Professor B and
11 Student 10 0.209763346 Students 1, 4, 6 and 8 would be
assigned to Professor C.
Page 7 of 37

• RANDBETWEEN(bottom, top)

RANDBETWEEN(bottom, top) generates a random integer between the “bottom” and


“top” numbers specified within the parentheses. The RANDBETWEEN function differs
from the RAND function in that (1) it generates random numbers for any range of values
(as opposed to between 0 and 1) and (2) the generated random number is always an integer.

Example: A Stanford instructor plans to implement random cold-calling in his class.


Specifically, the instructor plans to test his students by asking eight difficult questions
during his lecture. The instructor will randomly select which students to cold-call for the
responses. (Assume a class size of 65 students.)

A B
1 Question Student to Respond The formula underlying each of
2 Question 1 9 cells B2 through B9 is:
3 Question 2 57
4 Question 3 27 = RANDBETWEEN(1, 65)
5 Question 4 30
6 Question 5 33 So, when looking at the alphabetical
7 Question 6 41 class roster, the 9th student down the
8 Question 7 6 list answers Question 1, the 57th
9 Question 8 27 student down the list answers
Question 2, etc.

Notice Student 27 will be cold-


called for both Questions 3 and 8.
Not too lucky, but this is always a
possibility when dealing with
random outcomes!

• IF(condition, output if condition is met, output if condition is not met)

The logical function IF( ) specifies a condition which is tested as being true or false. If
the condition is met a certain output is displayed, whereas if the condition is not met a
different output is displayed.

Example: Suppose cell A1 contains the number 10. Then, typing the command
= IF(A1 < 15, “Yes”, “No”) would generate the output “Yes” (since the condition
A1 < 15 is indeed true). In contrast, the command = IF(A1 < 7, “Yes”, “No”) would
generate the output “No.”
Page 8 of 37

• IF(RAND( ) < p, output if true, output if false)

This is a special case of the IF function described above and one which is commonly used
in simulations as evidenced by the following example.

Example: You have invested $1,000 in a particular stock. Each month you believe the
stock has a 55% chance of gaining 8% and a 45% chance of losing 5%. Simulate this
investment over a 6-month period.

A B C D E
1 Time Movement Balance The formula underlying
2 Initial Balance $1,000.00 cell E3 is:
3 End of Month 1 Up $1,080.00
4 End of Month 2 Down $1,026.00
= IF(C3=”Up”, 1.08*E2,
5 End of Month 3 Up $1,108.08 0.95*E2)
6 End of Month 4 Up $1,196.73
The formulas underlying
7 End of Month 5 Down $1,136.89
cells E4 through E8 are
8 End of Month 6 Up $1,227.84
similar.

The formula underlying each of cells


C3 through C8 is:
= IF(RAND( ) < .55, “Up”, “Down”)

Note: Column C is redundant. The cell E3 formula can simply be “= IF(RAND( ) < .55,
1.08*E2, 0.95*E2)” with similar formulas for cells E4 through E8. But, I chose the above
representation so that one column uses the IF(RAND( ) < p, … ) function whereas the other
column uses a more conventional IF( ) function.

• IF(condition 1, output if condition 1 met, IF(condition 2, output if condition 2 met,


… , output if no conditions met) …)

Many times you will find it convenient to use a “nested” IF statement. Here, you ask Excel
to check a condition and, if the condition is true, an output is displayed. But, if the
condition is false, Excel then checks a second condition that you specify. If this condition
is false you can then ask Excel to check a third condition, and so on.

Example: You have invested $1,000 in a particular stock. Each month you believe the
stock has a 25% chance of gaining 12%, a 45% chance of gaining 4% and a 30% chance of
losing 8%. Simulate this investment over a 6-month period.
Page 9 of 37

A B C D E
1 Time RAND( ) Balance The formula underlying
2 Initial Balance $1,000.00 each of cells C3 through
3 End of Month 1 0.0415228 $1,120.00 C8 is:
4 End of Month 2 0.8906826 $1,030.40
5 End of Month 3 0.2489551 $1,154.05 = RAND( )
6 End of Month 4 0.2390308 $1,292.53
7 End of Month 5 0.7410194 $1,189.13 This simulates monthly
8 End of Month 6 0.444181 $1,236.70 stock performance.

The formula underlying cell E3 is:


= IF(C3 < 0.25, 1.12*E2, IF(C3 < 0.70, 1.04*E2, 0.92*E2))
The formulas underlying cells E4 through E8 are similar.

The formulas in Column E contain the nested IF statements. A word of clarity is in order
here. Reflect on the formula underlying cell E3 (written in the box directly above).
Specifically, concentrate on the second condition, which checks if C3 < 0.70. The setup
we have here is that, if RAND( ) is between 0 and 0.25 the stock rises 12%, if RAND( ) is
between 0.25 and 0.70 (notice this is 45% in total) the stock rises 4%, if RAND( ) exceeds
0.70 the stock loses 8%. But wait! Shouldn’t the second condition then check whether
0.25 ≤ C3 < 0.70 instead of just C3 < 0.70? Haven’t we committed an error when
stipulating this second condition?

No, we have not made an error. Excel reads the conditions from left to right. That is,
Excel starts with the first condition and, only if this statement is false, will Excel then
proceed to the second condition.

Here, the first condition Excel checks is whether C3 < 0.25. Excel only moves to the
second condition (i.e. C3 < 0.70) if this first condition is false. So, by the time Excel reads
the second condition, we already know that the RAND( ) value is 0.25 or greater.
Therefore, the second condition now only needs to check whether C3 < 0.70; by virtue of
getting to this second condition C3 ≥ 0.25 is already guaranteed.

An important side note regarding the RAND( ) function within an IF statement:

Reconsider the previous example. To model the stock’s month-by-month outcomes, a


student might try to forgo actually listing the random number in Column C and try to use
the IF(RAND( ) … ) function to do the simulation more directly. That is, in cell E3, one
might try:
Page 10 of 37

= IF(RAND( ) < 0.25, 1.12*E2, IF(RAND( ) < 0.70, 1.04*E2, 0.92*E2))

However, this is not correct! The issue here is that, for the above representation, Excel will
generate a different random number for each RAND( ) command in the expression. Recall
from above that Excel reads expressions from left to right. So, for this expression, Excel
will start by generating a random number and checking whether it is less than 0.25. If it is
not, Excel then moves to the second IF statement to test the condition RAND( ) < 0.70.
However, when moving to this second RAND( ) command, Excel will generate a new
random number and test whether this new random number is less than 0.70. This is not
what we want; we want the random number to stay fixed. We first test whether this (fixed)
random number is less than 0.25. If it is not, we want to check whether this (fixed) random
number is then less than 0.70 (which would mean it must be between 0.25 and 0.70).

Why is it incorrect for the random number to change throughout the expression? Well,
from the initial problem statement, we want the stock to have a 45% chance of gaining 4%.
However, if we attempt to model this by the expression shown atop this page, there is a
75% chance Excel will get to the second RAND( ) command, and then there is a 70%
chance that the stock gains 4%. Overall, then, the probability of realizing the 4% gain in
stock is (.75) (.70) = 52.5%, instead of the required 45%.

• IF(AND(conditions), output if all conditions met, output if any condition not met)

The logical function AND( ) specifies a set of conditions which are tested as being true or
false (as a group). If all the conditions are met a certain output is displayed, whereas if any
condition is not met a different output is displayed.
Example: Suppose cell A1 contains the number 10 and cell B1 contains the number 20.
Then, the command = IF(AND(A1 < 15, B1 < 30), “Yes”, “No”) would generate the output
“Yes” (since both the condition A1 < 15 and the condition B1 < 30 are indeed true). In
contrast, the command = IF(AND(A1 < 15, B1 < 15), “Yes”, “No”) would generate the
output “No” (because the condition B1 < 15 is false).

Please see the example within the COUNTIF( ) section for a further example.

• IF(OR(conditions), output if any condition is met, output if no conditions are met)

The logical function OR( ) specifies a set of conditions which are tested as being true or
false (as a group). If any condition is met a certain output is displayed, whereas if all
conditions are not met a different output is displayed.

Example: Suppose cell A1 contains the number 10 and cell B1 contains the number 20.
Then, the command = IF(OR(A1 < 15, B1 < 15), “Yes”, “No”) would generate the output
“Yes” because A1 < 15 (i.e. at least one of the conditions is true). In contrast, the command
Page 11 of 37

= IF(AND(A1 < 7, B1 < 15), “Yes”, “No”) would generate the output “No” since all the
conditions are false.

Please see the example within the COUNTIF( ) section for a further example.

• COUNTIF(cell range, criteria that must be met to be counted)

As the name implies, the COUNTIF( ) function counts the specific number of occurrences
of some characteristic of interest within a range of cells.

Example: Ten high school students have just completed a college entrance exam having
three sections: reading, writing and mathematics. Each section has a maximum possible
score of 800 points and each students’ ultimate results are shown below. University A
requires that any incoming student receive a mathematics score of at least 650 as well as an
overall score of at least 1800. University B, a school strong in liberal arts, requires that any
incoming student receive at least a 680 in either reading or writing (or both). Determine
how many of the ten students fulfill the requirements of each individual university.

A B C D E F G H I
1 Student Reading Writing Math Total Univ. A Univ. B
2 Student 1 550 570 740 1860 Yes No
3 Student 2 700 610 500 1810 No Yes
4 Student 3 610 570 690 1870 Yes No
5 Student 4 580 540 550 1670 No No
6 Student 5 620 680 520 1820 No Yes
7 Student 6 560 530 670 1760 No No
8 Student 7 630 580 650 1860 Yes No
9 Student 8 720 690 710 2120 Yes Yes
10 Student 9 540 600 730 1870 Yes No
11 Student 10 580 710 610 1900 No Yes
12
13 Total students fulfilling each University’s requirements: 5 4

The formula underlying cell H2 is:


= IF(AND(E2>=650, F2>=1800), “Yes”, “No”) The formula underlying cell
H13 is:
The formulas underlying cells H3 through H11 are similar.
= COUNTIF(H2:H11, “Yes”)
The formula underlying cell I2 is:
The formula underlying cell
= IF(OR(C2>=680, D2>=680), “Yes”, “No”) I13 is similar.
The formulas underlying cells I3 through I11 are similar.
Page 12 of 37

• SUMIF(cell range to check criteria, criteria that must be met, cell range for sums)

The SUMIF( ) function checks for certain criteria within a range of cells and then adds up
the corresponding cells of a (potentially) different range of cells.

Example: Ten teams are divided into two divisions: Group A and Group B. Each team
played a 50-game schedule and the final records of each team is shown in the spreadsheet
below. Determine the aggregate number of wins and losses among all teams in Group A.

A B C D
1 Team Group Wins Losses
2 Team 1 Group A 38 12
3 Team 2 Group B 36 14
4 Team 3 Group A 32 18
5 Team 4 Group A 31 19
6 Team 5 Group B 25 25
7 Team 6 Group B 24 26
8 Team 7 Group B 20 30
9 Team 8 Group A 17 33
10 Team 9 Group B 16 34
11 Team 10 Group A 11 39
12
13 Totals for Group A: 129 121

The formula underlying cell C13 is:


= SUMIF(B2:B11, “Group A”, C2:C11)
The formula searches for all Group A teams and then
adds up their aggregate number of wins.

The formula underlying cell D13 is:


= SUMIF(B2:B11, “Group A”, D2:D11)
The formula searches for all Group A teams and then
adds up their aggregate number of losses.

• LOOKUP(value, lookup range, result range)

The LOOKUP function “looks up” a value in a particular range and returns a
corresponding value in a different range.

To use LOOKUP one must determine a value that is to be looked up in a particular range.
The specific value is the first specification within the parentheses and the range to be
Page 13 of 37

searched is the second specification. Once Excel finds the value in the range, it then
displays the corresponding entry of a different range. This different range is the third
specification within the parentheses.

For example, suppose one uses LOOKUP in such a way that Column A is the range to be
searched and Column B is the range for output. Suppose further that the lookup value is
chosen as 10. Then, Excel searches for the number 10 within Column A. If, say, cell A18
contains the number 10, the LOOKUP function would then give the contents of cell B18 as
output.

Two important facts regarding the LOOKUP function are as follows: (1) the values in the
range to be searched must be in ascending order, and (2) if LOOKUP cannot find the
precise lookup value in the range to be searched, it locates the greatest value less than or
equal to the lookup value.

Example: An accountant is preparing tax returns for three separate, unmarried individuals.
The taxable income for the three people are $112,355, $46,993 and $186,246 respectively.
The schedule which converts taxable income to the amount of federal tax owed is shown in
the spreadsheet below. Determine the federal tax owed for each of these three people.

A B C D E
1 Taxable Income Base Tax Pct on Excess
2 from … to …
3 $0 $8,025 $0.00 10%
4 $8,025 $32,550 $802.50 15%
5 $32,550 $78,850 $4,481.25 25%
6 $78,850 $164,550 $16,056.25 28%
7 $164,550 $357,700 $40,052.25 33%
8 $357,700 $103,791.75 35%
9
10
11 Taxable Inc Base Tax Tax on Excess Total Tax
12 Person 1 $112,355 $16,056.25 $9,381.40 $25,437.65
13 Person 2 $46,993 $4,481.25 $3,610.75 $8,092.00
14 Person 3 $186,246 $40,052.25 $7,159.68 $47,211.93

The formula underlying cell C12 is: The formula underlying cell D12 is:
= LOOKUP(B12, A3:A8, D3:D8) = LOOKUP(B12, A3:A8, E3:E8) *
(B12 − LOOKUP(B12, A3:A8))
This looks up the person’s taxable income in Column A
and displays the corresponding base tax from Column D. Please see the note below for further
elaboration.
The formulas in cells C13 and C14 are similar.
Page 14 of 37

The use of the LOOKUP function in cells C12 through C14 is straightforward and
hopefully the explanation in the text box above suffices. But, let us look more closely at
the formula underlying cells D12 through D14. Specifically, the formula in cell D12 can
be broken up into the following two parts:

(i) LOOKUP(B12, A3:A8, E3:E8): This part looks up the person’s taxable income in
Column A and displays the corresponding percentage the person must pay on income
within their income category from Column E.

(ii) B12 − LOOKUP(B12, A3:A8): This part calculates the amount of taxable income
which is in excess of the previous income category. Note, in particular, that the
LOOKUP function here has the form LOOKUP(B12, A3:A8), which is omitting a
specification of the result range. In this case, the search range and the result range are
the same; Excel looks up the value within Column A and displays as output the value
from Column A as well.

Upon multiplying the two parts, we find the total tax due from the excess income above the
previous income category. The formulas for cells D13 and D14 are similar.

• LOOKUP(RAND( ), lookup range, result range)

This is a special case of the LOOKUP function described above and one which is
commonly used in simulations as evidenced by the following example.

Example: An operations manager is analyzing the number of defective items generated


during production runs. For a particular machine, the percentage of defective items during
a given production run is given by the following table:

Percentage of Defective Items Probability

0% 15%

1% 23%

2% 32%

4% 27%

6% 3%

Consider ten different production runs. Simulate the percentage of defective items within
each of these individual runs.
Page 15 of 37

A B C D E F
1 Defect Pct Probability Cumulative Probability Run Simulation
2 0% 1 2%
3 0% 15% 15% 2 0%
4 1% 23% 38% 3 4%
5 2% 32% 70% 4 6%
6 4% 27% 97% 5 1%
7 6% 3% 100% 6 4%
8 7 2%
9 8 1%
10 9 1%
11 10 0%

The formula underlying cells F2 through F11 is:


= LOOKUP(RAND( ), C2:C6, A3:A7)

To simulate the percentage of defective items within a particular production run, a random
number is generated. The random number is then “looked up” in the range C2 to C6 with
the output being the corresponding cell in Column A.

Let us take a moment to verify that the “Defect Percentages” are being chosen in the proper
proportions. If 0 ≤ RAND( ) < .15, the LOOKUP function will select the 0% specified in
cell C2. (Remember that, if the precise lookup value is not in the range, LOOKUP selects
the greatest value less than or equal to the lookup value.) In this scenario, the LOOKUP
output will be cell A3 (i.e. a 0% defect percentage). So, overall, there is a 15% chance that
the simulation output will be “0% defectives” for the run. This is consistent with the
problem statement.

Likewise, if .15 ≤ RAND( ) < .38, the LOOKUP function will select the 15% specified in
cell C3. In this scenario, LOOKUP output will be cell A4 (i.e. a 1% defect percentage).
So, overall, there is a .38 - .15 = 23% chance that the simulation output will be “1%
defectives” for the run. Again, this is consistent with the problem statement. Each of the
other defect percentages can be verified with similar logic.
Page 16 of 37

Excel Functions Commonly used in Sampling

• AVERAGE( … )

The AVERAGE function computes the mean of a range of cells or specific numbers. One
specifies the range or specific numbers within the parentheses.

Example:

A B C
1 3 Here we are averaging specific numbers
2 -8 instead of referencing a range of cells.
3 15 The formula underlying cell C7 is:
4 6
5 12
= AVERAGE(2, 4, 8, 14)
6
7 5.6 7

Here we are averaging cells A1 through


A5. The formula underlying cell A7 is:
= AVERAGE(A1:A5)

• VARP( … ) and VAR( … )

As typically used in Econ 102A, the VARP and VAR functions calculate the variance of a
range of cells. One specifies the range within the parentheses.

The VARP function is used when the underlying data represents the entire population. The
VAR function is used when the underlying data represents a sample (i.e. a subset of the
entire population) and you are using the sample to estimate the population variance.

Please see the examples within the next section to contrast the use of these functions.

• STDEVP( … ) and STDEV( … )

The STDEVP and STDEV functions calculate the standard deviation of a range of cells.
One specifies the range within the parentheses.

The STDEVP function is used when the underlying data represents the entire population.
The STDEV function is used when the underlying data represents a sample (i.e. a subset of
Page 17 of 37

the entire population) and you are using the sample to estimate the population standard
deviation.

Examples: (1) A class contains ten students. Each took a midterm examination and
their respective scores are shown on the left side of the spreadsheet below.
Calculate the class variance and standard deviation of the exam scores.

(2) A newspaper stand is analyzing the number of copies of the Chicago Sun
Times that it sells during the year. The proprietor records the number of
copies sold during ten random days during the year (listed on the right side
of the spreadsheet below). Use this sample to estimate the variance and
standard deviation for the number of Chicago Sun Times copies sold each
day over the course of the year.

A B C D E
1 Student Score Day Number Sold
2 Student 1 74 Day 1 104
3 Student 2 81 Day 2 110
4 Student 3 68 Day 3 89
5 Student 4 85 Day 4 105
6 Student 5 93 Day 5 132
7 Student 6 87 Day 6 92
8 Student 7 77 Day 7 102
9 Student 8 63 Day 8 86
10 Student 9 96 Day 9 128
11 Student 10 82 Day 10 89

12 Variance 97.84 Variance 257.5666667


13 Std Dev 9.8914104 Std Dev 16.04888366

The formulas underlying cells B12 The formulas underlying cells E12
and B13 are (respectively): and E13 are (respectively):

= VARP(B2:B11) and = VAR(B2:B11) and


= STDEVP(B2:B11) = STDEV(B2:B11)

The “P” is included in the functions The “P” is omitted in the functions
since the ten students represent the since the ten days are just a sample
entire population of students in the from the entire population of all days
course. during the year.
Page 18 of 37

• COVAR(array 1, array 2) and CORREL(array 1, array 2)

The COVAR function calculates the covariance between two arrays of numbers. The
covariance is a measure of how two variables change together. In finance, covariance
plays a central role in calculating the overall variance of an investment portfolio.

The CORREL function calculates the correlation coefficient between two arrays of
numbers. As will be discussed in class, the correlation coefficient is closely related to
covariance and measures the degree of dependence between two variables. In general, the
correlation coefficient between two variables always lies in the range from -1 to 1.

Example: A financial analyst follows three stocks for one year. The spreadsheet below
shows the month-by-month gains and losses each stock experienced. Determine both the
covariance and the correlation coefficient between each coupling of pair-wise stocks.

A B C D E F G H
1 Month Stock 1 Stock 2 Stock 3
2 January 8.38% -7.32% 18.13%
3 February -17.48% 19.67% -12.22%
4 March 7.59% -8.51% 13.48%
5 April 6.60% 16.93% 4.16%
6 May -6.27% -13.26% -9.78%
7 June 1.35% 8.36% -2.94%
8 July 14.77% -10.83% 7.31%
9 August 12.08% 7.04% 13.02%
10 September -15.38% 20.11% -8.84% Coupling Covariance Correlation
11 October 18.48% 1.78% 22.20% Stocks 1 and 2 -0.007050 -0.5251
12 November 10.27% -14.98% 4.37% Stocks 1 and 3 0.010359 0.8729
13 December 5.68% -2.38% 11.83% Stocks 2 and 3 -0.005131 -0.3813

The formula underlying cell G11 is: The formula underlying cell H11 is:
= COVAR(B2:B13, C2:C13) = CORREL(B2:B13, C2:C13)
The formulas underlying cells G12 The formulas underlying cells H12
and G13 are similar. and H13 are similar.

The negative covariance between Stock 1 and Stock 2 implies a tendency for these stocks to
move in opposing directions (i.e. when one rises the other falls and vice-versa). Conversely,
the positive covariance between Stock 1 and Stock 3 implies a tendency for these stocks to
move in the same direction (i.e. they tend to rise together or fall together). Further, the
tendency for Stock 1 and Stock 3 to move together is quite strong as evidenced by their
correlation coefficient of .8729, which is fairly close to the upper bound of 1.
Page 19 of 37

Excel Functions Relating to Binomial Distributions

• FACT(k)

The FACT function computes the factorial of the number specified within the parentheses.
That is, FACT delivers the number k!

Example: FACT(6) = 6  5  4  3  2  1 = 720

• COMBIN(n, j)

The COMBIN function computes “n choose j”, a component of the binomial formula.
Specifically, COMBIN determines the number of ways one can choose j particular items
among a total pool of n items.

Example: We plan to ask five people a Yes/No question. Determine how many different
combinations (or sequences) of responses we can get such that we obtain exactly two
“Yes” responses among the five people.

Solution: Writing things out by hand, the various combinations would be YYNNN,
YNYNN, YNNYN, YNNNY, NYYNN, NYNYN, NYNNY, NNYYN, NNYNY and
NNNYY. That is, there are ten different combinations that deliver two Yes responses
among five people.

Using the COMBIN function we are trying to choose j = 2 Yes responses from n = 5 total
people. And, COMBIN(5, 2) = 10 which verifies the “longhand” solution above.

Notice that the question could be equivalently rephrased by asking to find the number of
combinations such that we obtain exactly three “No” responses from the five people (since
exactly two “Yes” responses imply exactly three “No” responses and vice-versa). Here, we
would find ourselves computing COMBIN(5, 3) but we see that COMBIN(5, 3) = 10 as
well! So, it makes no difference from which perspective we ask the initial question; in
general COMBIN(n, j) = COMBIN(n, n-j).

• BINOMDIST(j, n, p(success), True/False)

The BINOMDIST function calculates probabilities via the binomial formula. As


parameters, you need to specify the total number of trials (n) and the sought-after number
of successes (j). You must also specify the probability of success on any single trial.

BINOMDIST also requires a True/False specification. If you specify “False” you will be
given the exact probability of j successes among n trials. If you specify “True” you will be
Page 20 of 37

given the cumulative probability of having between 0 and j (inclusive) successes among n
trials.

Examples:

5
BINOMDIST(3, 5, .60, False) =   (.60)3 (.40)2 = .3456
 3

BINOMDIST(3, 5, .60, True) =

5 5 5 5


  (.60)0 (.40)5 +   (.60)1 (.40)4 +   (.60)2 (.40)3 +   (.60)3 (.40)2 = .66304
0 1  2  3

• CRITBINOM(n, p(success), value)

The CRITBINOM function also relates to the binomial formula. Specifically, its
parameters require the total number of trials (n) and the probability of success on any
single trial.

Note also that CRITBINOM requires another parameter called “value”, which is an input
between 0 and 1. Once “value” is specified, CRITBINOM returns the smallest number of
successes (j) such that the cumulative probability of having between 0 and j successes
exceeds “value.”

Example: Suppose the number of trials is eight and the probability of success on any trial
is .30. Suppose we set “value” at .70. Determine CRITBINOM(8, .30, .70).

We have:

8 8 8


  (.30)0 (.70)8 +   (.30)1 (.70)7 +   (.30)2 (.70)6 = .5518, and
0 1  2

8 8 8 8


  (.30)0 (.70)8 +   (.30)1 (.70)7 +   (.30)2 (.70)6 +   (.30)3 (.70)5 = .8059
0 1  2  3

We therefore see that, when we have up to 2 successes, the cumulative probability is .5518.
When we have up to 3 successes, the cumulative probability is .8059. Therefore, in
moving from 2 to 3 successes, we have bypassed the target “value” of .70 in terms of
cumulative probability. Therefore, CRITBINOM(8, .30, .70) = 3.
Page 21 of 37

• CRITBINOM(n, p(success), RAND( ))

This is a special case of the CRITBINOM function described above and one which is
commonly used in simulations involving the binomial formula as evidenced by the
following example.

Example: You have invested $1,000 in each of ten different stocks. For each individual
stock you believe that, in any given month, the stock has a 53% chance of rising 5% and a
47% chance of dropping 3%. Movements between stocks are believed to be independent
as well as month-to-month movements for any particular stock. Simulate the worth of your
investment by year’s end.

A B C
1 Stock No. of Months Stock Rises Value at Year's End
2 Stock 1 4 $952.64
3 Stock 2 10 $1,532.63
4 Stock 3 6 $1,116.26
5 Stock 4 5 $1,031.21
6 Stock 5 6 $1,116.26
7 Stock 6 7 $1,208.33
8 Stock 7 8 $1,307.98
9 Stock 8 7 $1,208.33
10 Stock 9 3 $880.06
11 Stock 10 5 $1,031.21
12
13 Total $11,384.92

The formulas underlying cells B2 The formula underlying cell C2 is:


through B11 are:
= (1.05)^(B2)*(.97)^(12-B2)*1000
= CRITBINOM(12, .53, RAND( ))
The formulas in cells C3 through C11
These formulas randomly determine are similar.
the number of months during the year
that the stock rises, assuming the Column C tabulates the end of year
probability of a rise in any given worth of each stock in accordance
month is 53%. with the simulation result from
Column B.
Page 22 of 37

Excel Functions Relating to Normal Distributions and T-Distributions

• NORMDIST(x, mean, standard deviation, True)

The NORMDIST function calculates probabilities for normally distributed random


variables. As parameters, you need to specify a specific random variable value (x) as well
as the mean and standard deviation of the normal distribution.

NORMDIST also requires a True/False specification. However, in Econ 102A, we only


need the ‘True’ version of the function. Under this specification NORMDIST calculates
the (cumulative) probability of the random variable being in the range from - ∞ up to x.

Visually, we have:
NORMDIST calculates the probability
of being less than a particular x-value
(i.e. as shown by the shaded region).

Example: The amount of money a casino profits in any given day is assumed to be a
normally distributed random variable have a mean of $8,000 and a standard deviation of
$3,000. Determine the probability that, in a given day, the casino (i) profits less than
$6,000, and (ii) profits at least $11,500.

Solution: (i) NORMDIST(6000, 8000, 3000, True) = .2525.

(ii) 1 - NORMDIST(11500, 8000, 3000, True) = .1217.

• NORMSDIST(z)

The NORMSDIST function operates similarly to the NORMDIST function. The difference
being that NORMSDIST assumes the normal distribution has been standardized. Since a
standardized normal distribution always has a mean of zero and a standard deviation of one
there is no need to specify the mean and standard deviation when using NORMSDIST (as
opposed to NORMDIST).

NORMSDIST calculates the (cumulative) probability of the random variable being in the
range from - ∞ up to z.
Page 23 of 37

Visually, we have:

NORMSDIST calculates the probability


of being less than a particular value for a
standardized normal distribution (i.e. as
shown by the shaded region).

Example: (Same example as in the previous section) The amount of money a casino profits
in any given day is assumed to be a normally distributed random variable have a mean of
$8,000 and a standard deviation of $3,000. Use the NORMSDIST function to determine
the probability that, in a given day, the casino (i) profits less than $6,000, and (ii) profits at
least $11,500.

Solution: (i) The standardized value of $6,000 is (6000 – 8000) / 3000 = - 2/3. So,
the sought-after probability is NORMSDIST(- 2/3) = .2525.

(ii) The standardized value of $11,500 is (11500 – 8000) / 3000 = 7/6. So,
the sought-after probability is 1 - NORMSDIST(7/6) = .1217.

• NORMINV(p, mean, standard deviation)

The NORMINV function requires specification of a probability (p) as well as the mean and
standard deviation of a presumed normally distributed random variable. As output,
NORMINV delivers the random variable value x such that the probability of the random
variable being in the range from - ∞ up to x equals p.

Visually, we have:

NORMINV calculates this value


(which depends on the specified value
of p).

x
Page 24 of 37

Example: The daily demand of a certain product at Store A is assumed to be normally


distributed with a mean of 120 units and a standard deviation of 15 units. The management
of Store A feels that, on any given day, the store should have enough units in inventory to
have at least a 97% chance of meeting that day’s demand. Determine the inventory level
the store needs to maintain each day.

Solution: We want to find the number of units (x) such that there is a 97% chance that
daily demand is less than or equal to x (where x is assumed to be a normally distributed
random variable). This is given by NORMINV(0.97, 120, 15) = 148.21. So, the store
should have 149 units on hand at the beginning of each day.

• NORMSINV(p)

The NORMSINV function operates similarly to the NORMINV function. The difference
being that NORMSINV assumes the underlying normal distribution has been standardized.
Since a standardized normal distribution always has a mean of zero and a standard
deviation of one there is no need to specify the mean and standard deviation when using
NORMSINV (as opposed to NORMINV).

Visually, we have:

NORMSINV calculates this value


(which depends on the specified value
of p).
p
Notice that the diagram displays a
standardized normal distribution.

Example: (Same example as in the previous section) The daily demand of a certain
product at Store A is assumed to be normally distributed with a mean of 120 units and a
standard deviation of 15 units. The management of Store A feels that, on any given day,
the store should have enough units in inventory to have at least a 97% chance of meeting
that day’s demand. Using the NORMSINV function, determine the inventory level the
store needs to maintain each day.

Solution: We directly have NORMSINV(0.97) = 1.8808. As will be discussed in class,


this represents the number of standard deviations above the mean that need to be
maintained. In actual units of product, this translates to 1.8808*15 = 28.21 units above the
mean. Therefore, the store needs to have 120 + 28.21 = 148.21 units on hand each day
(which exactly agrees with the solution found above).
Page 25 of 37

• NORMINV(RAND( ), mean, standard deviation)

This is a special case of the NORMINV function described above and one which is
commonly used in simulations involving normal distributions as evidenced by the
following example.

Example: An air conditioning repairman is considering his work week. He is currently


scheduled to install eight air conditioning units at various homes throughout a
neighborhood as well as make twelve servicing visits to other homes. The amount of time
it takes for an installation visit and a servicing visit are both normally distributed random
variables with the following means and standard deviations:

Type of Visit Mean Standard Deviation


Installation 2 hours 12 minutes 33 minutes
Servicing 1 hour 18 minutes 21 minutes

Further, the repairman needs to consider the travel time it takes for him to drive from venue
to venue. Specifically, in any given day, the total time the repairman spends on the road is
normally distributed with a mean of 1 hour 45 minutes and a standard deviation of 15
minutes. The repairman expects to accomplish all twenty scheduled jobs (8 installation
visits and 12 service visits) in a 5-day work week (Monday through Friday). Simulate the
total amount of hours the repairman will need to work this week.

A B C D E F G H
1 Installation Visits Hours Service Visits Hours Travel Times Hours
2 Home 1 2.74 Home 1 0.89 Monday 2.06
3 Home 2 2.35 Home 2 1.27 Tuesday 1.75
4 Home 3 2.73 Home 3 1.12 Wednesday 1.82
5 Home 4 2.06 Home 4 1.46 Thursday 2.00
6 Home 5 2.05 Home 5 0.71 Friday 1.93
7 Home 6 1.52 Home 6 1.71
8 Home 7 1.86 Home 7 1.06
9 Home 8 3.31 Home 8 1.87
10 Home 9 1.52
11 Total Install Time 18.61 Home 10 1.11
12 Total Service Time 15.09 Home 11 1.14
13 Total Travel Time 9.56 Home 12 1.25
14
15 Total Work Week 43.25

The formulas underlying cells B2 through B9 are: = NORMINV(RAND( ), 2.2, 0.55)

The formulas underlying cells E2 through E13 are: = NORMINV(RAND( ), 1.3, 0.35)

The formulas underlying cells H2 through H6 are: = NORMINV(RAND( ), 1.75, 0.25)


Page 26 of 37

• TDIST(x, degrees of freedom, tails)

In Econ 102A we compute confidence intervals by estimating the true population standard
deviation with the sample standard deviation. In such cases, we employ a t-distribution.

The TDIST function requires the specification of a value (x) which can be interpreted as
the number of standard deviations the confidence interval is being extended from the mean.
We also specify the number of degrees of freedom and the number of tails in the
distribution. In general, the degrees of freedom will be n – 1 (where n is the sample size)
and, since Econ 102A only uses t-distributions in the realm of confidence intervals, we
always take tails = 2 (although when using t-distributions in Econ 102B you may well use
tails = 1 in the realm of hypothesis testing).

Ultimately, TDIST calculates the collective probability within the tails of the distribution.
Said another way, the confidence level being used for the interval is given by (1 – the
TDIST output).

Visually, we have:
TDIST(x, degrees of freedom, 2)
calculates the collective probability
within these two tails.

-x x

Example: Consider a random variable having a t-distribution with 23 degrees of freedom.


Determine (i) the probability that the random variable has magnitude greater than 2.18 (i.e.
it is either less than - 2.18 or greater than 2.18) as well as (ii) the probability the variable is
either less than - 1.62 or greater than 1.87.

Solution: (i) We directly have TDIST(2.18, 23, 2) = .0397.

(ii) The probability that the variable is either less than - 1.62 or greater than
1.62 is TDIST(1.62, 23, 2) = .1189. But, to this value we need to subtract
the probability that the variable is between 1.62 and 1.87. This can be
computed as .50*[TDIST(1.62, 23, 2) - TDIST(1.87, 23, 2)] = .0223. So,
the sought-after probability is .1189 - .0223 = .0966.
Page 27 of 37

• TINV(p, degrees of freedom)

The TINV function requires specification of a probability (p) as well as the number of
degrees of freedom. As output, TINV delivers the random variable value x such that the
probability of the random variable being in the range from - x up to x equals 1 - p.

Visually, we have:

TINV calculates this value (which


depends on both p and the degrees
of freedom).

1- p

-x x

Example: Consider a random variable having a t-distribution with 17 degrees of freedom.


Then, determine (i) the value x such that there is a 10% chance that the variable has
magnitude greater than x as well as (ii) the value x such that there is a 78% chance that the
variable has magnitude less than or equal to x.

Solution: (i) We directly have TINV(0.10, 17) = 1.74.

(ii) If there is a 78% chance the variable has magnitude less than or equal
to x, then there is a 22% chance the variable has magnitude greater
than x. So, the sought-after value of x is TINV(0.22, 17) = 1.273.
Page 28 of 37

Useful Excel Tools

• Solver

Solver is an optimization tool within Excel. It allows you to find the optimal value of a
particular cell by adjusting the value of several other cells subject to a set of constraints.

When using Solver, one needs to specify the components within the Solver Parameters box,
which looks as follows:

There are three inputs required by the user:

- The target cell is the cell in your spreadsheet which you want to maximize, minimize, or
set to a certain value. For example, in an economic spreadsheet model cell C10 might
contain a formula for overall profit and your “target” might be to maximize cell C10.
Or, in a finance spreadsheet model cell E7 might contain a formula for a portfolio’s
variance and your “target” might be to minimize cell E7.

- In the changing cells area one specifies the cells that affect the value of the target cell.
These are the cells that you want Excel to “solve for” in the solution. Solver adjusts the
values of the changing cells until an optimal solution is found.

- In the constraints area one specifies conditions on the variables that must be adhered to
by the final solution. In the case of a maximization setup for example, one might ask,
“Why can’t the target cell have an infinitely high value? What logical limitations or
restrictions apply to the variables?” These restrictions provide the fodder for the
“subject to the constraints” section.
Page 29 of 37

Example: A product costs $3 per unit to make. 1 Define the variables, P = the price of the
product and A = the amount spent on advertising (in thousands). Demand for the product
(in thousands) is based on these two variables. Specifically, the relationship is specified
by: Demand = 70 + .20*A1/3 – 7P + (A*P)1/2. Determine the optimal values of P and A so
as to maximize profit.

The initial spreadsheet setup is given below. The formulas underlying cells B4 and B7 are
shown in cells D4 and D7 respectively.

A B C D
1 Price $0.00
2 Advertising $0.00
3
4 = 70 + 0.2*Advertising^(1/3)
Demand 70 – 7*Price + (Advertising*Price)^(1/2)
5 Per Unit Cost $3.00
6
7 = Price*1000*Demand – Per Unit Cost*1000*Demand
Total Profit - $210,000.00 – 1000*Advertising

To specify the Solver Parameters box we ask ourselves the following questions:

(1) What is our objective?

(2) What are the variables that we want Excel to optimize?

(3) What restrictions or limitations exist to which the solution must adhere?

Our responses are as follows:

(1) We want to maximize total profit. So, in the Solver Parameters box, we specify
cell B7 as the target cell and click the “Max” button.

(2) We are trying to determine the optimal price and advertising level. So, in the
Solver Parameters box, we specify cells B1 and B2 as the changing cells.

(3) Logically, the price and advertising levels should be non-negative numbers. That
is, we might choose to force B1 ≥ 0 and B2 ≥ 0 in the optimal solution. So, in the
Solver Parameters box, we specify this information in the “subject to the constraints”
section.

1
Winston, Wayne, Financial Models Using Simulation and Optimization, 2nd Edition, Palisade Corporation, 2000.
Page 30 of 37

One can impose whatever restrictions one chooses. For instance, we may later find out
that our advertising budget for the product is only $100,000. In response, we could
specify an additional constraint in the Solver Parameters box, namely B2 ≤ 100.

For this exercise, then, the completed Solver Parameters box is:

Upon clicking “Solve” the initial spreadsheet changes to:

A B C D
1 Price $10.09
2 Advertising $131.35
3
4 = 70 + 0.2*Advertising^(1/3)
Demand 36.8141 – 7*Price + (Advertising*Price)^(1/2)
5 Per Unit Cost $3.00
6
7 = Price*1000*Demand – Per Unit Cost*1000*Demand
Total Profit $129,502.69 – 1000*Advertising

and we see that, in order to maximize profit, we should charge a price of $10.09 per unit
with an advertising expenditure of $131,350. The ultimate profit will be $129,502.69. It is
not possible to find an alternate price / advertising combination which leads to greater
profit.

Saving and Loading Solver Models

Once you specify a model within the Solver Parameters box, you may want to save the
settings so they can be recovered at a later time. The settings for a particular model can be
saved through the following steps:
Page 31 of 37

(1) After filling in the required fields of the Solver Parameters box, click on the Options
button.

(2) Within the Solver Options box, click on the Save Model button.

(3) A Save Model box now opens and, in the Select Model Area field, click on any blank
cell in your spreadsheet. The cell should be chosen so that a number of cells beneath it
are empty as well. Upon clicking OK, the output of your Solver model will be
displayed in this column of blank cells.

In order to resurrect the settings for this model at a later time (assuming the Solver
Parameters box has changed in the interim):

(1) Open the Solver Parameters box and click on the Options button.

(2) Within the Solver Options box, click on the Load Model button.

(3) A Load Model box now opens and, in the Select Model Area field, reference the range
of cells that contain the output for the Solver scenario you want to restore. That is,
reference the range of cells where the Solver output was copied in Step (3) above.
Upon clicking OK, you will see a message asking, “Reset previous Solver cell
selections?” Then, upon clicking OK to this question the settings for the model will
now be restored in the Solver Parameters box.
Page 32 of 37

• Data Tables

Formulas you type in a spreadsheet often have other cells as inputs. You might wonder
how the output of the formula changes as the value of the input cell changes. For example,
suppose cell A1 represents price and cell A2 represents quantity. Suppose you have set cell
A1 to $25.00 and cell A2 to 100 units. Suppose further that cell A3 represents revenue and
is represented by the formula A1*A2. In the present case, cell A3 would show a value of
($25)*(100) = $2,500. But you might want to know how revenue changes as price
changes. That is, you might want cell A1 to take on a variety of values and then see how
cell A3 changes accordingly. Data tables can be used for this purpose.

To construct a “one-input” data table:

(1) Determine a cell in your spreadsheet that you want to vary. Call this the input cell. For
the steps that follow, assume the input cell is cell A5.

(2) Consider some alternate values to what is currently in the input cell (i.e. cell A5). Go
to a blank area of your spreadsheet and type these values in a particular column. For
example, if we want to consider ten alternate values for the input cell, we might list
them from cell B10 down to cell B19.

(3) In the column to the right, and one row above the first entry (which in our case would
be cell C9) type a formula which uses the input cell in its calculation. When typing the
formula you should be referencing cell A5 in some way; you should not be referencing
any of cells B10 to B19.

(4) Select the rectangular range containing the alternate input cell values as well as the
formula (which in our case would be B9:C19). Select Data Table (found within the
What-If-Analysis under the Data tab) and specify cell A5 as the Column input cell. We
choose the field for “Column input cell” because the alternate values are listed in a
column. Upon clicking “OK” the highlighted table will show how the output value of
your formula changes as the input values change.

Example: (Same example as in the previous section) A product costs $3 per unit to make.
Define the variables, P = the price of the product and A = the amount spent on advertising
(in thousands). Demand for the product (in thousands) is based on these two variables.
Specifically, Demand = 70 + .20*A1/3 – 7P + (A*P)1/2.

Suppose the advertising expenditure is set at $120,000. Show how profit for the product
changes as price varies from $6.00 to $12.00 (in increments of $0.50).
Page 33 of 37

The initial spreadsheet setup is given below. The formulas underlying cells B4 and B7 are
shown in cells D4 and D7 respectively.

A B C D
1 Price $10.00
2 Advertising $120.00
3
4 = 70 + 0.2*Advertising^(1/3)
Demand 35.6275 – 7*Price + (Advertising*Price)^(1/2)
5 Per Unit Cost $3.00
6
7 = Price*1000*Demand – Per Unit Cost*1000*Demand
Total Profit $129,392.51 – 1000*Advertising
8
9
10 Data Table:
11 Price Profit The formula underlying cell B12 is:
12 $129,392.51
13 $6.00 = Price*1000*Demand – Per Unit Cost*1000*
14 $6.50 Demand – 1000*Advertising
15 $7.00
16 $7.50 Alternatively, one could simply type “= B7” since
17 $8.00 this formula appears elsewhere in the spreadsheet.
18 $8.50
19 $9.00 The input cell is cell B1. This cell will assume
20 $9.50 alternate values. The initial value you designate
21 $10.00 in cell B1 is arbitrary.
22 $10.50
23 $11.00
24 $11.50
25 $12.00

These are the various prices for


which we want to know the
corresponding profit. These
values are entered manually.

To complete the data table we select the rectangular region A12:B25. Upon selecting the
Data Table option (found within the What-If-Analysis under the Data tab), we specify cell
B1 as the Column input cell. We wish to examine how profit changes when varying the
contents of cell B1. Visually, we now have:
Page 34 of 37

A B C
9
10 Data Table:
11 Price Profit First, highlight the appropriate
12 $129,392.51 region in the spreadsheet.
13 $6.00
14 $6.50 Second, call up the Data Table box
15 $7.00 and specify the input cell.
16 $7.50
17 $8.00
18 $8.50
19 $9.00
20 $9.50
21 $10.00
22 $10.50
23 $11.00
24 $11.50
25 $12.00

Upon clicking “OK” the appropriate profits will be calculated in accordance with the
various prices:

A B C
9
10 Data Table:
11 Price Profit
12 $129,392.51
13 $6.00 $47,457.90
14 $6.50 $66,952.38
15 $7.00 $83,876.95
16 $7.50 $98,189.18
17 $8.00 $109,851.76
18 $8.50 $118,831.58
19 $9.00 $125,099.03
20 $9.50 $128,627.41
21 $10.00 $129,392.51
22 $10.50 $127,372.23
23 $11.00 $122,546.31
24 $11.50 $114,896.11
25 $12.00 $104,404.35
Page 35 of 37

It is also possible to construct a “two-input” data table. Here, we are varying two different
variables in a particular formula as opposed to just one (as in the preceding discussion). To
construct a “two-input” data table:

(1) Determine two cells in your spreadsheet that you want to vary. For the steps that
follow, assume these cells are cell A5 and cell A10.

(2) Consider some alternate values to the current contents of cells A5 and A10. Go to a
blank area of your spreadsheet and type the alternate values for cell A5 in a particular
column. Type the alternate values for cell A10 in a particular row. These row entries
should begin in the column to the right and the row above the column entries you input.
For example, suppose we want to consider ten alternate values for cell A5 and six
alternate values for cell A10. If the alternate values for cell A5 are listed from cell B10
down to cell B19, the alternate values for cell A10 would be listed from cell C9 to cell
H9.

(3) In the northwest cell of the table you have created (which in our case would be cell B9)
type a formula which uses the values of both cell A5 and cell A10 in its calculation.
When typing the formula you should be referencing cells A5 and A10 in some way;
you should not be referencing any of cells B10 to B19, or C9 to H9.

(4) Select the rectangular range containing both the formula and the alternate values of
both variables (which in our case would be B9:H19). Select Data Table (found within
the What-If-Analysis under the Data tab) and specify cell A5 as the Column input cell
and cell A10 as the Row input cell. Upon clicking “OK” the highlighted table will
show how the output value of your formula changes as the two input values change.

Example: (Same example as in the previous section) A product costs $3 per unit to make.
Define the variables, P = the price of the product and A = the amount spent on advertising
(in thousands). Demand for the product (in thousands) is based on these two variables.
Specifically, Demand = 70 + .20*A1/3 – 7P + (A*P)1/2.

Calculate the ensuing profit for all price / advertising combinations, where price varies from
$6.00 to $12.00 (in increments of $0.50) and the advertising expenditure varies from
$100,000 to $150,000 (in increments of $10,000).

The initial spreadsheet setup is given below. The formulas underlying cells B4 and B7 are
shown in cells C4 and C7 respectively.
Page 36 of 37

A B C D E F G
1 Price $10.00
2 Advertising $120.00
3
4 Demand 35.6275 = 70 + 0.2*Advertising^(1/3) – 7*Price + (Advertising*Price)^(1/2)
5 Per Unit Cost $3.00
6
7 = Price*1000*Demand – Per Unit Cost*1000*Demand
Total Profit $129,392.51 – 1000*Advertising
8
9
10 Data Table:
11
12 $129,392.51 $100 $110 $120 $130 $140 $150
13 $6.00
14 $6.50
15 $7.00
16 $7.50 The profit formula is typed in the
17 $8.00 northwest cell of the data table. The
18 $8.50 formula relies on both cell B1 and
19 $9.00 cell B2.
20 $9.50
21 $10.00 The initial values you designate in
22 $10.50 cell B1 and cell B2 are arbitrary.
23 $11.00
24 $11.50
25 $12.00

To complete the data table we select the rectangular region A12:G25:

A B C D E F G
10 Data Table:
11
12 $129,392.51 $100 $110 $120 $130 $140 $150
13 $6.00
14 $6.50
15 $7.00
16 $7.50
17 $8.00
18 $8.50
19 $9.00
20 $9.50
21 $10.00
22 $10.50
23 $11.00
24 $11.50
25 $12.00
Highlight the appropriate region of
the spreadsheet.
Page 37 of 37

Then, upon selecting the Data Table option (found within the What-If-Analysis under the
Data tab), we specify cell B1 as the Column input cell and cell B2 as the Row input cell:

Upon clicking “OK” the appropriate profit is calculated for each price / advertising
combination:

A B C D E F G
10 Data Table:
11
12 $129,392.51 $100 $110 $120 $130 $140 $150
13 $6.00 $60,270 $53,946 $47,458 $40,825 $34,064 $27,188
14 $6.50 $78,232 $72,692 $66,952 $61,037 $54,966 $48,757
15 $7.00 $93,543 $88,829 $83,877 $78,717 $73,374 $67,865
16 $7.50 $106,165 $102,315 $98,189 $93,822 $89,240 $84,467
17 $8.00 $116,063 $113,115 $109,852 $106,311 $102,524 $98,518
18 $8.50 $123,207 $121,198 $118,832 $116,151 $113,192 $109,984
19 $9.00 $127,570 $126,535 $125,099 $123,311 $121,210 $118,830
20 $9.50 $129,128 $129,101 $128,627 $127,762 $126,550 $125,027
21 $10.00 $127,858 $128,872 $129,393 $129,481 $129,186 $128,547
22 $10.50 $123,740 $125,827 $127,372 $128,443 $129,093 $129,367
23 $11.00 $116,757 $119,947 $122,546 $124,628 $126,251 $127,463
24 $11.50 $106,890 $111,214 $114,896 $118,016 $120,638 $122,814
25 $12.00 $94,124 $99,611 $104,404 $108,590 $112,237 $115,402

You might also like