Entire Solutions Manual
Entire Solutions Manual
Entire Solutions Manual
Review Exercises
2. 1 The four Excel objects are: the workbook; the worksheet; a range of cells and a
cell itself.
2.2 An object hierarchy is an ordered list of objects. An object model is the entire
system of objects. Understanding the hierarchy helps us quickly locate and
manipulate objects.
2.3 The hierarchy of objects in this example is the following: The excel file
“Inventory.xls” contains the sheet titled “Price List” which contains the column B
entitled “Purchase Price” that contains the purchase price of a pack of pens.
2.4 Excel menu includes an extra option that other Microsoft Applications do not
have. This is Data. Some of the choices available in the drop-down list of this
option are: Sort; Filter; Subtotals; PivotTable and PivotChart Report; etc.
2.6 Excel allows customizing your own toolbar. To customize a toolbar, access the
list of toolbars from View > Toolbars > Select Customize. A dialog box will appear
that allows you to edit toolbars by modifying their commands and display options.
In the Toolbars tab, select the toolbar you wish to modify. You can create a new
toolbar option by clicking on New and naming your toolbar. The Attach key
attaches specific toolbars to a particular workbook.
2.7 The six categories of the formatting options available in the Format Cells dialog
box are: Number; Alignment; Font; Border; Patterns and Protection.
2.8 The following is a custom format for the social security number: ###-##-####.
2.9 In order to lock particular cells in a worksheet you should first protect the
worksheet doing the following: Tools > Protection > Protect Sheet. This will
prevent anyone from entering or changing data in the locked cells. The cells are
locked, for example, when creating forms that present information that should not
be modified by the users.
2.10 In order to evenly distribute the widths of a set of columns do the following:
Format > Column > Standard Width.
2.11 The benefit of using AutoFormat option is that it offers a number of table designs
that can be applied in a spreadsheet.
2.12 The shortcut keys for cut, copy and paste are correspondingly: CTRL + X; CTRL
+ C; and CTRL + V.
2.14 The option to merge cells and wrap text appears under the Alignment tab of the
cell formatting menu.
2.15 The four options for the data type of a cell entry are: numbers; text; formulas, and
Boolean values.
Hands-On Exercises
a. Add the Drawing Toolbar in the on the menu bar: View > Toolbars > Check
Drawing.
b. On the Drawing toolbar select: AutoShapes > Basic Shapes > Regular
Pentagon. The cursor changes to a thin cross. Click and drag to change the
size of the figure.
c. Select the pentagon shape. Go to: Format > AutoShape > Select the tab
Colors and Lines. On the section Fill, choose the yellow color to fill the
shape. On the section Line, choose the blue color and the dashed line for
the border of the shape.
a. To customize the toolbar access the list of toolbars: View > Toolbars >
Customize.
b. Select Toolbars tab. Click on the command button New to create a new
toolbar. Name the new toolbar: Exercise 5.
c. Select the Commands tab.
• From the File Category, select the New command and use drag-and-
drop to add the command to your toolbar.
• From the File Category, select the Exchange Folder command and
use drag-and-drop to add the command to your toolbar.
• From the Edit Category, select the Office Clipboard command and
use drag-and-drop to add the command to your toolbar.
• From the File Category, select the Find command and use drag-and-
drop to add the command to your toolbar.
• From the Charting Category, select the Column Chart command and
use drag-and-drop to add the command to your toolbar.
• From the Drawing Category, select the Clip Art command and use
drag-and-drop to add the command to your toolbar.
• From the AutoShapes Category, select the WordArt command and
use drag-and-drop to add the command to your toolbar.
• From the Tools Category, select the Control Toolbox command and
use drag-and-drop to add the command to your toolbar.
• From the Web Category, select the Start Page command and use
drag-and-drop to add the command to your toolbar.
• From the AutoShapes Category, select the Smiley Face command
and use drag-and-drop to add the command to your toolbar.
2. 6 The following table presents the temperatures at which the substances A, B and
C dissolve. Scenario 1 corresponds to dissolving 5g of a particular substance in
100mL of water. Scenario 2 corresponds to dissolving 7g of a particular
substance in 50mL of water.
In order to format the table, follow these steps:
a. To create the first column, we type 1 in the first cell and 2 in the next cell. We
select these two cells and use the click-and-drag method to fill-in the rest of
the cells.
b. To create the first column, we type 10 in the first cell and 9 in the next cell.
We select these two cells and use the click-and-drag method to fill-in the rest
of the cells.
c. To create the first column, we type 1 in the first cell and 3 in the next cell. We
select these two cells and use the click-and-drag method to fill-in the rest of
the cells.
d. To create the first column, we type a in the first cell, b in the second cell and c
in the third cell. We select these three cells and use the click-and-drag
method to fill-in the rest of the cells.
e. To create the first column, we type hello in the first cell. We select this cell
and use the click-and-drag method to fill-in the rest of the cells.
2. 11
2. 14 In order to create the Table B, starting with the information presented in Table A
follow these steps:
a. Type the name of each column, the dates and the amounts.
b. Type in cell A3, 1 and in cell A4 2. Highlight cells A3 and A4. Use the click-and-
drag method to fill-in the cells A5:A22.
c. Highlight cells B3:B22. Chose Format > Cells from the menu. From the tab
Number select the Custom category. Set Type to General and type mm/dd.
d. Highlight cells C3:C22. Chose Format > Cells from the menu. From the tab
Number select the Currency category. Set Decimal Places to 2; set Symbol to $
and Negative numbers to -$1,234.10.
Review Exercises
3. 1 The four basic ways to refer top a cell are: relative referencing; absolute
referencing; row absolute and column absolute referencing.
3.2 A relative reference can be changed to an absolute reference by adding the “$”
mark in the address of the cell referenced. If the “$” mark is in front of the letter
that presents the column it means that the column value will not change. If the “$”
mark is in front of the row number it means that the row value will not change.
3.4 R1C1 notation refers to a cell based on the cell’s relative position to the cell in
which the formula is being typed.
3.5 To set R1C1 as the default notation in Excel one should do the following: Go to
Tools and choose Options from the menu, then and clicking on the General tab.
Check R1C1 reference style from the list of options on that tab.
3.6 =R[3]C[4]
3.7 In order to refer to a cell in a different worksheet from the one in which the
formula is being used do the following: type the name of the sheet followed by an
exclamation mark (!) before the cell or range name.
3.9 To refer to a cell that is in a workbook not currently opened in Excel do the
following: type the complete path of the workbook and worksheet surrounded by
single quotation marks.
3.10 In order to name a cell/range in Excel one could: use the name window; define
names; and create names.
3.11 In case that the name of a cell or range has been changed, the formula which
referenced newly named cells or ranges should be updated. To do the update,
choose Insert > Name > Apply from the Excel menu. The formula is automatically
updated to reflect the new names of the referenced cells.
3.12 In order to define a constant or name a cell we follow the same steps: choose
Insert > Name > Define from the main menu. However, in case that we define a
constant (different from naming a cell) we would type a number (instead of
selecting a cell or range of cells) in the Refers to area in the bottom of the Define
Name window.
3.13 When defining a name we choose Insert > Name > Define from the main menu.
In case that we create a name we choose Insert > Name > Create from the main
menu. One can create cell/ranges name (instead of defining them) in case that
the data labels are already typed in the table.
3.14 Circular referencing can occur when there is a loop of referencing between cells.
A simple example would be if cell A1 had the value “=B1” and cell B1 had the
value “=C1” and cell C1 had the value “=A1”.
3.15 Excel allows the users to convert column and row titles of data tables into
corresponding range names. To do that one can go to Tools > Options >
Calculations and select Accept Labels in Formulas. This will then allow the user
to refer to a row or column of data from the table by the corresponding row or
column title as if you had created a range name.
Hands-On Exercises
In order to give to the range of cells in each column the same name as the
column headings we choose Insert > Name > Crate from the Excel menu. From
the Create Names window we selected the Top Row option.
In order to define a name for the whole table we choose Insert > Name > Define
from the Excel menu. In the top of the Define Name window we typed
WorkstationDesign.
In order to define a name for the whole table we choose Insert > Name > Define
from the Excel menu. In the top of the Define Name window we typed Results.
3. 3
a. We typed the data presented in this exercise in an excel spreadsheet.
b. We typed the formula ‘=B2*B3’ in cell B5.
c. We selected the range A2:B3 and chose Insert > Name > Create from the
Excel menu. From the Create Names window we selected the Left column
option.
d. We chose Insert > Name > Apply from the Excel menu. The formula in cell B5
now shows: ‘=Length*Width’.
3. 4
a. To set the name of cell B2 to Radius follow these steps: choose Insert >
Name > Define from the Excel menu. In the top of the Define Name
window, in the Names in workbook area, type Radius.
b. Choose Insert > Name > Define from the Excel menu. In the top of the
Define Name window, in the Names in workbook area, type Pi and in the
bottom of the same window, in the Refers to area, type 3.14159.
c. To find the circumference of the circle type the following in cell B4:
‘=2*Pi*Radius’.
d. To find the area of the circle type the following in cell B5:
‘=Pi*Radius*Radius’.
e. Changing the value in cell B2 to 10 gives the following results:
3. 7 To create a name for each column and row of data, select the table (together
with the labels for the rows and columns) and then choose Insert > Name > Crate
from the Excel menu. From the Create Names window we selected the Top row
and Left column options.
To create a name for the formulas located in the ‘From Sum’ column, select the
corresponding column (together with its label) and then choose Insert > Name >
Crate from the Excel menu. From the Create Names window we selected the
Top row option.
To create a name for the formulas located in the ‘To Sum’ row, select the
corresponding row (together with its label) and then choose Insert > Name >
Crate from the Excel menu. From the Create Names window we selected the Left
column option.
3. 8 The following table presents the Interest Earned from the bank accounts.
The following table presents how cell A2 is referenced while calculating the
amount of interest earned.
3. 9 The following table presents the Interest Earned from the bank accounts for
different interest rate.
The following table presents how cells A2:A4 are referenced while calculating the
amount of interest earned.
3. 10
a. The name of the columns that present the Time, Distance and Velocity are
defined following these steps: select the data and the corresponding labels;
choose Insert > Name > Crate from the Excel menu. From the Create Names
window we selected the Top row option.
b. In the column that presents the velocity type ‘=Distance/Time’. The following
table presents the results.
3. 11 The following table presents the location of the cells containing the amount of
transaction using R1C1 notation in reference to cell A1.
3. 12
a. To define the constant ‘Gravity’, follow these steps: choose Insert > Name >
Define from the Excel menu. In the top of the Define Name window, in the
Names in workbook area, type Gravity and in the bottom of the same window, in
the Refers to area, type 9.81.
b. Select the column labeled “Surface Area”. Choose Insert > Name > Define from
the Excel menu. In the top of the Define Name window, in the Names in
workbook area, type Surface_Area.
Select the column labeled “Mass”. Choose Insert > Name > Define from the
Excel menu. In the top of the Define Name window, in the Names in workbook
area, type Mass.
Select the column labeled “Force”. Choose Insert > Name > Define from the
Excel menu. In the top of the Define Name window, in the Names in workbook
area, type Force.
Select the column labeled “Force Per Area”. Choose Insert > Name > Define
from the Excel menu. In the top of the Define Name window, in the Names in
workbook area, type Force_Per_Area.
c. d. The following table presents the results from calculating the Force and the Force
Per Area.
e. The following are the formulas used to compute the Force and Force Per Area
using R1C1 notation.
3. 13 The following table presents the results from calculating the corresponding
degrees in Celsius.
The following table shows how relative referencing is used to calculate the values
for the table of Degrees in Celsius.
The following table shows how to calculate the values for the table of Degrees in
Celsius using R1C1 notation.
3. 14 a. In order to name each cell in the range B2:B12 by its corresponding state
abbreviation follow these steps: select all the states and the corresponding
monthly sales, then choose Insert > Name > Crate from the Excel menu.
From the Create Names window select the Left column option.
b. In order to name the Monthly Sales column as ‘Monthly_Sales’ follow these
steps: select the monthly sales column together with its label, then choose
Insert > Name > Crate from the Excel menu. From the Create Names
window select the Top row option.
c. In cell A14 type ‘=sum(Monthly_Sales)’. The result is $8,299.02.
d. In order to name the results from the multiplication select range B1:B7.
choose Insert > Name > Define from the Excel menu. In the top of the
Define Name window, in the Names in workbook area, type New_Values.
3. 16 In order to convert column and row titles of data into corresponding range
names go to Tools > Options > Calculations and select Accept Labels in
Formulas. The table below presents the total number of shipments made by
each plant and the total number of shipments received by each city.
The following table presents the formulas used to calculate the sums.
3. 17 In order to convert column and row titles of data into corresponding range
names go to Tools > Options > Calculations and select Accept Labels in
Formulas. The table below presents the ending inventory.
The following table presents the formulas used to calculate the ending
inventory.
3. 18 In order to convert column and row titles of data into corresponding range
names go to Tools > Options > Calculations and select Accept Labels in
Formulas. The table below presents the beginning and ending inventory for
each month.
The following table presents the formulas used to calculate the beginning
and ending inventory.
In order to calculate the balance in the beginning and end of each month
we used the following formulas:
3. 21 In order to convert column and row titles of data into corresponding range
names go to Tools > Options > Calculations and select Accept Labels in
Formulas. The table below presents the beginning and end balance on
John’s loan.
The following table presents the formulas used to calculate the beginning and
end balance in John’s loan.
3. 22 The following table presents the Euclidean distances from each candidate DC
location to each customer. From the results we can see that location A is
the best as it minimizes the total distance traveled.
The following table presents the formulas used to calculate the distances.
3. 23 a. b. The following table presents the revenues for the months of January
through December, together with the monthly revenues, annual revenues
and the annual revenues per item.
c. In order to create names for the columns of the Revenues table follow
these steps: select the table with the corresponding labels, then choose
Insert > Name > Crate from the Excel menu. From the Create Names
window select the Top row option.
d. In order to create names for the rows of the Revenues table follow these
steps: select the table with the corresponding labels, then choose Insert >
Name > Crate from the Excel menu. From the Create Names window select
the Left column option.
e. In order to define a name for the table follow these steps: select the table,
then choose Insert > Name > Define from the Excel menu. In the top of the
Define Name window, in the Names in workbook area, type Revenues.
f. The following table presents the formulas used to calculate totals.
3. 24 The following table presents the monthly and annual revenues, expenses and
profits for the “Contemporary Furniture” store.
b. Select the cells that present the monthly revenues for the store. Set the
cursor on cell E2. Choose: Edit > Paste Special from the Excel menu. In the
Paste Special window select the Transpose option.
c. Note that the solution to Hands-on Exercise 3.23 is in the same Excel file as
the solution to this problem. The name of the spreadsheet with the solution to
exercise 3.23 is ‘3.23’.
d. In order to create names for the columns of this table follow these steps:
select the table with the corresponding labels, then choose Insert > Name >
Crate from the Excel menu. From the Create Names window select the Top
row option.
e. In order to define a name for the table follow these steps: select the table,
then choose Insert > Name > Define from the Excel menu. In the top of the
Define Name window, in the Names in workbook area, type Profits.
f. In order to calculate the monthly profits use the formula ‘=Revenues-
Expenses’ as shown in the table above.
g. In order to calculate the annual profits use the formula ‘=sum(Profits)’ as
shown in the table above.
3. 25 The following table presents the total weighted scores for each location.
a. In order to create names for the columns of the table that presents the scores
for each location follow these steps: select the table with the corresponding
labels, then choose Insert > Name > Crate from the Excel menu. From the
Create Names window select the Top row option.
b. In order to define a name for the table follow these steps: select the table,
then choose Insert > Name > Define from the Excel menu. In the top of the
Define Name window, in the Names in workbook area, type Preference
Matrix.
c. The following table presents the formulas used to calculate the weighted
score for each location.
d. In order to create a name for the columns of the table that presents the
weighted scores follow these steps: select a column at a time, then choose
Insert > Name > Define from the Excel menu. In the top of the Define Name
window, in the Names in workbook area, type JacksonvilleWS (or
OrlandoWS, or MiamiWS).
e. In order to define the best location, calculate the total weighted score for each
location. The tables above show how to calculate the total weighted scores
and provide the corresponding results. Jacksonville is the best location.
Chapter 4
Review Exercises
4. 1 There are ten categories of functions in Excel: Financial, Date and Time,
Mathematics and Trigonometry, Statistical, Lookup and Reference, Database,
Text, Logical, Information, and Engineering.
4.2 The six Logical functions in Excel are: TRUE, FALSE, IF, NOT, AND and OR.
4.3 The IF function takes three parameters: condition to be met, return value if true,
and return value if false.
4.4 The three data types that can be determine with the TYPE function are: number,
text, and logical values. The number 1 signifies a numerical data type; the number
2 signifies a text data type; and the number 4 signifies a logical value data type.
4.5 The match type codes used by the MATCH function return: the code 0 returns the
location of the first value it finds that is equal to the value for which we are
searching; the code 1 returns the location of the largest value that is less than or
equal to our specified value (given that the data is in ascending order); and the
code –1 returns the location of the smallest value that is greater than or equal to
our value (given that the data is in descending order).
4.6 Excel uses the serial number to enumerate all dates and times. For dates, this
number considers January 1, 1990 to be the initial starting point; for time, the
initial starting point is at zero hours, zero minutes, and zero seconds counting
toward the current time on a 24-hour scale.
4.7 The NETWORKDAYS function returns the total number of working days between
two dates. The DAYS360 function returns the total number of days between two
dates. The NETWORKDAYS counts 6 days between a Monday (say October 14,
2002) to the next Monday (October 21, 2002); and the DAYS360 function returns
7 days.
4.8 There are three different options for the second parameter of the WEEKDAY
function. The parameter takes the value 1 (this is also the default value if we leave
this parameter blank) if Sunday is enumerated as day 1 and Saturday as day 7 of
the week; the parameter takes the value 2 if Monday is enumerated as day 1 and
Sunday as day 7 of the week; the parameter takes the value 3 if Monday is
enumerated as day 0 and Sunday as day 6 of the week.
4.9 The first way to generate a random number between 1 and 20 is by using the
RANDBETWEEN() function in Excel (‘=RANDBETWEEN(1,20)’). The other
alternative is to use the function RAND(). This function generates a number
between 0 and 1. However, we could use the following formula to get a random
number between 1 and 20: ‘=RAND()*20’.
4.10 The NPER function in Excel is a financial function. It is used to calculate the
number of payments (or periods) left. This function takes the rate, payment per
period, and unpaid amount as parameters to calculate the number of payments that
remain to pay off the unpaid amount.
4.11 To calculate the sum of year’s digits, one can use the SYD function in Excel. This
function calculates the sum of the year’s digits for a given period in the
depreciation calculation. The parameters needed in the SYD function are the initial
cost, salvage at the last period, useful life of the asset, and the period in which we
are interested.
4.12 The following are the four categories of formulas: simple values, basic operators,
naming and referencing, and functions.
4.15 When the CONCATENATE function in Excel is used, the cells to be concatenated
do not need to be neighboring.
4.16 The COUNTBLANK function in Excel returns the number of empty cells in a
range.
4.18 HLOOKUP function searches for data in a spreadsheet. HLOOKUP searches for a
value in the top row of a table, marks the column that contains that value, and
then returns a value from that column for a specified row.
4.19 The INDEX function searches for an entry in a given range (the name of the range
where the function will be looking for the particular entry is given as a parameter)
and the first column and row of a range is numbered 1. In the OFFSET function,
we are given a reference cell instead, and the search is performed with respect to
this cell. The reference cell in the OFFSET function is similar to the cell number 1
that corresponds to the first column and first row in the INDEX function.
4.20 The MMULT function in Excel is used to multiply matrixes. As a result, the
number of columns of one matrix must equal the number of rows of the other
matrix.
Hands-On Exercises
4. 1 The MATCH function searches the data and returns the location of a desired
value. The match type code 0 returns the location of the first value it finds that is
equal to the value for which we are searching. Therefore, since number 5 is not on
our array, we get an error (#N/A).
When the match type code is 1, the function returns 2. That means the largest
value that is less than or equal to 5 (given that the data is in ascending order -- as
it is in our case) is in the second row of our array.
When the match type code is –1, we get an error (#N/A). The reason is that in
order to use the code -1, our data should be sorted in a descending order.
4. 2 In order to find the sum, average, minimum and maximum of the numbers given,
do the following:
a. Typed the numbers in cells B2:B10.
b. In cell B11 type: ‘= sum(B2:B10)’ in order to calculate the sum. The
result is 70.2.
c. In cell B12 type: ‘= average(B2:B10)’ in order to calculate the average.
The result is 7.8.
d. In cell B13 type: ‘= min(B2:B10)’ in order to find the minimum. The
result is 1.9
e. In cell B14 type: ‘= max(B2:B10)’ in order to find the maximum. The
result is 14.
4. 3 The following table demonstrates how to use the formula to calculate the height
of the cylinder given the volume and the radius.
4. 4 In order to find the net present value of the given series of cash flow, do the
following:
a. Type the numbers in cells A2:A8.
b. In cell A9 type the formula: ‘= NPV(0.08,A2:A8)’. The result is
$2,841.62.
4. 5 The following table presents how the logical functions in Excel can be used to
find the acceptable buildings.
The results show that buildings C and H are the only ones to be accepted.
4. 6 a. In order to generate the random numbers less than 10 based on the algorithm
described on this problem, do the following:
• In cell A2 type: ‘=RANDBETWEEN(0,10000)’.
• In cell B2 type: ‘=IF(A2>11, SQRT(A2),A2)’. This function checks
whether the value in cell A2 is less than or equal to 10. If this is not the
case, return the square root of A2, otherwise return A2.
• In cell C2 type: ‘=IF(B2>11, SQRT(B2),B2)’. This function checks
whether the value in cell B2 is less than or equal to 10. If this is not the
case, return the square root of B2, otherwise return B2.
• Copy the formula in cell B2 to B3:B21, and the formula in cell C2 to
C3:C21.
Note that in 2 iterations we will be getting numbers less than 10. The figure above
presents the formulas used in this exercise.
b. This method does not appear to be very good method to use to calculate random
numbers between less than 10. The reason is because we are using a number of
Excel functions, such as the RANDBETWEEN(), IF() and SQRT(), while we
could find the randomly generated numbers simply using the formula:
‘=RANDBETWEEN(0,10)’.
The logical function we used to identify the type of meal the patient should receive, is
given below:
4. 11 The future value is $579.49. Use the FV() function to calculate the future value of
the cash flow.
The following formula is used to calculate the “Days Until Next Week” in cell
C4: ‘=DAYS360($B$1,B4)’. This formula is copied to the range C5:C11.
a. =COUNTIF(B3:B11,">400")
b. =OFFSET(A2,MATCH(MAX(C3:C11),C3:C11,0),0)
c. =CONCATENATE(IF(AND(D3<601,D3>499),A3,""), IF(AND (D4<601, D4 >
499), A4,""), IF(AND(D5<601,D5>499),A5,""), IF(AND(D6<601,D6>499),A6,
""), IF(AND(D7<601,D7>499),A7,""), IF(AND(D8<601,D8>499),A8,""), IF(
AND(D9<601,D9>499),A9,""), IF(AND(D10<601,D3>499),A10,""), IF(AND
(D11<601, D11>499), A11,""))
4. 29 a. The mean of the sample is 29.2, the standard deviation is 8.11. To calculate the
mean use the function ‘=AVERAGE(A1:D9)’. To calculate the standard
deviation use the function ‘=STDEV(A1:D9)’.
b. The results are:
d. The result from the Chi-square test is 0.99990.9. The Excel function used is
‘=CHITEST(C15:C20,E15:E20)’. The critical value is equal to 11.07. We find the
critical value using the following function ‘=CHIINV(0.05,5)’. Since the critical
value is greater than the test statistics, we accept the hypothesis that the data is
normally distributed with mean 29.2 and standard deviation 8.11.
4. 30 a. The upper control limit is 0.266. The lower control limit is 0. To find the upper
control limit use the formula: =AVERAGE(B2:B7,D2:D7)+3*STDEV (B2:B7,
D2:D7). To find the lower control limits use the formula: =MAX(AVERAGE
(B2:B7, D2:D7) - 3*STDEV(B2:B7,D2:D7), 0).
b. None of the observations is above or below the control limit. To count the
number of observations above the upper control limit use the formula:
=COUNTIF(B2:B7,">0.226") + COUNTIF(D2:D7,">0.266"). To count the
number of observations below the lower control limit use the formula:
=COUNTIF (B3:B8,"<0") + COUNTIF(D3:D8,"<0").
Chapter 5
Review Exercises
5. 1 There are ten different chart types in Excel: Column; Bar; Line; Pie; XY (Scatter);
Area; Doughnut; Radar; Surface; Bubble; and Stock.
5.2 Using Excel Charts is useful as it allow the user to illustrate the data graphically
or display data patterns. This helps to perform better analyses.
5.3 A Data Range is the group of cells that selected to create a chart. A range is any
group of cells that form a row, column, or area.
5.4 To begin using the Chart Wizard, one can either choose Insert > Chart from the
menu or click the icon at the top of the window.
5.5 The steps followed to create a chart using the Chart Wizard are: Step 1 is to
select the Chart types to be used. Step 2 is to verify or change the Data Range
and determine how to define the Series. (a) Data Range selection and row
versus column option for Series, (b) Range selections and names for each
Series. Step 3 defines the Chart Options. Step 4 is to select the location of our
chart.
5.6 In order to create a stock chart one should have three series of data. These
charts are used when plotting the price of a stock, bond, etc. The series of data
should be ordered as follows: High-Low-Close. For example, when one plots the
daily price of a stock, data about the highest, lowest and closing price are
needed.
5.7 The six tabs found on the Chart Options form are: Titles; Axes; Gridlines;
Legend; Data Labels and Data Table.
5.8 When creating a chart, in the Chart Source Data form, select the Series tab. In
this window, one can give names to different series used in the chart.
5.9 The two main options to locate a chart are: As new sheet and As new object. If
the first option is chosen, Excel will maximize the chart to fill an entire new
worksheet. Choosing to have the chart as an object in a sheet will leave it as a
separate smaller window in the current worksheet or another sheet of your
selection.
5.10 After creating a chart using the Chart Wizard, you can return to any of the Wizard
steps by simply right-clicking on the chart. You will see a long list of options
including Source Data. Selecting this option will bring you back to the
corresponding Wizard dialog box where you can modify any of the initial settings
made while creating the chart.
5.11 The general patterns, font and properties of a chart can be modified using the
Format Chart Area form.
The Format Plot Area option enables formatting of the plot area.
The Format Data Series option enables formatting of point shapes, line styles,
colors and views of data series.
The Format Data Point option enables formatting specific data points.
The Format Axis option enables formatting pattern, font, scale, number type, and
alignment of the x and y-axis.
The Format Gridlines option enables formatting the gridlines in a chart.
The Format Legend option enables formatting the legend of a chart.
5.12 Yes the scale of gridlines can be changed. To change the scale of gridlines
double click on the gridlines of the chart. The Format Gridlines form appears.
Select the Scale tab to change the scale of the gridlines.
5.13 A dynamic chart is a chart that is linked directly to the Data Range specified in
the Source Data step of the Chart Wizard. If any points in this range of data are
modified, the chart is automatically updated to reflect a new corresponding data
point.
5.14 A dynamic range is such that every time a new data point is entered the range
(the range could be either a column or row in the table) the definition of the range
names is updated to include this new data.
5.15 In order to change the color of a data series one double clicks on the series of
data on the chart. The Format Data Point form opens. Select the Pattern tab.
One can then choose a color for the data series.
Hands-On Exercises
5. 2 The following presents the Scatter Plot, Line Plot with Nodes and Line Plot with
no Nodes charts.
To create the Line Plot with Nodes chart follow steps a through e as shown
above. Update step c as follows:
c. From the Chart Type form select Line. Select a Chart Sub-type that presents
a line with nodes on it.
To create the Line Plot with no Nodes chart follow steps a through e as shown
above. Update step c as follows:
c. From the Chart Type form select Line. Select a Chart Sub-type that presents
a line with no nodes on it.
5. 3 The following tables present the values for the functions Y = ex and Y = log(ex).
5. 4 The following presents the bar graph, scatter chart and pie chart for the data
given in this problem.
5. 5 The following are the scatter charts created based on the data given in exercise
5.4. The chart on the right includes some formatting changes, such as: the color
of the data series is different, the scale of Y axis has changed and the data
values for each series are displayed.
In order to change the color of the data series, one double clicks on the graph
(on the line that presents the data series). Format Data Series window appears.
In the window one can change the color of the data series.
In order to change the scale of the Y-axis one can double click on the Y axis. The
Format Axis window appears. Choose the Scale tab to make changes on the
scale of the Y axis.
Double click on the data series. Format Data Series window appears. Select the
Data Labels tab. Check the Label Contains Y Values option.
5. 6 The following graph presents the relationship between the height and radius of a
cylinder.
In order to compare the different materials, it is better to use the doughnut chart.
This chart helps understand the relative importance of each factor on each
material. As the tensile strength is the most important factor, the engineer should
look at the second ring of the doughnut. From the chart one can see that
materials C and F have the highest tensile strength.
5. 8 The following stock chart presents the highest, lowest and closing prices of the
stock of company XYZ during 2002.
5. 9 The following presents the 3-D surface chart, line chart and stacked area chart.
5. 10 Looking at the charts created in 5.9, the best suited for our data is the stacked 3-
D area chart. In formatting the X axis there are scale limitations in the three
charts. For example, the options for the minimum, maximum, major unit, minor
unit do not exist for the Y axis of the charts we created.
The following picture presents the charts when we plot by rows instead of plotting
by column. The charts have plotted 7 different series.
5. 11 The following chart presents the temperatures for 1 week in February.
5. 12 The following charts present the time spend in each activity during different days
of the week as well as the total time spent in one week performing each activity.
5. 17
5. 21 a. In order to build the y = ln(x) graph for 1 ≤ x ≤ 100, create a table with 2 rows.
In one row enter the values of x and on the other calculate the y values using the
Excel function LN(). Use XY scatter chart to build the corresponding graph.
b. In order to calculate the values of y = e^x use the Excel function EXP(). Use XY
scatter chart to graph the relationship between x and y.
c. In order to calculate the values of y = sin(x) use the Excel function SIN(). Use XY
scatter chart to graph the relationship between x and y.
d. In order to calculate the values of y = cos(x) use the Excel function COS(). Use
XY scatter chart to graph the relationship between x and y.
5. 22 The following is the bubble chart for this problem.
a. The amount of interest paid for each payment decreases as the payment
number increases.
b. The principal amount paid increases as the payment number increases. This
means in the beginning we pay more toward the interest and by the end we
pay more toward the principal.
a. Select the rows with the data on interest and principal payment.
b. Select Insert > Chart from the main menu.
c. From the Chart Type form select Line.
d. In the Chart Source Data form select the Series tab. Type in name for the
series as Int. Paid and Principal Amt.
e. In the Chart Option form select the Title tab. Type in the title for the chart and
label the X axis as Payment Nr.
f. In the Chart Option form select the Legend tab. Select the Top placement for
the legend.
a. Select the rows with the data on interest and principal payment.
b. Select Insert > Chart from the main menu.
c. From the Chart Type form select Doughnut.
d. In the Chart Source Data form select the Data Range tab. Select the Series in
Rows option.
e. In the Chart Source Data form select the Series tab. Type in a name for each
series.
f. In the Chart Option form select the Title tab. Type in the title of the chart.
g. In the Chart Option form select the Data Labels tab. Check the option Series
Names.
Creating a doughnut chart is useful as it help understand that the part of the
payment amount that goes to pay off interest decreases as we make more
payments and the amount that goes to pay off the loan (the principal amount)
increases.
Based on this graph we can see that the brand X covers most of the area of the
graph, therefore we can say that this is the brand with the best content of
vitamins C, A, E and B1.
Chapter 6
Review Exercises
6. 1 A pivot table is a table where the data, taken from a database, is re-organized to
give meaningful representation.
Pivot tables are used to transform large amounts of data from a table or database
into an organized summary report.
6. 2 The parts of a pivot table into which the items from the original database can be
placed are: row fields, column fields, data field and page field. The row field and
column fields carry the headings of rows and columns of the original table. The
data and page fields carry the data from the original table.
6. 3 The Grand Totals feature of a pivot table enables calculations applied to rows or
columns of data in the Data Field. The Subtotals feature of a pivot table enables
calculations applied to Row or Column Fields.
6. 4 In order to start creating a pivot table one should first select Data > Pivot Table
from the main menu.
6.5 The process of creating a pivot table consists of the following three main steps:
specify location, select data and create table layout.
6.6 In the pivot table toolbar one can choose the Refresh option to update the data
shown in our pivot table if our source data is changed.
6.7 To add a calculated field or item to a pivot table, click on Pivot Table > Formulas
> Calculated Field (or Calculated Item) from the toolbar drop-down options.
6.8 Four common pivot table fields available in Excel are: Row, Column, Data and
Page field.
6.9 The drop-down arrow is a tool for filtering or searching for particular data. The
drop-down arrow gives a list of all values in the corresponding field. Using the
drop-down list one can select or deselect values to display in the pivot table.
6.10 One of the icons in the pivot table toolbar is (Format Report), which enables
the user to change the format of the pivot table. If one clicks on the icon ,a
list with different report styles appears. After the user chooses a particular style
the pivot table automatically accommodates the new style.
6.11 Pivot Charts use pivot tables as their Source Data so that filtering options are
transferred to the chart as well. However, one can create a chart that shows only
the data you have selected in your pivot table.
6.12 One can create a Pivot Chart using the source data by highlighting the source
data, choosing Data > Pivot Table and Pivot Chart Report from the menu and
selecting Pivot Chart from the options in Step 1.
6.13 To group field values, select the field and choose Group and Show Detail from
the Pivot Table drop-down options, or right-click on the table.
6.14 Subtotals are Field Settings applied to Row or Column Fields, not to Data Fields.
However, totals for Column Fields can be calculated using Column Grand Totals,
so we really need to use Subtotals for Row Fields only. To cerate Subtotals for
Column Fields, in the pivot table option window we check Grand Totals for
Columns.
Hands-On Exercises
6.1 The figure below presents the pivot tables created for this exercise:
a. Select the table together with the row and column titles.
b. Choose Data > Pivot Table and Pivot Chart from the main menu.
c. From the Pivot Table and Pivot Chart wizard window, Step 1 select the option
Microsoft Excel list or database from the Where is the data you want to
analyze? option list. Choose Pivot Table from the What kind of report you
should create? option list.
d. In the 3rd step of the Pivot Table and Pivot Chart wizard window select the
existing worksheet to put the Pivot Table Report. Specify the cell where you
want to put the pivot table. Click-on the Layout command button.
e. Identify ‘Dist Center Location’ and ‘Retailer Location’ as the Row Field.
Identify ‘Sum of Quantity’ as the Data Field.
f. Click on the Finish button of the Pivot Table and Pivot Chart wizard, Step 3
of 3 window.
g. Right click on the ‘DC’ field of the pivot table created. From the option list
that appears, select ‘Field Settings’. In the ‘PivotTable Field’ window that
appears select ‘Max’ from the SubTotals window.
In order to create the 2nd pivot table, follow steps a to f described above. Then, from
PivotTable toolbar drop-down list select: PivotTable > Formulas > Calculated Fields.
In the ‘Insert Calculated Field’ window type the name of the new field on the ‘Name’
window, and type ‘=Price*Quantity’ in the ‘Formula’ window. Update the pivot table
so that the Row Field would still be ‘Dist Center Location’ and ‘Retailer Location’,
but the Data Field would now be the new calculated field.
In order to create the 3rd pivot table, follow steps a to f described above. Note that for
this table however, the row fields are ‘Dist Center Location’ and ‘Product Name’, and
the Data Field is ‘Price’.
6.2 The following figure presents the pivot tables created for this exercise:
6.3 In order to create the pivot tables for this exercise follow these steps:
a. Select the table together with the row and column titles.
b. Choose Data > Pivot Table and Pivot Chart from the main menu.
c. From the Pivot Table and Pivot Chart wizard window, Step 1 select the option
Microsoft Excel list or database from the Where is the data you want to
analyze? option list. Choose Pivot Table from the What kind of report you
should create? option list.
d. In the 3rd step of the Pivot Table and Pivot Chart wizard window select the
existing worksheet to put the Pivot Table Report. Specify the cell where you
want to put the pivot table. Click-on the Layout command button.
e. Identify ‘Start City’ as the Row Field. Identify ‘Destination City’ as the
Column Field. Identify ‘Min of Travel Time’ as the Data Field for the first
table and ‘Min of Cost’ as the Data Field for the second pivot table.
f. Click on the Finish button of the Pivot Table and Pivot Chart wizard, Step 3
of 3 window.
6.4 In order to create the following pivot table follow these steps:
a. Select the table together with the row and column titles.
b. Choose Data > Pivot Table and Pivot Chart from the main menu.
c. From the Pivot Table and Pivot Chart wizard window, Step 1 select the option
Microsoft Excel list or database from the Where is the data you want to
analyze? option list. Choose Pivot Table from the What kind of report you
should create? option list.
d. In the 3rd step of the Pivot Table and Pivot Chart wizard window select the
existing worksheet to put the Pivot Table Report. Specify the cell where you
want to put the pivot table. Click-on the Layout command button.
e. Identify ‘Drink Type’ and ‘Fluid Ounces’ as the Row Field. Identify
‘Material’ as the Column Field. Identify ‘Average of Cost’ as the Data Field.
f. Click on the Finish button of the Pivot Table and Pivot Chart wizard, Step 3
of 3 window.
6.5 The following is the pivot chart created for this exercise:
The most expensive products to bottle are the 22 ounce bottles. Glass bottles are
more expensive.
6.6 The following is the pivot table for this problem. In order to create the pivot table
follow these steps:
a. Calculate the cost of shipping 10 ounce packages (=‘First Ounce Rate’ +
‘9*Rate After First’). Create a new column in the existing table titled ’10
Ounce Package’.
b. Select the table together with the row and column titles.
c. Choose Data > Pivot Table and Pivot Chart from the main menu.
d. From the Pivot Table and Pivot Chart wizard window, Step 1 select the option
Microsoft Excel list or database from the Where is the data you want to
analyze? option list and choose Pivot Table from the What kind of report you
should create? option list.
e. In the 3rd step of the Pivot Table and Pivot Chart wizard window select the
existing worksheet to put the Pivot Table Report. Click-on the Layout
command button.
f. Identify Shipment as the Row Field. Identify the column with the price of the
10 ounce packages as the Data Field. Click on the command button OK. Click
on the Finish button of the 3rd step.
g. Double-click on the ‘Sum 10 Ounce package’ title of the pivot table. The
PivotTable Field window appears. Select Min in the Summarize by list box.
h. In the Option window of the pivot table, make sure that the option button
‘Grand Totals for Column’ is checked.
i. From the Pivot Table toolbar choose Format Report option. Select one of the
report styles presented.
6.7 The following are the pivot tables created for this exercise:
6.8 Based on the information from the pivot tables of exercise 6.7, we see that the
busiest hour of the day is hour 3. The following chart presents the queue length
during this hour in a week.
6.9 In order to create the following pivot table follow these steps:
a. Select the table together with the row and column titles.
b. Choose Data > Pivot Table and Pivot Chart from the main menu.
c. From the Pivot Table and Pivot Chart wizard window, Step 1 select the option
Microsoft Excel list or database from the Where is the data you want to
analyze? option list. Choose Pivot Table from the What kind of report you
should create? option list.
d. In the 3rd step of the Pivot Table and Pivot Chart wizard window select the
existing worksheet to put the Pivot Table Report. Specify the cell where you
want to put the pivot table. Click-on the Layout command button.
e. Identify ‘Region’ as the Row Field. Identify ‘Category’ as the Column Field.
Identify ‘Sum of Demand’ as the Data Field.
f. Click on the Finish button of the Pivot Table and Pivot Chart wizard, Step 3
of 3 window
6.10 The following table presents the pivot tables build for this exercise:
6.11 In order to create the following pivot table follow these steps:
a. Select the table together with the row and column titles.
b. Choose Data > Pivot Table and Pivot Chart from the main menu.
c. From the Pivot Table and Pivot Chart wizard window, Step 1 select the option
Microsoft Excel list or database from the Where is the data you want to
analyze? option list and choose Pivot Table from the What kind of report you
should create? option list.
d. In the 3rd step of the Pivot Table and Pivot Chart wizard window select the
existing worksheet to put the Pivot Table Report. Specify the cell where you
want to put the pivot table. Click-on the Layout command button.
e. Identify ‘Income’ as the Row Field. Identify ‘Gender’ as the Column Field.
Identify ‘Days per Week’ as the Data Field. Click on the command button
OK.
f. Click-on the Options command button in the Pivot Table and Pivot Chart
wizard, Step 3 of 3 window.
g. In the PivotTable Options window, make sure that the option button ‘Grand
Totals for Columns’ and ‘Grand Totals for Rows’ are checked.
h. Click on the Finish button of the Pivot Table and Pivot Chart wizard, Step 3
of 3 window.
The pivot table shows that man buy Sally’s lemonades more than women do. We
do not see a clear relation between the income and frequency with which a
customer buys her lemonade.
6.12 In order to create the following pivot table follow these steps:
a. Select the table together with the row and column titles.
b. Choose Data > Pivot Table and Pivot Chart from the main menu.
c. From the Pivot Table and Pivot Chart wizard window, Step 1 select the option
Microsoft Excel list or database from the Where is the data you want to
analyze? option list. Choose Pivot Table from the What kind of report you
should create? option list.
d. In the 3rd step of the Pivot Table and Pivot Chart wizard window select the
existing worksheet to put the Pivot Table Report. Specify the cell where you
want to put the pivot table. Click-on the Layout command button.
e. Identify ‘Gender’ as the Row Field. Identify ‘Major Desired’ as the Column
Field. Identify ‘Count Major Desired’ as the Data Field.
f. Click on the Finish button of the Pivot Table and Pivot Chart wizard, Step 3
of 3 window.
6.13 In order to create the following pivot table follow these steps:
a. Fill the empty fields of the ‘Salesperson’ column. This will require typing the
name of the salesperson for each transaction.
b. Select the table of data together with the row and column titles.
c. Choose Data > Pivot Table and Pivot Chart from the main menu.
d. From the Pivot Table and Pivot Chart wizard window, Step 1 select the option
Microsoft Excel list or database from the Where is the data you want to
analyze? option list. Choose Pivot Table from the What kind of report you
should create? option list.
e. In the 3rd step of the Pivot Table and Pivot Chart wizard window select the
existing worksheet to put the Pivot Table Report. Specify the cell where you
want to put the pivot table. Click-on the Layout command button.
f. Identify ‘Salesperson’ as the Row Field. Identify ‘Count Date of Sale’ as the
Data Field. Do not specify the Column Field.
g. Click on the Finish button of the Pivot Table and Pivot Chart wizard, Step 3
of 3 window.
6.14 In order to create the following pivot table follow these steps:
a. Fill the empty fields of the ‘Salesperson’ column. This will require typing the
name of the salesperson for each transaction.
b. Select the table of data together with the row and column titles.
c. Choose Data > Pivot Table and Pivot Chart from the main menu.
d. From the Pivot Table and Pivot Chart wizard window, Step 1 select the option
Microsoft Excel list or database from the Where is the data you want to
analyze? option list. Choose Pivot Table from the What kind of report you
should create? option list.
e. In the 3rd step of the Pivot Table and Pivot Chart wizard window select the
existing worksheet to put the Pivot Table Report. Specify the cell where you
want to put the pivot table. Click-on the Layout command button.
f. Identify ‘Salesperson’ as the Row Field. Identify ‘Product Sold’ as the
Column Field. Identify ‘Sum Transaction Revenue’ as the Data Field.
g. Click on the Finish button of the Pivot Table and Pivot Chart wizard, Step 3
of 3 window.
6.15 In order to create the following pivot table follow these steps:
a. Fill the empty fields of the ‘Salesperson’ column. This will require typing the
name of the corresponding salesperson for each transaction.
b. Select the table of data together with the row and column titles.
c. Choose Data > Pivot Table and Pivot Chart from the main menu.
d. From the Pivot Table and Pivot Chart wizard window, Step 1 select the option
Microsoft Excel list or database from the Where is the data you want to
analyze? option list. Choose Pivot Table from the What kind of report you
should create? option list.
e. In the 3rd step of the Pivot Table and Pivot Chart wizard window select the
existing worksheet to put the Pivot Table Report. Specify the cell where you
want to put the pivot table. Click-on the Layout command button.
f. Identify ‘Salesperson’ as the Row Field. Identify ‘Date of Sale’ as the Column
Field. Identify ‘Sum Transaction Revenue’ as the Data Field.
g. Click on the Finish button of the Pivot Table and Pivot Chart wizard, Step 3
of 3 window.
h. Right click on cell H3. From the option list that appears, select: Group and
Show Details > Group. Grouping window appears. In this window set the:
Group By option to 7, Start at option to 1 and End at option to 31.
6.16 The following figure presents the pivot tables build for this exercise:
6.17 The following is the pivot table created for this exercise:
6.18 The following presents the pivot table build for this exercise:
6.19 The following is the pivot table build for this exercise:
6.20 The following is the pivot table created for this exercise:
Chapter 7
Review Exercises
7.1 The function used to calculate the mean of a data set in Excel is
AVERAGE(range or range_name).
7.2 The mean of a range of numbers is the average, the median is the middle
number in a list of sorted data and mode is the most frequently occurring value. If
the data values are fairly symmetric the mean and median of the data are the
same.
7.3 Some useful tools from Analysis Toolpack are: Histogram, Moving Average,
ANOVA, Random Number Generation, etc.
7.4 The Descriptive Statistics tools provide a list of statistical information about your
data set including the mean, median, standard deviation, and variance.
7.6 Any values in the data set that lie more than ±2standard deviations from the
mean are called outliers. We can identify outliers by looking at a chart of the
data, or we can actually find values in the data set which are greater than
+2standard deviations and smaller than -2standard deviations using the following
Excel function:
‘=IF(ABS(data_value – mean_value)>2*s, “outlier”,”” )’
7.8 Skewness is a measure of how symmetric or asymmetric the data set is. A
Skewness value between -1 and +1 implies symmetry. We would say that a good
value of Skewness for a symmetric data set is 0.
7.9 The PERCENTILE function returns a value for which a desired percentile k of the
specified data set falls below. The PERCENTRANK function performs the
complimentary task; it returns the percentile of the data set which falls below a
given value.
7.10 Bins are the intervals into which values can fall; they can be defined by the user
or can be evenly distributed among the data by Excel.
7.11 A Pareto organization of a chart sorts the columns from the largest to the
smallest.
7.12 The four basic shapes to a histogram are: symmetric, positively skewed,
negatively skewed, and multiple peaks.
7.13 A negatively skewed histogram has a peak on the right and many lower points
(stretching) on the left.
7.14 In the function y = a*x + b, x is the independent variable and y is the dependent
variable.
7.16 There are five basic trend lines that Excel can model: Linear, Exponential,
Power, Moving Average and Logarithmic.
7.17 The two values that measure the accuracy of a linear trendline are: R-square
value and the standard error.
7.18 The parameters of a Binomial distribution function are: the number of trials and
the probability of a success.
7.19 Weibull distribution has two parameters: alpha and beta. The Exponential
distribution has a single parameter, lambda. If alpha in Weibull distribution is
equal to 1, then the distribution becomes equivalent to the Exponential
distribution with lambda equal to 1/beta.
7.20 In order to convert a Normal x value to a Standard Normal x value, we use the
following Excel function: ‘=STANDARDIZE(x, mean, std_dev)’.
Hands-on Exercises
7.1 In order to find the typical salary we calculate the mean (using the function
‘=AVERAGE (data_set)’)) and median (using the function ‘=MEDIAN (data_set)’)
) of the data set. We find that mean = $ 25,279.45 and median = $26,152.50.
Since the values found for the mean and median are close to each-other, we can
say that the data set does not have outliers. We can finally say that a typical
salary for the geography graduates is $ 25,279.45.
Based on these results we can say that the average voltage held by the
units increased after shipment. The standard deviation also increased
slightly, what means that there is more variation of the voltage held by each
unit from the mean. Comparing the mean with the median we see that prior
shipment, less than 50% of the units held more voltage than the average,
and after the shipment more than 50% of the units held more voltage than
the average.
b. 80% of the units are acceptable before and after shipment. The following
are the formulas used.
c. One way to improve the quality of Electro’s regulators is to remove the
outliers (the items that hold voltage above 75 or below 25).
d. 10% of NY regulators have a voltage exceeding 24.6. To find that used the
following Excel function: ‘=PERCENTILE(B3:B12,0.1)’.
e. 5% of NY regulators have a voltage less than or equal to 22.8. To find that
use the following Excel function: ‘=PERCENTILE(B3:B12,0.05)’.
7.4 The following are the three histograms we created for this problem. The mean
return for stock is 5.58%, T-bills is 3.42% and T-bonds is 5.37%.
7.5 The histograms created in the hands-on exercise 7.5 are positively skewed.
7.6 a. The slope of the least squares line of Dell’s stock is -0.000206 and S & P’s
stock is -2.973E-05.
b. The R-Squared value of the Dell stock is 0.0557 and S and P stock is 0.0183.
c. Looking at the slopes of the two trend lines, seems that the return of Dell’s
stock and S & P’s stocks are decreasing; however the rate of decrease is higher
for Dell than S&P. Therefore, we would choose S & P as the better alternative.
7.7 The following graph plots the price versus the square footage of a house. We
fitted a linear trend line to the data. The R2 for this trend line is 0.95. That means,
the trend line found gives a good approximation of data.
a. Based on the equation given for the trendline, we can estimate the addition in
price if we plan to increase the square footage of the house by 400. The
addition in price is: = 104.39*400 = $41,756.
b. 95% of the variations in the home value are explained by variations in the
house size.
c. A typical price for a 2500 square foot house is $265,920.5 (calculated using
the trend line equation). Therefore, the price $470,000 is not typical.
7.8 The following two graphs plot home prices versus the number of bathrooms and
the number of bedrooms. For each relation we plot a trend line. The R-square for
the trend line that presents the relationship between price and square footage
(see hands-on exercise 7.8) is 0.95. The R-square for the trend line that presents
the relationship between price and number of bathrooms is 0.67. The R-square
for the trend line that presents the relationship between price and number of
bedrooms is 0.46. These results suggest that the square footage has the highest
impact on home prices.
7.9
a. The following chart presents the trendlines for the annual revenues of
Staples, Wal-Mart and INTEL. The highest R-square is 0.9927. This belongs
to Staples. Therefore, we can say that Staple’s revenues best fit an
Exponential trend curve.
b. The annual percentage growth rate varies by company. For Staples, it is
25.51%, for Wal-Mart it is 16.53% and for INTEL is 11.21%.
c. The revenues for 2003 are expected to be: for Staples = $16,235; for Wal-
Mart = $310,522; for INTEL = $32,725.
7.10
a. There is a negative relationship between price and demand. As price
increases, demand decreases and as price decreases demand increases.
This is the reason why the slope of the trend line is negative.
b. The demand for a price of $69 can be calculated as follows: demand = -
5.2657*(69) + 598.1 = 234.77
c. 1% increase in price reduces demand by 5.2657%.
7.11 In order to answer the questions in this exercise, one should first identify a trend
line for the data. Below we present the results from fitting two different trend lines
to the data. The R-square is higher when the fitted line is logarithmic.
a. If 75,000 phone calls will be made next month, the expected number of
subscriptions is: = 26472*Ln(75,000) = 66,289.
Both graphs show that there is a positive relationship between the years
worked and annual salary. Based on the equation of the linear trend line,
one can say that the annual expected increase in salary is about $1,016.
c. The linear trend line fits the data well as the R-square is 0.9453. However,
the logarithmic line fits the data better as the corresponding R-square is
0.9622.
7.13
a. Town population is the independent variable and average household
income is the dependent variable.
b. The following graphs plot the relationship between the town population and
the average household income. We have fitted two different trend lines to
the data, a linear and a logarithmic trend line. There exists a positive
relationship between the town population and the average household
income. Based on the equation of the linear trend line, one can say that for
every additional 1000 people, there is an increase of about $1,954 on the
average household income of the town.
c. The linear trend line fits the data well as the R-square is 0.8724. However,
the logarithmic trend line fits the data better as the corresponding R-square
is higher.
7.14 We graph the relationship between the salary and age.
The R-square we get is 0.7508. That means 75% of the changes in salary are
explained by work experience.
7.15
a. The power trendline fits the data better as the corresponding R-square is
the highest.
b. The R-square for the linear trendline is 0.929, for the exponential 0.9185
and for the power trendline 0.9372.
c. If production is 800 units, the costs are expected to be:
429.79*(800)^0.7148 = $51,096.
7.16
a. In order to identify the best curve that fits our data, we experimented with
different trend lines. The following are the R-squares for each trend lines:
linear – 0.906; exponential – 0.9425; logarithmic – 0.9765; power – 0.9563;
polynomial – 0.959. Based on the values of R-square, we can say that
Logarithmic trendline fits our data best.
b. Assuming that our data follows a learning curve, the next batch is expected to
be produced in: -16.462*Ln(21) + 125 = 75 units of time.
7.17
a. There is 1% chance that the car sales next year will be 17,431. In order to
find the number of cars expected to be sold, use the following Excel
function: ‘=NORMINV(0.01, 50000, 14000)’.
b. The probability that the company will sell less than or equal to 2.7 million
cars during the next year is 1. In order to find this probability, we used the
following Excel function: ‘=NORMDIST(2700000,50000,14000,TRUE)’.
7.18 6.68% of American males weight more than 225lbs. In order to find that use the
following Excel function: ‘=1-NORMDIST(225,180,30,TRUE)’.
7.19 10.56% of the people make more than $60,000. In order to find that use the
following Excel function: ‘=1-NORMDIST(60000,45000,12000,TRUE)’.
The percentage of people that make more than $60,000 (when the standard
normal distribution is used instead) is: 10.56%. In order to find that use the
following Excel function: ‘=1-NORMSDIST(1.25)’. As expected, the same answer
is found in both cases.
7.20 The probability that the sales will be over 600 in January is: 0.3425. To calculate
that use the following Excel function: ‘=1-EXPONDIST(600,1/560,TRUE)’.
7.21 The probability of observing exactly 15 accidents at the plant is: 0.1024. To
calculate that, use the following Excel function: ‘= POISSON(15,15,FALSE)’.
The probability of observing less than 15 accidents at the plant is: 0.4657. To
calculate that, use the following Excel function: ‘=POISSON(14,15,TRUE)’.
We can be 99% sure that less than 25 accidents will occur in a year. In order to
find the number of accidents one could use the inverse Poisson distribution
function. However, there is no such a function in excel. Therefore, we used Goal
Seek to find the number of accidents. We set the Excel function (POISSON) in
the following way:
Then select Tools > Goal Seek from the main menu.
The Goal Seek window appears. Fill in the information in this window as follows:
7.22 In this problem the probability of a show up is 0.95. The plane holds 200
passengers. We need to find how many tickets to sell, so that the chances for
overbooking are less than or equal to 5%, in other words one should find x that
satisfies the following: P(x > 200) = 0.05 or P(x ≤ 200) = 0.95.
In order to find the number of tickets, such that at most 5% of the time the
company will overbook, one should use the inverse Binomial distribution function.
However, there is no such a function in excel. Therefore, we used Goal Seek to
find the number of accidents. We set the Excel function (BINOMDIST) the
following way:
Then select Tools > Goal Seek from the main menu.
The Goal Seek window appears. Fill in the information in this window as follows:
We find that 206 tickets should be sold.
7.23
a. We need to find P(5*x ≥ 60), or, P(x ≥ 12). Random variable x has a binomial
distribution with probability of success equal to 0.5. This is equal to: 1- P(x ≤
11). We find this using the following Excel function:
‘=1-BINOMDIST(11,20,0.5,TRUE)’
b. Let consider the case that for each incorrect answer the student will loose 5
points. We assume that the student gives an answer to each question. Let x
be the number of correct answers, than 20 – x will be the number of incorrect
answers. We want to find P(5*x - 5*(20 - x) ≥ 60) = P(x ≥ 16) = 1 - P(x≤15).
We find this using the following Excel function:
‘=1-BINOMDIST(15,20,0.5,TRUE)’
7.24 The probability that we will wait more than 1 minute before seeing the next arrival
is 0.2636. To find that we used the following Excel function:
‘=1-EXPONDIST(60,1/45,TRUE)’
The probability that we have to wait for at least 2 minutes before seeing the next
arrival is 0.071045. To find that we used the following Excel function:
‘=1-EXPONDIST(60,1/45,TRUE)’
7.25
a. The following graph plots a trendline to the data. The trendline that best fits our
data is polynomial as it gives the highest R-square.
b. The R-square found for the linear trendline is 0.9261; for the power 0.8824; for
the logarithmic 0.8588; for the exponential 0.911; for the polynomial 0.9353.
c. The expected sales for week 13 are: -0.1831*13^2 + 7.9988*13 + 58.341 = 131
and the expected sales for week 14 are: -0.1831*14^2 + 7.9988*14 +
58.341=134.
7.26
a. The probability that a part is longer than 80.5 millimeters or shorter than 80
millimeters is 0.225. To find this probability use the following Excel function: ‘=(1-
NORMDIST(80.5,80.3,0.2,TRUE))+NORMDIST(80,80.3,0.2,TRUE)’.
b. 99% of the time, the length of the case will be up to 80.77 millimeters. To find the
length of the case, use the following Excel function: =NORMINV(0.99,80.3,0.2).
7.27
c. The probability that the bottle weights more than 13 ounces is 0.02275. In
order to find this probability use the following Excel function:
‘=1-NORMDIST(13,12,0.5,TRUE)’.
d. The probability that the weight is no more than 13 ounces and no less than
11 ounces is 0.9545. In order to find this probability use the following Excel
function:
‘=NORMDIST(13,12,0.5,TRUE) -NORMDIST(11,12,0.5,TRUE)’.
e. The standard deviation of weight should be 0.33 for the company to state that
99.9% of the bottles weight less than 13 ounces. In order to find the standard
deviation one should calculate ‘=NORMDIST(13,12, sigma, TRUE)’ for
different values of sigma, until the value of this function is equal to 99.9%.
f. The mean of weight should be 11.3 for the company to state that 99.9% of
the bottles weight less than 13 ounces. In order to find the mean one should
calculate ‘=NORMDIST(13,mean,0.5,TRUE)’ for different values of the mean,
until the value of this function is equal to 99.9%.
7.28
a. The probability that a page is viewed for more than 10 seconds is 0.357. To
find this probability, use this formula: ‘=1-LOGNORMDIST(10,0.5,1)’.
b. 50% of the users view a page for 1.65 minutes. To find the number of users,
use this formula: ‘=LOGINV(0.5,0.5,1)’
c. The following are the density functions for the Lognormal distribution with θ =
0.5 and 1 and ω2 = 1.
7.29
a. The probability that a semiconductor laser lasts at least 600 hours is 0.48. To
find this probability use the following Excel function:
‘=1- WEIBULL(600,2,700,TRUE)’.
b. The probability that a semiconductor laser lasts at most 400 hours is 0.279. TO
find this probability use the following Excel function:
‘=WEIBULL(400,2,700,TRUE)’.
c. The following is the density functions for the Weibull distribution with
parameters α =2 and β = 700 hours.
Chapter 8
Review Exercises
8.1 The three components of a mathematical model are: objective function, constraints
and decision variables.
8.2 The difference between integer programming and linear programming is that in an
integer programming problem the decision variables take integer values.
8.4 The three main steps involved in using the Solver are: (a) reading and interpreting
the problem; (b) preparing the spreadsheet; and (c) solving the model and
reviewing the results.
8.5 The constraint equations are entered separately using formulas. The constraints
are given in terms of the decision variables, therefore the formulas should be given
in terms of the decision variable cells. For each constraint, the inequality signs and
the right-hand sides should be in individual cells as well.
8.6 The Target Cell refers to the location of the formula for the objective function.
8.7 To insure that negative quantities are not produced in a Solver solution, one can
follow these steps: choose Tools > Solver from the main menu. In the Solver
Parameters window click on the click-on the Options command button. In the
Solver Options window select the option Assume Non-negativity.
8.9 To enforce binary decision variables one should add a constraint in the Solver
window. For this new constraint, highlight the range of the decision variables as the
constraint formula and choose “bin” from the list of inequalities. The RHS value will
then automatically become “binary”.
8.10 The following is a linear programming problem that can be solved using the Solver:
8.11 The Premium Solver is the latest version of Excel Solver. As such, it can handle
larger problems (problems with a larger number of decision variables and
constraints). It takes longer to solve an IP with the Standard Solver. The Standard
Solver is less efficient in solving NLP-s.
8.12 The three Solver versions offered in the Premium Solver are: Standard GRG
Nonlinear; Standard Simplex LP, and Standard Evolutionary.
8.13 Some of the options offered by the Standard Solver are similar to the ones offered
by the Premium Solver, such as Max Time, Iteration, Precision, and Assume Non-
Negativity. However, the Premium Solver has additional options such as:
Population Size, Mutation Rate that are parameters associated with the Genetic
Algorithm.
8.14 The Standard Solver is limited by a slope-based algorithm for solving NLP
problems. This algorithm works well for convex maximization or concave
minimization problems, however when this is not the structure of the problem, there
can be multiple optima which the Standard Solver will not recognize. Such
examples would be problems with fixed charges or absolute values. Therefore, the
Genetic Algorithm of the Premium Solver is much better for solving NLP problems.
Standard solver can solve NLP-s with as many as 200 variables and 100
constraints. Therefore, for larger problems one should use the Premium solver.
8.15 The two main parameters of the Genetic Algorithm are the Population Size and
Mutation Rate.
Hands-on Exercises:
8.1 The following is the solution we get from the Excel Solver:
In order to solve the problem, set the Excel spreadsheet in the following way:
The total volume shipped should not be more than the volume of the truck.
5*X1 + 2*X2 + 2*X3 + 6*X4 ≤ 4*1,000 ft2
The total weight shipped should not be more than the weight limit of the trucks.
75*X1 + 20*X2 + 20*X3 + 45*X4 ≤ 4*50,000 lbs
The number of boxes shipped is integer. We assume that we cannot ship parts of
a box.
X1, X2, X3, and X4 are integers
The number of boxes shipped should be no more than 400 or less than 0.
0 ≤ X1, X2, X3, X4 ≤ 400
X11, X12, X13, X14 present the number of clothing boxes shipped using truck
1, 2, 3, and 4.
X21, X22, X23, X24 presents the number of jewelry boxes shipped using truck
1, 2, 3, and 4.
X31, X32, X33, X34 presents the number of perfume boxes shipped using truck
1, 2, 3, and 4.
X41, X42, X43, X44 presents the number of shoe boxes shipped using truck 1,
2, 3, and 4.
Min: 500*[(400 – X11 – X12 – X13 – X14)] + 300*[(400 – X21 – X22 – X23 – X24)] +
275*[(400 – X31 – X32 – X33 – X34)] + 250*[(400 – X41 – X42 – X43 – X44)] -55*(
X11 + X12 + X13 + X14) - 70*(X21 + X22 + X23 + X24) – 65*( X31 + X32 + X33 +
X34) – 50*( X41 + X42 + X43 + X44)
The total volume shipped should not be more than the volume of each truck.
5*X11 + 2*X21 + 2*X31 + 6*X41 ≤ 1,000 ft2
5*X12 + 2*X22 + 2*X32 + 6*X42 ≤ 1,000 ft2
5*X13 + 2*X23 + 2*X33 + 6*X43 ≤ 1,000 ft2
5*X14 + 2*X24 + 2*X34 + 6*X44 ≤ 1,000 ft2
The total weight shipped should not be more than the weight limit of the trucks.
75*X11 + 20*X21 + 20*X31 + 45*X41 ≤ 4*50,000 lbs
75*X12 + 20*X22 + 20*X32 + 45*X42 ≤ 4*50,000 lbs
75*X13 + 20*X23 + 20*X32 + 45*X43 ≤ 4*50,000 lbs
75*X14 + 20*X24 + 20*X34 + 45*X44 ≤ 4*50,000 lbs
The number of boxes shipped is integer. We assume that we cannot ship parts of
a box.
X11, …, X44 are integers
The number of boxes shipped should be no more than 400 or less than 0.
0 ≤ X11,…, X44 ≤ 400
In the Excel spreadsheet, we set the objective function and constraints the
following way:
Objective function
=F2*(400-SUM(B9:E9)) +F3*(400-SUM(B10:E10)) + F4*(400-SUM(B11:E11)) +
F5*(400-SUM(B12:E12)) -E2*SUM(B9:E9)-E3*SUM(B10:E10)-
E4*SUM(B11:E11)-E5*SUM(B12:E12)
Constraints
Constraints:
In the Excel spreadsheet, set the objective function and constraints the following
way:
Check the following option of the Excel Solver: Non-negativity assumed.
Set the solver in the following way:
8.6 a. The following figure traces the dependents of the decision variables.
To trace the dependents of the decision variables, follow these steps:
- Select View > Toolbars > Formula Auditing from the main menu. Select cell
B8 and click on the icon at the Formula Auditing toolbar. Select cell B9 and
click on the icon at the Formula Auditing toolbar. Select cell B10 and click
on the icon at the Formula Auditing toolbar.
b. The following figure traces the precedents of the target cell and constraints:
To trace the precedents of the target cell and constraints, follow these steps:
- Select View > Toolbars > Formula Auditing from the main menu. Select cell
F7 (the target cell) and click on the icon at the Formula Auditing toolbar.
Select cells E8,…,E14 (one at a time) and click on the icon at the Formula
Auditing toolbar.
X1,…,X4, Y1,…,Y4 ≥ 0
In the Excel spreadsheet, set the objective function and constraints the following
way:
In the Excel spreadsheet, set the objective function and constraints the following
way:
Check the following option of the Excel Solver: Non-negativity assumed.
Set the solver in the following way:
X, Y, Z binary
The following is the solution from Excel solver. The results are presented in
thousands of dollars.
In the Excel spreadsheet, set the objective function and constraints the following
way:
Z1 takes value 1 if the student studies physics for 0-5 hours, and 0 otherwise
Z2 takes value 1 if the student studies physics for 6-10 hours, and 0
otherwise
Z3 takes value 1 if the student studies physics for 11-15 hours, and 0
otherwise
W1 takes value 1 if the student studies economics for 0-5 hours, and 0
otherwise
W2 takes value 1 if the student studies economics for 6-10 hours, and 0
otherwise
W3 takes value 1 if the student studies economics for 11-15 hours, and 0
otherwise
X11 exact number of hours studied (if the student studies calculus 0-5 hours)
X21 exact number of hours studied (if the student studies calculus 6-10 hours)
X31 exact number of hours studied (if the student studies calculus 11-15
hours)
Y11 exact number of hours studied (if the student studies chemistry 0-5 hours)
Y21 exact number of hours studied (if the student studies chemistry 6-10
hours)
Y31 exact number of hours studied (if the student studies chemistry 11-15
hours)
Z11 exact number of hours studied (if the student studies physics 0-5 hours)
Z21 exact number of hours studied (if the student studies physics 6-10 hours)
Z31 exact number of hours studied (if the student studies physics 11-15
hours)
W11 exact number of hours studied (if the student studies economics 0-5
hours)
W21 exact number of hours studied (if the student studies economics 6-10
hours)
W31 exact number of hours studied (if the student studies economics 11-15
hours)
Constraints:
X11 + X21 + X31 + Y11 + Y21 + Y31 + Z11 + Z21 + Z31 + W11 + W21 + W31 ≤
40 time constraint
X1 + X2 + X3 = 1
Y1 + Y2 + Y3 = 1
Z1 + Z2 + Z3 = 1
W1 + W2 + W3 = 1
The student spends the same amount of time studding calculus and chemistry
X11 + X21 + X31 - Y11 – Y21 – Y31 = 0
The student spends the double the amount of time studding physics than
economics
Z11 + Z21 + Z31 - 2*W11 – 2*W21 – 3*W31 = 0
The time spend studding calculus is between the time spend for physics and
economics
W11 + W21 + W31 ≤ X11 + X21 + X31 ≤ Z11 + Z21 + Z31
0 ≤ Y11 ≤ 5*Y1
6*Y2 ≤ Y21 ≤ 10*Y2
11*YX3 ≤ Y31 ≤ 15*Y3
0 ≤ Z11 ≤ 5*Z1
6*Z2 ≤ Z21 ≤ 10*Z2
11*Z3 ≤ Z31 ≤ 15*Z3
0 ≤ W11 ≤ 5*W1
6*W2 ≤ W21 ≤ 10*W2
11*W3 ≤ W31 ≤ 15*W3
X1, X2, X3, Y1, Y2, Y3, Z1, Z2, Z3, W1, W2, W3 are binary
X11, X21, X31, Y11, Y21, Y31, Z11, Z21, Z31, W11, W21, W31 ≥ 0
The following is the solution found from Excel solver. The student studding 40
hours a week will have an average of 92 points. The student has to spend 11
hours studding calculus and chemistry, 12 hours studding physics and 6 hours
studding economics.
In the Excel spreadsheet, set the objective function and constraints the following
way:
The objective is to minimize the total number of police officers needed to meet
the daily requirements:
Min: X1 + X2 + X3 + X4 + X5 + X6
The following constraints insure that the daily requirements for police officers are
met:
X1 + X6 ≥ 8
X1 + X2 ≥ 7
X2 + X3 ≥ 6
X3 + X4 ≥ 6
X4 + X5 ≥ 5
X5 + X6 ≥ 4
The weekly salary for the employees that start working on:
Monday is: 5*100 = $500,
Tuesday and Sunday is: 4*100 + 150 = $550
Wednesday through Saturday is: 3*100 + 2*150 = $600
In the Excel spreadsheet, set the objective function and constraints the following
way:
Set the solver in the following way:
8.13 In addition to the decision variables defined in the hands-on exercise 8.13, we
have the following variables:
Y1 number of part-time employees that start working on Monday
Y2 number of part-time employees that start working on Tuesday
Y3 number of part-time employees that start working on Wednesday
In the Excel spreadsheet, set the objective function and constraints the following
way:
In the Excel spreadsheet, set the objective function and constraints the following
way:
Set the solver in the following way:
X1, X2, X3, Y1, Y2,Y3, Z1, Z2, Z3, W1, W2, W3 positive integers
In the Excel spreadsheet, set the objective function and constraints the following
way:
Check the following option of the Excel Solver: Non-negativity assumed.
Set the solver in the following way:
X11,…,X23 ≥ 0
In the Excel spreadsheet, set the objective function and constraints the following
way:
X11,…,X33 ≥ 0
X12,…, X32 ≥ 0
In the Excel spreadsheet, set the objective function and constraints the following
way:
8.20 Use the same decision variables as for hands-on exercise 8.19.
The objective is to minimize costs:
16,000*Y1 + 250*X1 + 370*X2 + 9,000*Y3 + 270*X3
In the Excel spreadsheet, set the objective function and constraints the following
way:
Set the solver in the following way:
The objective is to minimize the distance traveled from the plant to the
warehouse:
Min: X12 + 3*X13 + 2*X23 + X24 + 3*X25 + X35 + 4*X36 + 6*X45 + 7*X46 +
5*X56
The following is the solution found using Excel solver. The shortest route that
starts at the plant and ends at the warehouse includes arcs (1, 2), (2, 4), (4, 6).
In the Excel spreadsheet, set the objective function and constraints the following
way:
Set the solver in the following way:
8.22 The decision variables and constraints for this exercise are the same as for
hands-on exercise 8.21. The objective function changes to the following:
Max: 3*X12 + 4*X13 + 7*X23 + 5*X24 + 20*X25 + 2*X35 + 10*X36 + 8*X45 +
12*X46 + 15*X56
The following is the solution found using Excel solver:
In the Excel spreadsheet, set the objective function and constraints the following
way:
In the Excel spreadsheet, set the objective function and constraints the following
way:
Review Exercises
9.3 To activate the Scenarios function one can go to Tools > Scenarios in the
main menu. Click on the add button to add a new scenario.
9.5 The following are four distribution functions under the Statistical category
of functions is Excel: LOGNORMDIST, NORMDIST, NORMSDIST, and
BETADIST.
9.6 The following are four inverse distribution functions under the Statistical
category of functions is Excel: LOGINV, NORMINV, NORMSINV, and
BETAINV.
9.9 ‘=GAMMAINV(RAND(),5,8)’
9.10 Companies analyze the sensitivity of demand to price. In this case, an
Excel simulation model could be used to calculate the demand for the
final product as a function of price.
Hands-on Exercises
The results of the simulation indicate that: (a) if the student gets 100 in
one of the exams, in the other exam he can get as low as 95 and still
reach his goal; (b) if the student gets 99 in one of the exams, in the other
exam he can get as low as 96 to have an overall average of 93; (c) if the
students gets 98 in one of the exams, then in the next exam he could get
as low as 97.
9.2
a. To generate 5 random numbers exponentially distributed with mean
12 and standard deviation 2, use the following Excel function:
‘=LOGINV(RAND(),12,2)’.
b. To generate 5 random numbers from Beta distribution with an alpha of
4 and a beta of 3, use the following Excel function:
‘=BETAINV(RAND(),4,3)’.
c. To generate 5 random numbers from Chi-squared distribution with 6
degrees of freedom, use the following Excel function:
‘=CHIINV(RAND(),6)’.
d. To generate 5 random numbers from standard normal distribution,
use the following Excel function: ‘=NORMSINV(RAND())’.
9.4 The following table presents the results from the scenario analysis. We
created 3 scenarios. The first scenario considers that the bakery
purchases only 200 lbs of white flour. The total costs for each vendor are
calculated. The results show that vendor C is the best choice for this
product.
The second scenario considers that the bakery purchases only 200 lbs of
wheat flour. The total costs per vendor are calculated and again the total
costs are minimized if vendor C is picked.
The third scenario considers that the bakery purchases only 200 lbs of
wheat sugar. The total costs per vendor are calculated. The total costs
are minimized if vendor A is picked.
9.7 Considering that the time it takes to process a box is normally distributed
with mean 30 seconds, and the time to failure is normally distributed with
mean 4*3600 = 14,400 seconds, we expect that on average after every
480 boxes processed the blades on the Flex-O machine would fail.
Keeping that information in mind, we created 12 different scenarios.
The following table presents the Excel functions used to generate the
failure time and processing times. The same set of formulas, as in column
C, are used up to column AF (each column corresponds to a run).
The following table presents the final results of this simulation. The
number in cells AI2:BL13 is 1 if the blade fails prior to being changed and,
0 otherwise. The numbers in cells BM2:BM13 present the number of
times (in percentage) the blade fails prior to being changed (under each
scenario).
Based on the results of the simulation, if the blade is changed after 450
boxes are processed, only 7% of the time the blade would fail prior to
processing the 450 boxes.
9.8 The following are the results from the simulation analysis:
The Excel spreadsheet is set-up as shown below:
9.9
a. The following table presents the expected number of batches ordered and
the corresponding supply time.
9.10
a. The following table presents the profits for different sales amount. The
results are generated using Data Tables.
D * $15,000 if D >= OQ
P= .
D * $15,000 + (OQ − D) * $5,000 if D < OQ
Based on this simulation, the probability of winning is 0.06, since out of 100
games simulated we had a total of 6 wins.
To generate the numbers in cells AP3:AP102, type the following formula in cell
AP3 and copy it to the rest of the cells: ‘ =IF(SUM(AF3:AO3)>4,1,0)’.
Based on the results of this simulation, if the bidder bids $40 millions, he
has a probability of win equal to 0.97. If he bids $30 millions, his
probability of win is only 0.08.
The following figure presents the Excel spreadsheet we created for this
problem:
The following formula is used to find out if in a particular run Team A had a win
using Sequence 1 (column B):
=IF((IF(RAND()>0.4,1,0) + IF(RAND()>0.4,1,0) + IF(RAND()>0.6,1,0) +
IF(RAND() > 0.6,1,0) + IF(RAND()>0.4,1,0) + IF(RAND()>0.6,1,0)+
IF(RAND()>0.4,1,0))>3,1,0)
The following formula is used to find out if in a particular run Team A had a win
using Sequence 2 (column C):
=IF((IF(RAND()>0.4,1,0) + IF(RAND()>0.4,1,0) + IF(RAND()>0.6,1,0) +
IF(RAND() >0.6,1,0) + IF(RAND()>0.6,1,0) + IF(RAND()>0.4,1,0)+
IF(RAND()>0.4,1,0))>3,1,0)
The probability of winning is then calculated by dividing the number of wins over
100 runs, by 100.
9.15 The following figure presents the results of the simulation. The expected
amount won is $-1.
9.19
a. Based on the results from the simulation study, on average a patient
spends 58 minutes in the emergency room.
b. Based on the results from the simulation study, on average a patient
spends 21 minutes waiting for the doctor.
c. The doctor is busy 63% of the time.
9.20 Based on simulation we find that the probability of a win is 0.2. The
following table presents the results of the simulation:
c. After hiring the new employee, the results of the simulation show that:
Based on the results of the simulation order size of 40 maximizes the total profits.
9.24 Set the Excel spreadsheet the following way to calculate the time in the
system, waiting time and server idle time for FIFO service rule:
The formulas used are:
Review Questions
10.1 Sorting is the ordering of all entries in a database by a particular field. Field is the
name of a category by which items are grouped in a database. Sorting and field
are related as you sort a database by a particular field.
10.3 Filtering differs from sorting because it selects a specified set of data from the
database instead of ordering the entire database. Filtering allows us to select a
group of entries in our database that are equal to a particular data entry within a
field.
10.4 Auto filter will transform the display of the spreadsheet by adding drop-down
arrows to each field.
10.5 The Top 10 option gives the option of showing on the top or bottom 10 entries (or
another specified amount), or the top or bottom 10 percent of entries in the
database.
10.6 The Custom option from a filtered drop-down list gives the user a set of inequality
specifications. The user can view entries whose field value is less than, greater
than, or equal to a certain value.
10.7 Consider the case where, in the end of the semester, a professor has to decide
about the final grades. He will give: an A to the students that have an overall
average between 90 and 100; a B to the students with an overall average
between 80 and 89; and so on. Filtering would help in this case. He can filter the
database, so that it presents only the students with an overall average greater
than or equal to 90; next he can filter the database so that it presents the
students with an overall average between 80 and 89; and so on.
10.8 Dfunctions is a group of Excel functions that are designed for working with Excel
as a database. These functions are essentially the same as the (ordinary) Excel
functions discussed in Chapter 4. However, Dfunctions differ from the previously
described functions because they specify certain criteria before performing the
function.
10.9 Five Dfunctions available in Excel are: DSUM, DAVERAGE, DMIN, DMAX, and
DSTDEV.
10.10 The criteria parameter must include a field name and a criteria cell.
10.11 Dfunctions are useful for databases as they allow the user to consider many
options in the search for a particular value.
10.12 The data from an Excel database can be exported to another workbook or to a
database in another program, such as Microsoft Access.
10.13 We will show how to refer to an external database when using Dfunctions with an
example. Consider the Dfunction DSUM. The format of this function is:
‘=DSUM(database, field, criteria)’. Suppose that we want to sum up the numbers
in the column B, based on a certain criteria, in a Database that is saved in the
Excel file Database1.xls. To refer to this database, we would use DSUM
Dfunction as follows:
=DSUM([Database1.xls]Sheet1!$A$1:$B$7,[Database1.xls]Sheet1!$B$1,
[Database1.xls]Sheet1!$B$8:$B$9)
10.14 A query is a search for a particular set of data from a certain database, similar to
filtering.
10.15 In order to run a query before data has been imported from an external database,
follow these steps: choose Data > Import External Data > New Database Query
from the main menu. The window “Choose Data Source” appears. This window
enables the user to configure the data source for the query. The next window that
appears is the “Select Database” window that gives a list of files that match the
data source type. Next step is to specify which column of data should appear in
the final table and finally specify how the user wants to filter the data.
Hands-on Exercises
10.1 a. The following table presents the names of the workers that will be promoted.
b. The following table presents the name of the employee that is qualified to be
the team leader.
10.2 a. The following figure presents the data sorted by employee name in an
ascending order.
b. The number of employees that attended the assembly of more that 400 units
of output during week 1, is 11. The formula to be used is: ‘=COUNTIF(B3:B22,
">= 400")’.
10.3 The following figure presents the results for this exercise.
10.5 a. The following are the results from filtering the database to show only the
students that never missed a class.
b. The following are the results from filtering the database to show the students
that missed at least one class:
c. The average grade for the students that never missed a class is: 87.33.
d. The average grade for the students that missed 3 classes is: 82.37.
The results show that there is a relationship between the classes missed and the
average grade.
The figure below shows the formulas used to calculate the averages.
10.6 a. The class average for the 1-st exam is 81.43. The following figure gives the
names, grades and attendance for the students that performed better than class
average in this exam.
b. The class average for the 2-nd exam is 87.34. The following figure gives the
names, grades and attendance for the students that performed better than class
average in this exam.
Looking to the results from parts (a) and (b), one can see that most of the
students (6 out of 8) that did well in the first exam, did well in the second exam
too.
10.7 The total number of cardholders that are eligible for the platinum-level
membership is 6. The following figure presents the formulas used.
10.8 The following figure presents the names, enrollment date, credit limit and number
of late payments for the eligible cardholders.
10.9 The following figure presents the results for this exercise:
10.11 In order to ensure that each cell in the range A1:A10 contains at most 5
characters, follow these steps:
a. Select cells A1:A10.
b. Choose: Data > Validation from the main menu. The “Data Validation”
window appears.
c. In the “Data Validation” window, select the Setting tab. From the combo box
Allow select Text length. From the combo box Data, select less than or equal
to. In the textbox Maximum type 5.
d. In the “Data Validation” window, select the Input Message tab. In the Title
textbox type Text length!. In the Input Message textbox type There should be
at most 5 characters in a cell.
e. In the “Data Validation” window, select the Error Alert tab. In the Title textbox
type Text length!. In the Error Message textbox type Error! There are more
than 5 characters in this cell.
f. Click on the OK command button.
The following figure presents an example of the error message received in case
that the user typed a text with more than 5 characters.
10.12 Use the Custom validation option and enter the following formula.
=COUNTIF($B$1:$B$10, B1)<2
10.13 To ensure that in the column that contains the employee names, the user enters
only text, follow these steps:
a. Select column A of the database. In this column the user types-in the
employee names.
b. Choose: Data > Validation from the main menu. The “Data Validation”
window appears.
c. In the “Data Validation” window, select the Setting tab. From the combo box
Allow select Custom. From the combo box Formula, type ‘=Istext(A2)’.
d. In the “Data Validation” window, select the Error Alert tab. In the Title textbox
type Error! In the Error Message textbox type: This is a text field!
e. Click on the OK command button.
The following figure presents an example of the error message received in case
that the user does not type text on the column with the names of the employees.
To ensure that the phone numbers have 10 digits, follow these steps:
a. Select column B of the database. In this column the user types-in the phone
numbers.
b. Choose: Data > Validation from the main menu. The “Data Validation”
window appears.
c. In the “Data Validation” window, select the Setting tab. From the combo box
Allow select Whole number. From the combo box Data, select between. In
the textbox Minimum type 99999999, and in the textbox Maximum type
999999999.
d. In the “Data Validation” window, select the Error Alert tab. In the Title textbox
type Error! In the Error Message textbox type: The phone number should
have 10 digits!
e. Click on the OK command button.
The following figure presents an example of the error message received in case
that the user types in column B, a number with less than or more than 10 digits.
To ensure that the price owed is not negative, follow these steps:
a. Select column C of the database. In this column the user types-in the price
owed.
b. Choose: Data > Validation from the main menu. The “Data Validation”
window appears.
c. In the “Data Validation” window, select the Setting tab. From the combo box
Allow select Decimal. From the combo box Data, select greater than or equal
to. In the textbox Minimum type 0.
d. In the “Data Validation” window, select the Error Alert tab. In the Title textbox
type Error! In the Error Message textbox type: The price should be positive!
e. Click on the OK command button.
The following figure presents an example of the error message received in case
that the user types in column C, a negative number.
10.14 The following figure presents the data imported from the website
‘http://www.baseball-reference.com/b/bondsba01.shtml’. In order to import the
data, follow these steps:
a. Choose Data > Import External Data > New Web Query from the main menu.
b. In the New Web Query window that appears type at the textbox Address
‘http: //www.baseball-reference.com/b/bondsba01.shtml’.
c. In the website that appears in New Web Query window, select the data you
are interested in and click the command button Import.
The data that we imported presents the annual salary for the Pittsburgh Pirates
and San Francisco Giants baseball teams. We calculated the average annual
salary for each team using these formulas:
10.15 The following figure presents the data imported from the website ‘http://www.x-
rates.com/’. In order to import the data, follow these steps:
c. Choose Data > Import External Data > New Web Query from the main menu.
c. In the New Web Query window that appears type at the textbox Address
‘http://www.x-rates.com/’.
c. In the website that appears in New Web Query window, select the data you
are interested in and click the command button Import.
In order to update the exchange rates, click at the Refresh All button in the
External Data toolbar.
10.16 In order to import the text file to Excel follow these steps:
a. Choose File > Open from main menu. As the user opens a text file in Excel,
the Text Import Wizard window appears.
b. Check the Delimiter option in the Step 1 of the Text Import Wizard.
c. Check Tab option in the Delimiter option box in Step 2 of the Text Import
Wizard.
d. Click on the command button Ok in Step 3 of the Text Import Wizard.
10.17 In order to import the text file to Excel follow these steps:
a. Choose File > Open from main menu. As the user opens a text file in Excel,
the Text Import Wizard window appears.
b. Check the Delimiter option in the Step 1 of the Text Import Wizard.
c. Check Tab option in the Delimiter option box in Step 2 of the Text Import
Wizard.
d. In Step 3 of the Text Import Wizard, in the Data Preview list box, select the
column that carries the addresses. Check the Do not import column (skip)
option in the Column Data Format option box.
e. In Step 3 of the Text Import Wizard, in the Data Preview list box, select the
column that carries the zip code. Check the Do not import column (skip)
option in the Column Data Format option box.
f. In Step 3 of the Text Import Wizard, click the OK command button.
10.18 The following figure presents the results for this problem.
10.19 In order to filter the database select Data > Filter > AutoFilter from the main
menu.
e. The following table presents the results of filtering. To filter the data select
Top 10 from the drop-down list of values in the Dollar field. Set the Top 10
AutoFilter to: top 5 percent.
f. The following table presents the results of filtering. To filter the data select
Custom from the drop-down list of values in the Units field. Set the Custom
AutoFilter to: is greater than 50. Select Custom from the drop-down list of
values in the Date field. Set the Custom AutoFilter to: greater than
12/31/2003 and less than or equal to 12/31/2004.
g. The following table presents the results of filtering. To filter the data select
lip gloss from the drop-down list of values in the Product field. Select
Custom from the drop-down list of values in the Date field. Set the
Custom AutoFilter to: greater than 12/31/2003 and less than 7/1/2004.
h. The following table presents the results of filtering. Calculate the average
money made on eye liners using the formula: ‘= DAVERAGE (A1:G26,
F1, D27:D28)’. The average money made on eye liners is $134.58. To
filter the data select eye liner from the drop-down list of values in the
Product field. Select Custom from the drop-down list of values in the
Dollar field. Set the Custom AutoFilter to: greater than 134.58.
10.20 a. The following table presents the Max sales for each product, in each month
for both regions.
b. The following table presents the total number of sales made for each product
in each month.
10.21
a. The average amount sold during the first half of March in region 1 is 108.13.
b. The average amount of product A sold during the second half of January in
region 1 is 462.
c. The minimum amount of product B sold during the month of February in region
1 is 0.
d. The total amount sold in January 1st in region 1 is 647.
10.22
a. The following table summarizes the information presented in the three tables.
b. The following table presents the average, maximum and minimum grade a
student received in the exams. To create the tables, follow these steps:
- Select Data > Consolidate from the main menu. The Consolidate window
appears.
- In the consolidate window select Average/Maximum/Minimum from the
Function combo box.
- Select the three tables together with their row headings only, one at a time
and add their address to the Address list box.
- Finally check Left Column from the Use Labels In option box.
10.23
a. Select the column that carries product identification numbers.
- Choose Data > Validation from the main menu. The “Data Validation”
window appears.
- In the “Data Validation” window, select the Setting tab. From the combo
box Allow select Whole number. From the combo box Data, select
between. In the textbox Minimum type 9999. In the textbox Maximum type
99999.
- In the “Data Validation” window, select the Error Alert tab. In the Title
textbox type Error!. In the Error Message textbox type Identification
number should have exactly 5 digits!.
- Click on the OK command button.
b. Select the column that carries the information about the inventory level.
- Choose Data > Validation from the main menu. The “Data Validation”
window appears.
- In the “Data Validation” window, select the Setting tab. From the combo
box Allow select Decimal. From the combo box Data, select greater than
or equal to. In the textbox Minimum type 0.
- In the “Data Validation” window, select the Error Alert tab. In the Title
textbox type Error!. In the Error Message textbox type Inventory level
should be positive!.
- Click on the OK command button.
c. Select the column that carries the information about the unit price.
- Choose Data > Validation from the main menu. The “Data Validation”
window appears.
- In the “Data Validation” window, select the Setting tab. From the combo
box Allow select Decimal. From the combo box Data, select greater than
or equal to. In the textbox Minimum type 150.
- In the “Data Validation” window, select the Error Alert tab. In the Title
textbox type Error!. In the Error Message textbox type The unit price
should be at least $150!.
- Click on the OK command button.
d. Type fair, good very good in three different cells in the same excel
spreadsheet. Select the column that carries the information about the product
condition.
- Choose Data > Validation from the main menu. The “Data Validation”
window appears.
- In the “Data Validation” window, select the Setting tab. From the combo
box Allow select List. In the text box Source specify the location of the
cells that carry the text (fair, good and very good) typed earlier.
- In the “Data Validation” window, select the Error Alert tab. In the Title
textbox type Error!. In the Error Message textbox type The condition of
the inventory should either be Fair, or Good or Very Good!.
- Click on the OK command button.
e. Select the column that carries the information about the purchase date.
- Choose Data > Validation from the main menu. The “Data Validation”
window appears.
- In the “Data Validation” window, select the Setting tab. From the combo
box Allow select Date. From the combo box Data, select greater than or
equal to. In the textbox Start Date type 1/1/2000.
- In the “Data Validation” window, select the Error Alert tab. In the Title
textbox type Error!. In the Error Message textbox type The purchased
date cannot be smaller than 1/1/2000!.
- Click on the OK command button.
10.24
a. In order to import the database to Excel follow these steps:
- Select Data > Import External Data > Import Data from the main menu.
The Select Data Source window appears.
- Specify the path to the School.dbm file and click-on the OK button.
- The Select Table window appears. Select the table tblStudents and click-
on the OK button.
b. The following table presents detailed information about the graduate students
enrolled not earlier than 1/1/2000.
- Select Data > Filter > AutoFilter from the main menu.
- Select Graduate from the drop-down list of values in the Category field.
- Select Custom from the drop-down list of values in the EnrollDate field.
Set the Custom AutoFilter to: greater than or equal to 1/1/2000.
c. The following table presents detailed information about the undergraduate
students that have earned at least 6 credit hours.
- Select Data > Filter > AutoFilter from the main menu.
- Select Undergraduate from the drop-down list of values in the Category
field.
- Select Custom from the drop-down list of values in the Credits field. Set
the Custom AutoFilter to: greater than or equal to 6.
- Select Data > Filter > AutoFilter from the main menu.
- Select Undergraduate from the drop-down list of values in the Category
field.
- Select FL from the drop-down list of values in the State field.
10.25
a. In order to import the database to Excel follow these steps:
- Select Data > Import External Data > Import Data from the main menu.
The Select Data Source window appears.
- Specify the path to the School.dbm file and click-on the OK button.
- The Select Table window appears. Select the table tblInstructorss and
click-on the OK button.
b. In order not to allow for salaries less than $40,000, use the data validation
tools as follow.
- Choose Data > Validation from the main menu. The “Data Validation”
window appears.
- In the “Data Validation” window, select the Setting tab. From the combo
box Allow select Decimal. From the combo box Data, select greater than
or equal to. In the textbox Minimum type 40000.
- In the “Data Validation” window, select the Error Alert tab. In the Title
textbox type Error!. In the The annual salary cannot be less than $40,000.
- Click on the OK command button.
c. The following table presents detailed information about the instructors that
have earned the title Professor.
- Select Data > Filter > AutoFilter from the main menu.
- Select Professor from the drop-down list of values in the Title field.
d. The following table presents detailed information about the professors that
are not USA citizens.
- Select Data > Filter > AutoFilter from the main menu.
- Select Blank from the drop-down list of values in the State field.
e. The following table presents detailed information about the professors that
make top 10% of the annual salary.
- Select Data > Filter > AutoFilter from the main menu.
- Select Top 10 from the drop-down list of values in the Salary field.
- Set the Top 10 AutoFilter window to show top 10 percent. Click-on the OK
command button.
Chapter 11
Review Exercises:
11.1 The three parts of an Excel project are: objects, modules and forms. Objects are
elements in a workbook, including the workbook and worksheets. Modules
contain the VBA code for any macro. Forms are the user interface which has both
user display design and VBA code.
11.2 Properties are the physical descriptions of all Excel objects. For example, a range
object would have a length property and a cell object may have a font size
property. Methods are the actions that can be performed on the object. For
example, a range can be selected and a cell can be deleted.
11.3 Properties of the Chart class are: ChartTitle, ChartType and ChartArea.
11.4
a. WindowActivate: is an event and member of Workbook class.
b. Cells: is a property and member of the Worksheet class.
c. SumIf: is a function and a member of the WorksheetFunction class.
d. Protect: is a function and a member of Chart, Workbook and Worksheet
classes.
e. ColorIndex: is property and a member of the Border class.
11.5 A procedure is a section of the code that is used to perform different tasks with
Excel objects.
11.6 The two main procedure types are: sub procedures and function procedures.
11.7 Some of the options on the Edit toolbar are: List Properties/Methods, List
Constants, Quick Info, Parameter Info, Complete Word, Indent, Outdent, etc.
11.8 The arguments of the Sort method are: Key1, Order1, Key2, Type, Oder2, Key3,
Order3, Header, OrderCustom, MatchCase, Orientation, SortMethod,
DataOption1, DataOption2, DataOption3.
11.9 Project Explorer and Property windows do not have to be open at all times. One
can write a code in VBE while the Project Explorer and Property windows are
closed.
11.10 To insert a module to a project click Insert > Module in the VBE window. You
can also use the icon to see a drop down list of insert options.
Chapter 12
Review Questions:
12.5 Some of the methods used with the Selection object are: AutoFilter, Copy, Sort,
etc.
12.6 Each object in Excel has its own list of event procedures. To find the event
procedures for an object: select the object, then the corresponding even
procedures can be found in the drop-down menu in the upper-right hand corner of
the code window in the visual basic editor.
12.7 The difference between using a command button from the Control Toolbox and
using a drawing object is that:
When shapes are used, one can easily add captions and format the command
button. One can also assign any macro, or public procedure from any module to
the command button created.
12.8 The first step is to create the new toolbar. One can do that by choosing:
a. View > Toolbars > Customize from the main menu. The Customize window
appears.
b. In the Customize window select the Toolbar tab and then click-on the New
command button. In the New Toolbar window type the name of the toolbar
created.
c. In the Customize window select the Command tab to add the button with the
macro assigned to it, to the new toolbar. In the Commands tab scroll down
the Categories list and select Macros from the list. Select the Custom Button
option.
d. To add the command button to our new toolbar, just click and drag the
Custom Button to the toolbar. The new button should automatically be
selected from the toolbar and the Modify Selection option should become
available on the Customize window. One can now select Modify Selection to
specify the name of the toolbar button, edit the button icon, and assign a
macro to the button action.
12.9 When you type the name of the new menu item, place a “&” sign before the letter
to be used in the shortcut. This shortcut is performed by pressing ALT key and
whatever letter you placed after the “&” sign.
12.10 Some of the properties associated with the scroll bar control are: LinkedCell;
Max, Min, LargeChange, SmallChange, MouseIcon, Placement,, etc.
Hands-on Exercises:
12.1 The following is the visual basic code of the macro recorded in this exercise:
12.2 The following is the visual basic code for the macro recorded in this exercise:
12.3 The following is the visual basic code for the macro recorded for this exercise:
12.4 The following is the visual basic code for the macro recorded in this exercise:
12.5 The following is the visual basic code for the macros recorded in this exercise:
12.6 The following is the visual basic code for the command button recorded in this
exercise:
12.7 The following is the visual basic code for the macro recorded for this exercise:
Using the macro the following were the results (sum, mean and standard
deviation) for the series of numbers given:
12.9 The following is the visual basic code for macro recorded in this exercise:
12.10 The following is the visual basic code for macro recorded in this exercise:
12.11 The following is the visual basic code created for this macro:
12.12 The following are the visual basic codes for the command buttons created for this
exercise:
12.13
a. The following is the visual basic code for this macro:
12.16
a. The following is the visual basic code for the macro recorded in this exercise:
b. The following is the visual basic code created for this macro:
c. The following is the visual basic code created for this macro:
12.17 The following are the visual basic codes used to create the ZoomIn and
ZoomOut macros:
The following is the new toolbar created that has two buttons and enables the
user to zoom in or out:
a. Select View > Toolbars > Customize from main menu. The Customize
window appears.
b. In the Customize window, click on the New command button. The New
Toolbar window appears.
c. In the New Toolbar window type the name of the toolbar: Zoom.
d. Select the Command tab in the Customize window. Select the Macros in the
Categories list. In the Commands option window that corresponds to Macros,
select Custom Button. Drug the Custom Button to the toolbar.
e. Select the Custom Button in the toolbar and select Modify Selection to assign
the macro ZoomIn to the button created as well as modify the name of the
button.
f. Add another Custom Button in the toolbar, select Modify Selection to assign
the macro ZoomOut to the button created and modify the name of the button.
12.18 The following is the visual basic code for this macro:
12.19 The following is the visual basic code for the event procedure created in this
exercise.
12.20
a. The following is the visual basic code created for the command button that
fits a linear trend line to the data given.
b. The following is the visual basic code created for the command button that
fits an exponential trend line to the data given.
c. The following is the visual basic code created for the command button that
fits a power trend line to the data given.
12.21 The following are the visual basic codes corresponding to the macros recorded in
this exercise:
12.22 The following are the visual basic codes for the macros recorded in this exercise.
The following shows the buttons and the toolbar created.
a. Select View > Toolbars > Customize from main menu. The Customize
window appears.
b. In the Customize window, click on the New command button. The New
Toolbar window appears.
c. In the New Toolbar window type the name of the toolbar: Rand. Generator.
d. Select the Command tab in the Customize window. Select the Macros in the
Categories list. In the Commands option window that corresponds to Macros,
select Custom Button. Drug the Custom Button to the toolbar.
e. Select the Custom Button in the toolbar and select Modify Selection to assign
the macro that generates random numbers uniformly distributed between 0
an 1 to the button created as well as modify the name of the button.
g. Add a Custom Button in the toolbar. Select the Custom Button and click on
the Modify Selection to assign the macro that generates random numbers
uniformly distributed between 10 an 20, to the button created and modify the
name of the button.
h. Add a Custom Button in the toolbar. Select the Custom Button and click on
select Modify Selection to assign the macro that generates random numbers
from standard normal distribution to the button created and modify the name
of the button.
i. Add a Custom Button in the toolbar. Select the Custom Button and click on
select Modify Selection to assign the macro that generates random numbers
from normal distribution with mean 10 and standard deviation 3, to the button
created and modify the name of the button.
j. Add a Custom Button in the toolbar. Select the Custom Button and click on
select Modify Selection to assign the macro that generates random numbers
from exponential distribution with lambda 2, to the button created and modify
the name of the button.
12.23 The following are the visual basic codes for the macros recorded:
12.24 The following are the visual basic codes for the macros recorded in this exercise:
The following figure presents the buttons created and the “Trig. Functions” menu
item.
a. Select View > Toolbars > Customize from main menu. The Customize window
appears.
b. Select the Command tab in the Customize window. Select the New Menu in the
Categories list. In the Commands option window select New Menu option. Drug
the New Menu to the menu bar.
c. Select the New Menu item in the menu bar and select Modify Selection to modify
the name of the menu item to “Trig. Functions”. At this point do not assign a
macro to this menu item.
d. Select the Command tab in the Customize window. Select the Macros in the
Categories list. In the Commands option window that corresponds to Macros,
select Custom Button. Drug the Custom Button to the menu item “Trig.
Functions”.
e. Select the Custom Button in the menu bar and select Modify Selection to assign
the macro that generates the sinus of an angle to the button created as well as
modify the name of the button.
f. Add (drug) a new Custom Button in the menu item “Trig. Functions”. Select the
Custom Button and click on the Modify Selection to assign the macro that
generates the cosine of an angle to the button created in the menu item, and
modify the name of the button.
g. Add (drug) a new Custom Button in the menu item “Trig. Functions”. Select the
Custom Button and click on the Modify Selection to assign the macro that
generates the tangent of an angle to the button created in the menu item, and
modify the name of the button.
12.25 The following is the visual basic code for the macro recorded in this exercise:
Chapter 13
Review Questions
13.2 The argument used with the PasteSpecial method in order to paste only the
values of a copied range is xlPasteValues.
13.3 The Visible property takes the value True or False and indicates whether or not
the worksheet (along with the worksheet tab at the bottom of the screen) can be
seen by the user.
13.4 To change the color of any range of cells one can use the Interior property. With
this property one can use sub-properties such as ColorIndex or Color. If the sub-
property ColorIndex is used, the user should identify the number signifying the
special color. If the sub-property Color is used, the user should enter either a VB
Constant or a specific color using RGB function. The following are examples of
how to change the color of any range of cells to green:
Range(“A1:B10”).Interior.ColorIndex = 43
Range(“A1:B10”).Interior.Color = vbGreen
Range(“A1:B10”).Interior.Color = QBColor(2)
13.5 To format the borders of a range one can use the Borders property. The following
are some of the formatting options for the borders of a range: LineStyle, Color,
and Weight.
13.6 The property Font allows modifying the font of the content. Three common sub-
properties of property Font are: Size, FontStyle, and Italic.
Range("A1").Font.Italic = True
13.7 The three most common methods that can be used to clear cells are: Clear,
ClearContent, and ClearFormats.
13.8 ActiveChart object is used to specify the chart type and the source data.
13.9 The following are four methods of the chart objects: Add, Copy, Delete and
Move.
13.10 In order to apply properties and methods to a shape, it is important to name the
shape.
13.11 The ScreenUpdating property helps the visual basic code run more efficiently.
When ScreenUpdating property is set to False, none of the actions of the visual
basic code will be reflected on the Excel screen while the macro is being run,
making the code running faster.
The CutCopyMode property when set to True keeps the last range which was
copied highlighted until another action takes place. However, if the last action in
our code is to copy and paste a range, we do not want the user to see this
flashing range. To avoid this, we can simply set the CutCopyMode property to
False at the end of the code.
13.12 The With construct is used to set several properties of one object in an enclosed
statement.
With Range("A1:A10")
.Font.FontStyle = "Arial"
.Font.Size = 12
.Font.Underline = True
End With
13.13 The Offset property considers considers the named range to be in the 0th row and
0th column; it then offsets the range selection by a certain row count below and
column count to the right of this named range. Unlike the Offset property, the
Cells property considers the named range to be in the (1, 1) position.
13.14 Columns and Rows are used to reference rows and columns in the named range.
13.15 The End property can help to find the end of row or column of any range of data.
The End property can take four values: xlDown and xlUp for columns, and
xlToRight and xlToLeft for rows.
13.16 The property used to enter a formula into a range is Formula. The property used
to enter a formula using R1C1 notation into a range is FormulaR1C1.
13.17 The AutoFill method in VBA can be used to give the same result as copy-and-
drag in Excel.
13.18 The WorksheetFunction property allows the use of Excel functions in VBA.
Hands-on Exercises
13.1 The following is the visual basic code for this exercise:
13.2 The following is the visual basic code for this exercise:
13.3 The following is the visual basic code for this exercise:
13.4 The following is the visual basic code for this exercise:
13.5 The following is the visual basic code for this exercise:
13.6 The following is the visual basic code for this exercise:
13.7 The following is the visual basic code for this exercise:
13.8 The following are the visual basic codes for this exercise:
13.9 The following is the visual basic code for this exercise:
13.10 The following is the visual basic code for this exercise:
13.11 The following is the visual basic code for this exercise:
13.12 The following is the visual basic code for this exercise:
13.13 The following is the visual basic code for this exercise:
13.14 The following is the visual basic code for the Add and Calc Total buttons:
The Excel function used that shows the today’s date is: ‘=NOW()’.
The following data validation allows the user to choose one of the credit cards
listed:
The following data validation allows the user to choose one of the products listed:
The following figure shows how we have set the Excel spreadsheet:
13.15 The following are the visual basic codes for this exercise:
13.16 The following is the visual basic code for this exercise:
13.17 The following is the visual basic code for this exercise:
13.18 The following is the visual basic code for this exercise:
13.19 The following is the visual basic code for this exercise:
13.20 The following is the visual basic code for this exercise:
Chapter 14
Review Questions
14.1 A Message Box prints information to a small dialog box, and an Input Box
prompts the user to enter information into a small dialog box.
The arguments of the Message Box are: prompt, buttons, title, helpfile and
context.
The arguments of the Input Box are: prompt, title, default, xpos, ypos, helpfile
and context.
14.3 Yes, to a String variable one can assign a number variable using the CStr()
conversion function.
Yes, to a Integer/Double variable one can assign a string variable using the
CInt()/CDbl conversion function.
14.4 Worksheet and Object variables can both be used to reference worksheets. A
Worksheet variable can be assigned to an Object variable, but an Object variable
cannot be assigned to a Worksheet variable.
14.5 Assuming that: the user entered 23 as the two last digits of SSN; the user
entered 10 as the birthday month; and the random number generated between 1
and 11 (10*Rnd + 1) is 7.5, the answer would be: 23107.5
14.6 Len function can be used with String variable, String expression or Variant data
type.
14.8 The CDate() function takes as input only variables/expressions that contain a
valid date in some format.
14.9 For a variable to be used only in a private procedure, should be declared using
the Dim statement inside the sub procedure in which it will be used.
14.10 A Variant variable assumes the data type of the last value assigned to the
variable.
14.13 The ASCII numerical value of “M” is: 77. The letter for the ASCII number 100 is:
“d”.
Hands-on Exercise
14.1 The following is the visual basic code for this problem:
14.2 The following is the visual basic code for this problem:
The length of Double data type is always 8, as the number of bytes required to
store a double is 8 byte.
14.3 The following is the visual basic code for this exercise:
14.4 The following is the visual basic code for this exercise:
14.5 The following is the visual basic code for this exercise:
14.6 The following is the visual basic code for this exercise:
14.7 The following is the visual basic code for this exercise:
14.8 The following are the public variables used in the visual basic code:
The following is the visual basic code for the Reset button:
The following is the visual basic code for the Run button:
The following are the results from the Run sub-procedure:
14.9 The following is the visual basic code for this exercise:
14.10 The following is the visual basic code for this problem:
14.11 The following is the visual basic code for this exercise:
14.12 The following is the visual basic code for this exercise:
14.13 The following is the visual basic code for this exercise:
14.14 The following is the visual basic code for this exercise:
14.15 The following is the visual basic code for this exercise:
14.16 The following is the visual basic code for this exercise:
14.17 The following is the visual basic code for this exercise:
14.18 The following is the visual basic code for this exercise:
14.19 The following is the visual basic code for this exercise:
14.20 The following is the visual basic code for this exercise:
14.21 The following is the visual basic code for this exercise:
14.22 The following visual basic code calculates the Euclidean distance between two
cities.
The following visual basic code compares the distance between cities:
The following visual basic code calculates the horizontal distance between two cities:
The following visual basic code calculates the vertical distance between two cities:
14.23 The following is the visual basic code for this exercise:
14.24 The following visual basic code adds a new company to the list of companies.
14.25 The following is the visual basic code for this exercise.
a.
b.
c.
14.26 The following is the visual basic code for this exercise.
14.27 The following is the visual basic code for this exercise:
14.28 The following is the visual basic code for this exercise:
14.29 The following is the visual basic code for this exercise:
14.30 The following is the visual basic code for this exercise:
Chapter 15
Review Questions
15.2 Functions and sub procedures are very similar. They are both used to perform a
set of actions. However, the advantage of using functions is to return a value.
15.4 To pass a variable by value, one should insert the variable name as an
argument/ parameter of the sub when it is called; and the variable name used as
an argument when the sub procedure is called and the variable name used in the
sub procedure statement should be the same.
Sub AnnualReport()
Call Heading(CompName, StatmTitle, Date, MonUnit)
Call BalanceSheet(CompName, Date)
Call IncomeStatement(CompName, Date)
Call StatementOfRetainedEarnings(CompName, Date)
Call StatementOfCashFlow(CompName, Date)
End Sub
Sub Graph()
‘Create graph
End Sub
Hands-on Questions
15.1 The following is the visual basic code for this exercise:
15.2 The following is the visual basic code for this exercise:
15.3 The following is the visual basic code for this exercise:
15.4 The following is the visual basic code for this exercise:
15.5 The following is the visual basic code for this exercise:
15.6 The following is the visual basic code for this exercise:
15.7 The following is the visual basic code for this exercise:
15.8 The following is the visual basic code for this exercise:
15.9 The following is the visual basic code for this exercise:
15.10 The following is the visual basic code for this exercise:
15.11 The following is the visual basic code for this exercise:
15.12 The following is the visual basic code for this exercise:
15.13 The following is the visual basic code for this exercise:
15.14 The following is the visual basic code for this exercise:
15.15 The following is the visual basic code for this exercise:
Chapter 16
Review Questions
16.1 The difference between Do … Loop While and Do While … Loop is that the first
loop performs a set of actions and then repeats the action if a condition is met. In
the second loop however, the condition is checked at first. If the condition is true
the loop repeats the action.
16.2 The following visual basic code counts down an integer number entered by the
user until it reaches 1. We have used the Do While and Do Until loops to build
the countdown function.
16.3 The function used with an If, Then statement to check if a variable value is a
number is IsNumeric().
16.4 If the variable to which the result of the InputBox is assigned is empty, that is
equal to “”, then we know that the “Cancel” button has been pressed.
16.5 To check if multiple conditions have all been met we use the AND logical check.
16.6 One can also place a condition on a range of values using the Is statement. This
may be more efficient than repeating the Select Case object name for each
Case.
16.7 One can use the Exit Sub statement in a For, Next Loop if s/he wants to exit the
sub procedure. One can use the Exit For statement to exit the For, Next Loop.
16.8 The following visual basic code asks the user to enter a letter and then uses
Select, Case to identify the position of this letter on the first name. For this
example we consider the first name to be “John”.
16.9 The following is the visual basic code for the Countdown function.
16.10 The following message box is the output of the visual basic program.
Hands-on Exercises
16.1 The following is the visual basic code for this exercise:
16.2 The following is the visual basic code for this exercise:
16.3 The following is the visual basic code for this exercise:
16.4 The following is the visual basic code for this exercise:
16.5 The following is the visual basic code for this exercise:
16.6 The following is the visual basic code for this exercise:
16.7 The following is the visual basic code for this exercise:
16.8 The following is the visual basic code for this exercise:
16.9 The following is the visual basic code for this exercise:
16.10 The following is the visual basic code for this exercise:
16.11 The following is the visual basic code for this exercise:
16.12 The following is the visual basic code for this exercise:
16.13 We created the following tables of data in an Excel spreadsheet:
16.17 The following is the visual basic code for this exercise:
16.18 The following is the visual basic code for this exercise:
16.19 The following is the visual basic code for this exercise:
16.20 The following is the visual basic code for this exercise:
a.
b.
c.
Chapter 17
Review Questions
17. 1 Assigning entry i to entry j of the same array means that entry i and j have the
same value. In the example given, the values stored in the 4th and 10th position of
the array List() are the same.
17.2 To define an array of variables as when defining a variable, one can use the Dim,
Private, or Public variable declarations. However, different from defining a
variable, when defining an array the array’s name is followed by with a set of
parenthesis. If the user knows the size of the array, the corresponding value
goes in the parenthesis.
17.3 Arrays enable the user to store, retrieve and manipulate the data. In particular,
arrays are efficient tools for programming systems with multiple series of data. A
multi-dimensional array can be defined for up to 60 dimensions in VBA.
17.4 When using Option Base 0, the last index of an array is N-1. When using option
Base 1, the last index of an array is N.
17.5 To declare an array of variable size, you could write the following:
17.6 Yes, one can re-dimension an array without loosing the data that is already in the
array. The following declaration is used: ReDim Preserve data(1 to size + size2).
In this declaration the statement ReDim enables re-dimensioning the array to
size + size2. The statement Preserve enables preserving the values that are
already in the array.
17.7 To find the length of a string expression or variable value one can use the
function Len(expression or variable). The function Len() can be used with any
variable data type, however if the data type of a variable is String or Variant, this
function gives the total number of characters in the variable. However, if the
variable data type is integer or double, the Len() function returns the number of
bytes required to store an integer or a double variable.
17.9 To format information in a message box one can use the following function:
Format(Expression, Format)
17.10 The Count property can be applied to the Columns property of a range to count
the number of columns. The following example shows how to count the number
of columns in the range: Range(“A1”,”D1”):
n = Range("A1", "D1").Columns.Count
Hands-on Exercises
17.1 The following is the visual basic code for this exercise:
17.2 The output of the program is 7. The program copies the integer part of the data
presented in the spreadsheet to an array and then presents the value of the fifth
element of the array.
17.3 The following is the visual basic code for this exercise:
17.4 The following is the visual basic code for this exercise:
17.5 The following is the visual basic code for this exercise:
17.6 The following is the visual basic code for this exercise:
17.7 The following is the visual basic code for this exercise:
17.8 The following is the visual basic code for this exercise:
17.9 The following is the visual basic code for this exercise:
17.10 The following is the visual basic code for this exercise:
17.11 The following is the visual basic code for this exercise:
17.12 The following is the visual basic code for this exercise:
17.13 The following is the visual basic code for this exercise:
17.14 The following is the visual basic code for this exercise:
17.15 The following is the visual basic code for this exercise:
17.16 The visual code for the Phonebook application given in the textbook has been
modified. The modifications are circled in red in the figures below.
The following is a new sub procedure created for part (c) of this exercise.
17.17 The following is the visual basic code for this exercise. In building the code we
assume that the distance from city i to j is different than the distance from city j to
i.
17.18 The following is the visual basic code for this exercise:
17.19 The following is the visual basic code for this exercise:
17.20 The following is the visual basic code for this exercise:
Chapter 18
Review Questions
18.1 The following are five User Form controls: labels, textboxes, command buttons,
check boxes, and combo boxes.
18.2 The purpose of using a frame control is to group similar items together. When
frames are applied to option buttons, this makes the option buttons mutually
exclusive.
18.3 Given a date by the user, to find the corresponding day, we would use the Day()
function in Excel.
Day(txtDate.Value)
18.6 A property of the user form is ShowModal. When this property is set to False, the
form becomes modeless, or a floating form.
18.7 A multipage control is the collection of individual form objects, or pages. Each
page can have a different layout and is treated as a separate form.
18.11 In order to check which option button in a frame has been selected follow these
steps: give a name to each option button and then check the corresponding value
property. If the value property is true, the option button has been selected.
18.12 The check boxes placed in the same frame are not mutually exclusive.
18.13 Basic error checking done with the forms are: check if the user entered values in
all the controls and check the type of the data entered.
18.14 To ensure that the program will not continue when the Cancel button is pressed,
we associated with the Cancel button a VB code to unload the form (Unload Me).
18.15 A worksheet is protected setting the Locked property of a range of cells to True.
To enter values in the protected range, one should set the Locked property to
False.
Hands-on Exercises
18.1 The following visual basic code enables modifications of the scroll bar value
when a new value is typed in the textbox and vise versa.
The following sub procedure initializes the form. This sub procedure sets the RowSource
property of the combo boxes and list box, as well the MultiSelect property of the list box.
The following is the code associated with the apply command button.
18.4 The following figure presents the application build for this exercise:
The following is the code for the Initialization procedure:
The following is the visual basic code for the “BOM” frame.
The following is the visual basic code for the “Components of the final product” frame.
18.7 The following figure presents the “Data Analysis” form created for this exercise:
The following figure presents the Registration form build for this exercise:
The following is the visual basic code for this exercise:
18.9 The following is the “Apartment Guide” form build for this exercise:
The following is the visual basic code for the “Employee Information” form:
The following is the visual basic code for the “Modify Employee Information” form:
18.11 The following is the “Loan Manager” frame:
The following is the code associated with the submit command button:
18.12 The following is the “Portfolio Selection” form created for this exercise:
The following is the corresponding visual basic code:
18.13 The following is the “Text Search” form.
The following is the visual basic code:
18.14 The following is the “Airline Travel” form created for this exercise.
We set the spreadsheet with the results from the search as follows:
19.1 Before using Solver functions in a program, one must reference the Solver library
in the VBE.
19.2 The SolverSolve function returns an integer value classifying the result. Therefore,
the variable Result will take one of the following values: 0, 1, 2, 4 or 5. Note that,
0, 1 or 2 signify a successful run in which a solution has been found. The value 4
implies that there was no convergence, and the value 5 implies that no feasible
solution could be found.
19.5 It is a good idea to use the SolverReset function before any of the Solver functions
are used.
19.8 The KeepFinal argument is used with SolverFinish function. KeepFinal argument
takes the value 1 if you want to keep the Solver solution and the value 2 if you
want the previous values to be kept.
19.9 The ShowRef is an argument of SolverSolve function. This argument is used when
the StepThru option is set. One can pass Solver a macro to run at each pause by
using the ShowRef argument of the SolverSolve function.
19.10 Yes arrays can be set to Control data type. Suppose UserControl(1 to n) is an
array of controls and cmbUser1,…, cmbUsern are n different frames (controls).
We initialize this array as follows:
Set UserControl(1) = cmbUser …
Set UserControl(n) = cmbUsern
Hands-on Exercises
19.1 The optional code to be added to the frmParam form cmdOK_click procedure in
order to hide the rows in the spreadsheet based on the number of decision
variables chosen by the user, is:
19.2 The following are the decision variables for this problem:
The objective is to minimize the total cost of painting. Therefore, it is equal to:
=SUMPRODUCT(F2:F4,B2:B4) + SUMPRODUCT(F5:F7,B7:B9) +
SUMPRODUCT(F8:F10,B12:B14)
Furthermore, we update the table above to present the profit per batch.
X11 the number of officers that start working on the 1-st shift and work 12 hours
X12 the number of officers that start working on the 1-st shift and work 18 hours
X21 the number of officers that start working on the 2-nd shift and work 12 hours
X22 the number of officers that start working on the 2-nd shift and work 18 hours
X31 the number of officers that start working on the 3-rd shift and work 12 hours
X32 the number of officers that start working on the 3-rd shift and work 18 hours
X41 the number of officers that start working on the 4-th shift and work 12 hours
X42 the number of officers that start working on the 4-th shift and work 18 hours
Note that: the Linked cell of the textboxes are set as follows: the Linked cell for the
textboxes that present the number of officers required are set equal to cells G15 to G18.
The Linked cell for the hourly rates is set equal to cells B2 and B3 respectively.
The constraints imply that the requirements in each period should be met:
Period 1: 5 + 0.5*X1 = 30 + I1
Period 2: I1 + 0.5*(X1 + X2) = 15 + I2
Period 3: I2 + 0.5*(X2 + X3) = 25 + I3
All variables are non-negative.
19.20 Problem formulation can be found in the solutions for chapter 8 (hands-on
exercise 8.21).
20.1 To generate random numbers from Exponential distribution we use the following
formula:
‘=(-1/Lambda)*ln(RAND())’
20.2 The following distributions have inverse functions: Beta (BetaInv); Chi (ChiInv);
F (FInv); Fisher (FisherInv); Gamma (GammaInv); Lognormal (LogInv); Normal
(NormInv); Standard Normal (NormSInv); T (TInv).
20.4 The code used to activate the screen updating functionality in VBA is
ScreenUpdating = True
For i = 1 to 100
ScreenUpdating = False
Range(“A1”).Offset(i,0) = (-1/Lambda)*ln(RAND())
ScreenUpdating = True
Next i
20.8 No, it is not possible to “pause” the VBA code while it is running. If you wanted
to incorporate a feature like this, you would have to create a user interface which
allows the user to “play” the simulation one loop at a time.
20.9 Results for each run should be recorded during the simulation loop.
Hands-on Exercises
20.1 The following is the visual basic code for this exercise:
20.4 In this exercise we use the 4-periods moving average method to forecast next
period’s sales. The following presents the excel spreadsheet:
The following is the corresponding visual basic code:
20.5 The following is the visual basic code for this exercise:
20.6 The following is the visual basic code for this exercise:
20.7 In tossing the dice 5 times, the total number of outcomes is 65.
The total number of 4-straights is 62. The following are all the cases when we get
a four straight:
1,2,3,4,X; X can take values 1 to 6
2,3,4,5,X; or 3,4,5,6,X; or X,1,2,3,4; or X,2,3,4,5; or X, 3,4,5,6;
20.16 The following is the user form created for this exercise:
The following is the corresponding visual basic code
20.17 The following presents the Excel spreadsheet created for this exercise.
The following is the corresponding user form:
Hands-on Exercises
22.1 Syntax errors are created by: misspelling words in variables or ranges, forgetting
to declare variables, forgetting to initialize counting variables or range variables,
forgetting to dimension arrays before using them, or misnaming user form
objects.
Runtime errors are user-created errors. For example, the users may delete cells
whose names are referenced in the code, input data incorrectly, or press buttons in
a different order than you intended.
Logical errors are created by improper use of properties or methods. Logical
errors are usually found in loop structures, especially nested loops. For these
errors, the code runs without a problem, but the results are inaccurate.
22.2 The Step-Into stepping code is used to execute every line of code. The Step-Over
tool will skip over code called procedures. The Step-Out tool is also used
primarily with called procedures. If you are stepping through a procedure in
which another procedure is called, use Step-Out tool to finish executing all of the
code in this called procedure at once and return to the main procedure.
22.3 The difference between step-over and step-out is that when the step-over tool is
used it skips a code called procedure/loop; while the step-out is usually used
inside a the called procedure/loop and it finishes the execution of the called
procedure/loop and returns the user to the main procedure.
22.4 The breakpoint is a tool that allows you to execute code in normal run time until
the point in which the breakpoint is located in the code; at this point the code is
paused. This procedure helps with debugging the code. It can be used when the
user wants to check a particular part of the code for possible errors. In this case,
the user would set breakpoints at the part of the code s/he is concerned about. The
execution of the previous lines of the code will be quickly and then at the
breakpoint the code pauses allowing the user to step through.
22.5 The IsEmpty function is used to check whether or not a variable has been
initialized.
22.6 While the The IsEmpty function is used to check whether or not a variable has
been initialized, the IsNull function checks whether or not a variable has a valid
value.
22.7 The GoTo command is used to skip part of a code and go to a specific procedure.
22.8 An example when the user would get an error message is the following. Suppose
an input box is used to receive a numerical value from the user. This value would
be then assigned to an integer variable. If the user entered a string instead, we
would get an error. The error number in this case is 13. This signifies type
mismatch.
22.9 A Line label is used to label a line of code. To add a line label to the code, one
would type the label followed by a colon in the beginning of the line of code.
22.10 The On Error statement should be placed before a line of code in which an error
may occur.
Hands-on Exercises
Deleted: ¶