Vous êtes sur la page 1sur 260

Indian Institute of Management

Ahmedabad

IIMA/CISG0104TEC

Spreadsheet through Examples:


Microsoft Office Excel 2007 Version

V. Venkata Rao
June 2012

Written by Professor V Venkata Rao, Indian Institute of Management, Ahmedabad


2009 by the Indian Institute of Management, Ahmedabad. Revised June 2012.

Page 2 of 260

IIMA/CISG0104TEC

Table of Contents
I. Essential Features of Excel ........................................................................................................................ 5
I.1 Structure of an Excel File. ............................................................................................................... 5
I.2 Ranges and range names ................................................................................................................. 6
I.3 How to select a cell or range for data and formula entry ............................................................. 7
I.4 How to enter numbers, text, dates, and formulae .......................................................................... 7
I.5 Array formulae ................................................................................................................................. 8
I.6 How to copy a formula from one range to another ....................................................................... 8
I.7 Relative and absolute referencing .................................................................................................. 9
I.8 Attaching user comments to cells .................................................................................................... 9
II. EXAMPLES ............................................................................................................................................ 12
II.1
Example 1. Weekly wage computation ..................................................................................... 12
II.2.
Example 2. Comparison of two sales commission plans ........................................................ 19
II.3
Example 3. Extension to Example 2 ........................................................................................ 21
II.4
Example4. Investment Analysis ............................................................................................... 22
II.5
Example 5. Computation of shipping cost ............................................................................... 26
II.6
Example-6. Matrix Arithmetic: A Problem in Economic Planning. .................................... 29
II.7
Example 7. Regression Estimation: Literacy Rate and Per Capita Income ........................ 31
II.8
Example-8. Queries on a Personnel Data Base ....................................................................... 33
II.9
Example -9. Sales Revenue Query: Handling Complex Queries. ............................................. 38
II.10 Example-10. Bishops Move....................................................................................................... 40
II.11 Example-11. A Preventive Maintenance System....................................................................... 44
II.12 Example-12. Time-Study Data .................................................................................................. 47
II.13 Example-13. To Change the Date Display Format in a Cell or a Range. .................................. 50
II.14 Example-14. Modification of Part Codes .................................................................................. 52
II.15 Example-15. An Optimal Product Mix Problem .................................................................... 56
II.16 Example-16. How to solve Transportation Problems with Excel. .......................................... 60
II.17 Example-17. Determination of Sample Size ............................................................................. 67
III.
Exercises-I ....................................................................................................................................... 71
1. A Copying Problem ........................................................................................................................... 71
2. An NPV Question. ............................................................................................................................. 71
3. A Four-Year Investment ................................................................................................................... 72
4. Distances On a Square Grid ............................................................................................................. 73
5. A Simple Lookup ............................................................................................................................... 74
6. Data Table for Frequencies .............................................................................................................. 74
7. Length of Employment ...................................................................................................................... 75
8. Cash Flow Analysis............................................................................................................................ 75
9. Retirement Benefits ........................................................................................................................... 76
10. Households below Poverty Line. ...................................................................................................... 77
11. Evaluation of Job Applicants............................................................................................................ 77
12. Publishing Game ................................................................................................................................. 78
13. Centigrade to Farenheight.................................................................................................................. 78
14. Number of Passes. ............................................................................................................................... 79
15. Components of a Name ....................................................................................................................... 79
16. Integral Solutions. ............................................................................................................................... 80
17. City-based Sales Tax ........................................................................................................................... 80
18. Tuition Fees ......................................................................................................................................... 81
19. Top-30 of Management Times ............................................................................................................ 81
20. Weights for the Composite Score. .................................................................................................... 83
21. Queen on a Chess Board. .................................................................................................................. 84
22. Knight on a Chess Board. ................................................................................................................. 84
23. Coded Marks List. ............................................................................................................................. 85
24. Rating of Cars. ................................................................................................................................... 86
25. Gas Cylinder Booking ....................................................................................................................... 86
26. Cricket. ............................................................................................................................................... 87
27. Guess the Cell Address. ..................................................................................................................... 87
28. Missing first value in cash flow......................................................................................................... 88

Page 3 of 260

IIMA/CISG0104TEC

29. VLOOKUP Exercise.......................................................................................................................... 88


30. Sequential Activities in a Project...................................................................................................... 89
31. Commonwealth Games. .................................................................................................................... 90
32. Election Results. ................................................................................................................................. 90
33. Late Assignments. .............................................................................................................................. 91
34. Software Project management.......................................................................................................... 92
35. Ahmedabad Auto Fare Card. ........................................................................................................... 93
36. Apartment Prices ............................................................................................................................... 94
37. Expiry Dates ........................................................................................................................................ 95
38. Vacant Property Project ................................................................................................................... 96
39. Hotel Charges..................................................................................................................................... 97
40. Due Date for Next Maintenance ....................................................................................................... 98
41 Plots for Political Fasting .................................................................................................................. 98
IV.
Exercises-II .................................................................................................................................... 102
1. Savings Bank Account. ...................................................................................................................... 102
2. Price Discount. ................................................................................................................................... 102
3. A School Project................................................................................................................................. 103
4. Comparison of Vendor Quotations. .................................................................................................. 103
5. Promotion policy ................................................................................................................................ 103
6. Income Tax Computation .................................................................................................................. 104
7. Vegetable Prices ................................................................................................................................. 104
8. Weekly Wage Bills ............................................................................................................................. 105
9. Sales Commission Problem ............................................................................................................... 106
10. All-Unit Discount. ............................................................................................................................. 106
11. Profit And Loss Projection For ATC. .............................................................................................. 107
12. Evaluation Of A Product Mix Plan .................................................................................................. 107
13. Choice Of A Maintenance Contract ................................................................................................. 108
14. A Materials Requirements Planning (MRP) Problem..................................................................... 109
15. A Project Appraisal Problem ........................................................................................................... 110
16. Problems In Materials Management................................................................................................ 111
16.1. Lead Time Analysis.................................................................................................................... 111
16.2. Vendor Analysis: ........................................................................................................................ 111
16.3. Consumption Budgeting ............................................................................................................ 112
17. Analysis Of Purchase Order Data Base .......................................................................................... 112
18. A Macro For Exhibiting Range Name Table ................................................................................... 113
19. A Capacity Planning Problem .......................................................................................................... 113
20. Sales Territory Allocation................................................................................................................. 115
21. Macros for Range Formatting. ......................................................................................................... 115
22. A Grpah Plotting Macro................................................................................................................... 115
23. Journal Subscription Charges .......................................................................................................... 116
24. A Prototype Library Fine Management ........................................................................................ 116
24. Number of Retirements ................................................................................................................... 117
26. Multiplex Movies ............................................................................................................................. 118
27. Checkdigit Validation...................................................................................................................... 120
28. Bin Packing Problem ....................................................................................................................... 122
29. Medal Tally in Atlanta Olympics .................................................................................................. 124
30. Weather Statistics ............................................................................................................................ 128
31. A Pass-Fail Problem ........................................................................................................................ 128
32. Sugar beet production ..................................................................................................................... 129
33. Accessibility Matrix ......................................................................................................................... 129
34. A dieting problem ............................................................................................................................ 130
35. Armstrong Numbers........................................................................................................................ 130
36. Pythagorean Triplets ....................................................................................................................... 130
37. Birthday Paradox ............................................................................................................................ 130
38.Job Scheduling on a Single Facility ................................................................................................. 131
39.Flight Schedules in Ahmedabad ...................................................................................................... 134
40. Gender Based Income Tax .............................................................................................................. 136
41.Customer Service at Pizza Kutir ..................................................................................................... 138
42. Fibonacci Series. .............................................................................................................................. 143
43. Matrix Search .................................................................................................................................. 144

Page 4 of 260

IIMA/CISG0104TEC

44. The Graph Colouring Problem ...................................................................................................... 144


45. Euler Graph ..................................................................................................................................... 148
46. Number of minima .......................................................................................................................... 150
47. Conversion of Primal LP to Dual LP ............................................................................................. 151
48. Assembly Line Planning .................................................................................................................. 154
49. Attendance Records......................................................................................................................... 155
50. Conference Budget .......................................................................................................................... 156
51. Top 100 of Forbes 2000 ................................................................................................................... 157
52. Optimal Machine Operation........................................................................................................... 161
53. Distances between villages .............................................................................................................. 161
54. Pre-Paid Taxi Service ...................................................................................................................... 162
55. Fruit Prices ....................................................................................................................................... 166
56. Cheapest Neighbor Heuristic for TSP ......................................................................................... 168
57. Formatting the tsprange in Cheapest Neighbor Heuristic for TSP .......................................... 170
58. Hello Zindagi .................................................................................................................................... 173
59. Flaming Red Pickles Company, Andhra Pradesh. ....................................................................... 174
60. Telephone Bills Analysis ................................................................................................................. 176
61. Crop Water Requirements in a Command Area .......................................................................... 181
62. To compute the Retirement Benefits at XYZ Co .......................................................................... 183
63. Voluntary Retirement Scheme ....................................................................................................... 184
64. Fitness Centre Management. ......................................................................................................... 185
65. Exam Results in VBA ...................................................................................................................... 189
66. Sudoku Support System .................................................................................................................. 192
67. Vector Rotation ................................................................................................................................ 199
68. Data Analytics for Shoe King. ....................................................................................................... 199
69. Magic Square Generation. .............................................................................................................. 203
70. Forward-Pass Algorithm in a Project Network. ........................................................................... 208
71. Eclipse Tourism. .............................................................................................................................. 211
72. Electricity Bills ................................................................................................................................. 216
73 Hotel Tariff ........................................................................................................................................ 220
74. A Greedy Heuristic for the Assignment Problem ......................................................................... 222
V. Appendices ............................................................................................................................................. 227
Appendix-1a: Menu Options in Excel for some important tasks ...................................................... 228
Appendix-1b: Keyboard Shortcuts ...................................................................................................... 231
Appendix-2: Mathematical Functions ................................................................................................. 232
Appendix-3: Statistical Functions .......................................................................................................... 234
Appendix-4a: Text Functions ................................................................................................................. 236
Appendix-4b: Illustration of Text Functions ......................................................................................... 238
Appendix-5: ANSI Character Set .......................................................................................................... 239
Appendix-6a: Date and Time Functions ................................................................................................ 240
Appendix-6b: Illustration of Date and Time Functions ..................................................................... 241
Appendix-7: Database functions .......................................................................................................... 243
Appendix-8: Lookup Functions ............................................................................................................ 244
Appendix-9: Some Excel functions whose inputs and/or outputs are arrays. ............................... 253
Appendix-10: IS Functions ................................................................................................................... 254
Appendix-11: Error Codes ................................................................................................................... 255
Appendix-12: Solver Options ............................................................................................................... 256
Appendix-13: Normal Distribution ...................................................................................................... 258

Page 5 of 260

IIMA/CISG0104TEC

Spreadsheet through Examples


A spreadsheet package offers its user a screen interface with a large rectangular grid of cells,
formed by the intersection of several rows and columns. In solving a problem, a user can fill some
of these cells with input data consisting of numbers, text or dates, and some others with formulae
referring to the input cells directly or indirectly. The spreadsheet software (to be referred to as the
system) evaluates the formulae to generate the output. Most computational problems dealt with by
managers can be readily cast in a spreadsheet format. Even a non-technical user can experiment
with such spreadsheets easily and produce solutions to the corresponding problems. Spreadsheets
are quite popular among managers chiefly because spreadsheets are much more flexible than
conventional tools for modelling decision problems.
Spreadsheet software is important not only because it serves as a powerful computational aid, but
also because it enables decision-makers do what-if analysis in many decision contexts. Examples
for what if analysis are to analyse the effect of a change in exchange rate on the projected cash
flows of a joint venture; and, to project the effect of an increase in demand on the profit and loss
account of a company.
Further advantages of a spreadsheet package are its ability to serve as a front-end to facilitate user
input and output in a complex software system, and its ability to summarize, view, and retrieve
data in a variety ways
Spreadsheet is a generic term. There are several commercial packages that offer the spread sheet
features. Some of these are LOTUS 1-2-3, QUATTROPRO, and Microsoft EXCEL. In this note,
we present a number of decision problems and their solution through EXCEL.By default, the
features discussed refer to the EXCEL 2007 package operating under MS Windows.
Initially, we describe a few important preliminary details regarding the Excel package. We
assume that the reader is familiar with the basic features of the Windows 95 system, with how to
invoke the Excel package, and how to save and retrieve files. It is not the intention of this note to
cover all the features nor all the built in functions of Excel. Only those aspects of Excel which
will be of interest to students of management, especially to the beginners, will be introduced. For
further details, we urge the reader to refer to the on-line help of the Excel system or to Excel
manuals.
I. Essential Features of Excel
I.1
Structure of an Excel File. An Excel file as seen in windows is a set of spreadsheets,
called worksheets. This set of worksheets is called a workbook. The name of a workbook is the
same as the name of the corresponding file in windows. The names of the worksheets are by
default sheet1, sheet2 etc.
As soon as the Excel system is invoked, the standard Excel window appears on your PC screen
with the following menu items on the menu bar: File, Edit, View, Insert, Format, Tools, Data,
Window, Help. The default workbook is Book1, and the default worksheet open is sheet1. You
can click on the menu item File to open an already stored workbook. Within an open workbook,
at the bottom of the window you can see a series of tabs one for each worksheet within the
workbook. Click on any of the worksheet tabs to open the corresponding worksheet. To change
the name of a worksheet double click on its tab, and type the new name. You can enter different
types of data in different worksheets to structure your problem well. You can do computations
based on data in several different worksheets together.

Page 6 of 260

IIMA/CISG0104TEC

Each worksheet is exhibited by default with horizontal and vertical borders. The horizontal
boarder exhibits a column label, formed with one or two alphabetic characters, and the vertical
boarder exhibits a row number for each row. A worksheet in Excel 2007 has totally 18,278
columns, denoted with labels A, B, C, , Z, AA, AB, ,ZZ, AAA, AAB , ZZZ; and,
10,48,576 rows, denoted with numbers 1,2, , 65536. A cell of a worksheet is referred to with its
cell address, which is formed by the string column label of the cell followed by its row number.
Thus the address of the cell at the intersection of column BC and row 104 is BC104. From a
worksheet, say sheet1, if you want to refer to a cell, say AC35, of another worksheet, say sheet3,
use the reference as sheet name followed by exclamation mark followed by the cell address; that
is in the example the reference should be sheet2!AC35. Similarly, from a worksheet you can also
refer to a cell in a worksheet of another workbook; for such a reference use the string book name
in square brackets followed by worksheet name followed by the exclamation mark followed by
the cell address. Thus the reference [BOOK3]sheet4!A4 denotes cell A4 of the worksheet named
sheet4 in the work book named BOOK3.
The interactive screen consists of the spreadsheet grid and on the top the menu ribbon. It is in the
menu ribbon that all the menu options are listed and presented in the form of groups. For
performing several tasks the appropriate menu option has to be clicked. The ribbon consists at its
top the menu tabs. When tab is clicked beneath it appear several rectangular tiles, each consisting
of a set of menu options for a group of tasks. The name of each group appears at the bottom of the
corresponding tile. In some cases, when a menu option is clicked a dialog box appears to get
further information from the user. In this note, while describing a menu option, we mention the
tab label followed by the group label followed by the menu option as follows:
Tab label

Group lable

Menu option

I.2
Ranges and range names. A rectangular set of contiguous cells is called a range. Ranges
are quite useful to deal with several items together. A range is referred to by its range address,
which consists of the address of the top left cell of the range followed by the colon mark followed
by the address of the bottom right cell of the range. Thus the range address A1:C3 refers to the
range composed of the cells A1, A2, A3, B1, B2, B3, C1, C2, C3.
To make referencing a cell or a range easy, Excel allows you to assign a name to a cell or range
and use its name or its address to refer to it. To assign a name to a cell or a range follow the two
steps:
1

Click the menu option: Formulas

Defined Names

Define Name.

Type the name to be assigned in the name box; enter the range address or formula to
which the name applies in refers to box; and click the buttons OK.

Alternatively, select the cell or range which you want to name, and right click the mouse. In the
box of command that appears, click the option Name a Range.
Instead of specifying a range name on-line, you can type them in the spread sheet itselfin the
immeadiate left, or immediate right column of the cells to be named, or on the row immediately
above or below the cells. In such case, choose, the set of cells along with the cells containing their
names and use the menu option: Formulas Defined Names Apply Name. In the resulting
dialog box, you can specify the location of the names.
Suppose you have assigned names to several ranges and have forgotten which name refers to
which range. You can see a table of range addresses and their corresponding names by clicking
the menu option: Formulas Defined Names Name Manager:

Page 7 of 260

I.3

IIMA/CISG0104TEC

How to select a cell or range for data and formula entry

Before you can enter data into a cell or range the corresponding cell or range has to be first
selected. We describe here two different ways of selecting a cell or range.
Position the mouse pointer on the cell of your choice and click the left mouse button to select the
cell. After selecting a cell, you can type in your data ended by the pressing of the Enter key, to
enter the data into the selected cell. For selecting a range, instead of a cell, select the first, i.e. the
top left, cell of the range by clicking on it, and then keeping the left mouse button pressed, drag
the pointer over the other cells of the range, and then release the mouse button.
Except in small problems, or when the cell you want to choose is close to your present cell, the
above method is not particularly convenient. An alternative way of selecting a cell or range is by
specifying its address or name. In this method, first select the menu options Home
Editing
Find and Select
GoTo. In the resulting dialog box, type in the name and address of the cell
or range in the corresponding boxes, and then click OK. The specified range will automatically be
highlighted.
I.4

How to enter numbers, text, dates, and formulae

While entering a number, text, or date into a cell make sure you end the entry by pressing the
Enter key. Numbers and text can be straight away entered without causing any confusion. Dates
can also be entered straight away using any of the standard formats such as mm/dd/yy, mm-ddyy, or dd-mmm-yy. In most cases, the system has enough intelligence not to confuse between a
date and text, and a date and number. At times, however, there could be some confusion between
the day number and month number in interpreting a date. To avoid such a confusion, enter dates
always in the date format chosen through the control panel of the windows system. In Windows
95 system, this format can be set or changed through the menu options StartSettingsControlPanelRegional SettingsDate.
For entering a formula, you need to prefix the formula by the equal to (=) symbol. Suppose the
entry in cell A1 is 4 and you want to get into A2 the value twice that of A1. The formula that you
need to enter into A2 for this purpose is 2*A1. To enter the formula, select cell A2, and type in
=2*A1, followed by enter key. On finishing the above entry, what you see in A2 is not the
formula but its result, that is the value 4. The formula itself is shown in the formula bar, which is
situated above the horizontal border.
It is important to note that what is displayed in a cell is not necessarily identical in looks to what
you might have entered into the cell. The display is obviously governed by the contents of the cell
but the same contents can be displayed in various different formats. For example, depending on
the format chosen, the cell entry 1234.343 can be displayed in any of the following formats:
1234.343
1234.34
1234
$1234.34
$1,234.34
Further examples are: the entry 0.25 can be displayed as 25%, and the entry 1 as 1/1/1900.
To choose or change the display format of a cell, the menu options to be chosen are:
Home

Number

Page 8 of 260

IIMA/CISG0104TEC

Note however that no matter what the format of display of a cell, its contents remain unchanged,
until you explicitly edit the contents. It is the contents that will be used in evaluating a formula
that refers to the cell.
It is also possible to change the colour of the characters in a cell, background colour of the cell,
and the orientation of display of the entry in a cell; for these, first select the desired cell or range,
and then choose Home
Font for colour changes for foreground and background, and Home
Alignment Orientaion, for changing the orientation of display of the characters.
I.5
Array formulae. There are some formulae, which give as output multiple values. These
formulae are called array formulae. An example is a formula that computes the inverse of a
matrix. In such a case, the method of entry of the corresponding formula is different. First
highlight the range that is to contain the output of the formula; then, type in the array formula in
the first cell of this range, and end it by pressing the three keys Control, Shift and Enter together.

I.6

How to copy a formula from one range to another

Suppose you need to compute the profit


of a company for three consecutive years
in cells A3, B3, and C3 given the
A
B
C
corresponding revenues in cells A1, B1
1
and C1, and costs in A2, B2, and C2. The
2
formulae for profit to be entered in cell
3 =A1-A2
=B1-B2 =C1-C2
A3 is =A1-A2; the formula in cell B3 is
=B1-B2; and that in C3 is =C1-C2. A
beginner might enter these formulae
explicitly in each of the three cells. When
the formulae in adjacent cells are similar
in the sense that the formulae are the same except that the row labels and column numbers of the
cell references in the formulae differ correspondingly, there is an alternative way of achieving the
same effect as above. In this method, enter the formula explicitly only in the first cell of the range
of interest to you. Then copy this formula to the other cells of the range. Follow the steps below to
do the above copying:

Select the source cell, which is A3 in this example.


Select the menu options Home Clipboard Copy;
Select the destination of your copied formulae, which is the range B3:C3 in this example.
Choose the menu options Home Clipboard Paste

At the end of the above steps, you will notice that the destination cells chosen above are filled
with formulae, which are the same as the source formulae in A3, with cell reference adjusted in a
corresponding way. For example, when the destination cell is in the same row as the source cell,
but one cell to its right, then all the column labels in the source formula will be replaced by the
next labels to get the destination formula, while the row numbers remain unchanged. When the
destination is in the same column and one cell above with respect to the source cell, all the row
labels in the source formula are decreased by one to get the destination formula while the column
labels remain unchanged. It is important to remember in the above process that you should not
attempt to cross the maximum possible values of row label, IV, and column number 65,536;
otherwise the error message #REF! would result.
Consider another example in which the unit cost of production of an item is given in cell A1, and
the quantities of production on three consecutive days of the product in cells A2, B2 and C2. You
are required to find in cells A3, B3, and C3 the total cost of production of the product on the three
days respectively.

Page 9 of 260

IIMA/CISG0104TEC

I.7
Relative and absolute referencing. Suppose, following the procedure of the previous
example, you enter in cell A3 the formula =A1*A2, and copy it into cells B3 and C3. As a result
of this copy operation you will notice that the formulae resulting in cells B3 and C3 would be
=B1*B2 and =C1*C2. These formulae are clearly wrong because the unit price should remain
constant during the three days. The correct formulae in cells B3 and C3 should be =A1*B2, and
=A1*C2 respectively. During the copy operation, the first cell reference in the source formula
should not change whereas the second reference should change. To accomplish this, type the
formula in cell A3 as
=$A$1*A2
or
$A1*A2
Now copy this formula into cells B3 and C3 to get into them the formulae:
=$A$1*B2 and =$A$1*C2

or

$A1*B2 and =$A1*C2

The use of $ sign in a cell reference is called absolute referencing of the cell, and the absence of it
is called relative referencing. $ in front of column component of the address makes column
absolute; in front of row component makes row absolute; and $s in front of both make both row
and column absolute.
Note that the value of a formula remains the same irrespective of whether you use relative or
absolute referencing for its cell addresses. For example, the formula =A1 will be evaluated to the
same value as the formula =$A$1 or $A1. Therefore, the mode of cell referencing in a formula
influences not the value of the formula, but the way the addresses get modified when the formula
is copied to other cells. Thus, a choice between the two modes of addressing becomes relevant
only when you intent to copy the formula to other cells; otherwise, you can simply use relative
referencing.
I.8
Attaching user comments to cells. You may find it useful to attach to a cell some notes,
explaining the formula behind the cell or simply explaining its contents. Such documentation
would be very essential in complex spreadsheets. A comment box can be attached to any desired
cell, a comment can be entered into it and edited. The comment box can be designed such that it
would appear only when the mouse pointer is placed on the cell. The steps to be followed for the
above purpose are:
Select the cell to which you want to attach a comment.
Right click the mouse.
From the menu options that appear select Insert a comment.
Enter the comment in the box that appears.
Click outside the box to close the comment and the box.
If you want to see the comments only when the mouse pointer is placed on the cell with a
comment and right click the mouse button; in the options that appear choose show/hide comment.,
select the
You can edit or delete the comment by once again right clicking on the cell and choosing the
appropriate menu item.
The above operations can also be performed through the menu ribbon; the corresponding options
are: Review Comments

Now, the note presents you with several examples through which you can learn some of the most
useful and interesting features of Excel. Each of the examples introduces you to a different set of
features. You are required to enter the suggested solutions into your own PC and make sure that

Page 10 of 260

IIMA/CISG0104TEC

they work. Note that none of the suggested solutions is unique; for each problem several
alternative solutions exist. You are encouraged to think of the alternative designs, and test them
out.
It is the authors firm belief that the best way of learning Excel is to attempt various problems on
Excel, rather than trying to read books on excel. The best reference on the features of Excel is the
Excel Help which can be accessed by pressing F1 key while operating the package. The help
describes not only various features, but, wherever needed, gives examples.

Page 11 of 260

IIMA/CISG0104TEC

II. EXAMPLES

Page 12 of 260

IIMA/CISG0104TEC

II. EXAMPLES
II.1

Example 1.

Weekly wage computation

Suppose you are given the following data related to a week on each employee of a company:
i.
ii.
iii.
iv.

Employee code
Hours worked during the week
Basic wage in Rupees per hour
Number of pieces produced

Further, the following data that applies to all employees is also given:
i.
ii.

Standard rate of production in number of pieces per hour


Extra pay (or, incentive pay) for each piece produced over and above the standard
production, in Rupees per piece

Design a spreadsheet to contain the above data, and to compute using this data the following:
i.
ii.
iii.
iv.
v.

For each employee, the regular pay for the week


For each employee, the incentive wage, if any, for the week
For each employee, the total pay for the week
For all the employees put together, the sum of regular, incentive, and total pay
The sum of incentive pay as a percentage of the sum of total pay.

Figure-1a shows an Excel spread sheet for a sample of five employees. This sheet consists of four
areas:
i.
ii.
iii.
iv.

Title of the sheet in rows 1 and 2


The parameters section in the range A3:D5; this consists of the values of the two
parameters, standard rate of production, and incentive wage per extra piece produced.
The employee data in the range A11:H15; the range A6:H 10, and the range A16:H16 are
used for column headings and dividing lines.
Overall statistics on pay roll data in the range F17:H18.

Note that the data in columns titled EmpCode, Basic Wage, Hrs worked, and Pcs produced is to be
input by you. Similarly, the values of standard rate of production is to be input in cell D4, and that of
incentive wage rate in Rs per piece is to be input in cell D5. The other values are computed by the
software, through the formulae, shown in Figure-1b.
These formulae are devised based on the following rules:
i. Extra production

=
=

Maximum of {(actual production- standard production),0}


Maximum of {actual number of pieces produced-hours
worked*standard rate of production),0}

ii.Regular pay

Basic wage in Rs per hour * hours worked

iii.Incentive pay

Extra production * incentive rate in Rs per piece

iv.Total pay

Regular pay + incentive pay.

The formulae shown in Figure-1b are self- explanatory. Consider the formula in cell E11, for
example. This formula is devised to compute the extra number of pieces produced by employee E1.

Page 13 of 260

IIMA/CISG0104TEC

From formula i shown above, we need to compute the maximum of two quantities; this is done by
the MAX function. Of the two quantities involved, the first one is the difference between actual
production, given in cell D11, and the standard production; the standard production in turn is
obtained by multiplying the standard rate of production, given in cell D4 with the number of hours
worked, given in cell c11. The formula for the first quantity is D11 - D4 * C11; however, note that
D4 is written in Figure-1b as $D$4, which is nothing but absolute referencing of that cell. The
absolute referencing is used so that when this formula is copied to corresponding cells of other
employees, the address of the parameter does not change. The second quantity inside MAX is the
constant 0. Thus, the entire formula in E11 is MAX((D11-$D$4*C11),0). This formula is copied to
cells in the range E12:E15 to obtain formulae for extra production for each of the other employees.
Figure-1a. A spread sheet for wage computation
A

Wage Computation Example

2
3 Paramtrs:
4 1. Std Rt (Pcs/hr)

10

5 2. Incnt Rt (Rs/piece)

6
7

Emp

Code

Basic

Hrs

Pcs

Extra

Pay

Pay

wage worked produced

productn

regular

incntv

totl

(Rs)

(Rs)

(Rs)

(Rs/hr)

Pay

10
11

20

40

440

40

800

200

1000

12

25

48

530

50

1200

250

1450

13

25

56

490

1400

1400

14

20

32

350

30

640

150

790

15

30

40

350

1200

1200

Totals:

5240

600

5840

16
17
18

Incntv/totl as %:

Figure-1b. Formulae in the spread sheet of Figure-1a


Cell

Formula

Comments

E11

=MAX(D11-$D$4*C11,0) Copied to E12:E15

F11

=B11*C11

Copied to F12:F15

G11

=e11*$D$5

Copied to G12:G15

H11

=F11+G11

Copied to H12:H15

F17

=SUM(F11:F15)

G17

=SUM(G11:G15)

H17

=SUM(H11:H15)

H18

=100*G17/H17

10.27

Page 14 of 260

IIMA/CISG0104TEC

Example 1.1 Weekly Wage Computation: Extension-1.


Suppose, the problem remains the same as in the previous case, with the following difference: the
basic wage in Rs/hour for a worker is not directly known. All employees are divided into five
types, A,B,C,D, and E. The basic wage varies from one type to another as shown in the following
table:
Employee Type Basic Wage in Rs/hour
A
20
B
25
C
30
D
40
E
45
For each employee in question, her or his type is given as input. With other rules remaining the
same before, compute the regular, incentive, and total wage for each employee and the grand total
incentive wage as percentage of the grand total of total wage.
The spreadsheet for this extension is shown in figures 1.1a and 1.1b.
This solution consists of one new step, namely to get the basic wage in Rs/hr by using the type,
given as input in column B. The basic wage is obtained in column C. To facilitate this step, the
table for Basic wage corresponding to each type is given in the range K7:L11. The basic wage for
a specific employee is obtained by looking up the this table, using the value in the type field as the
lookup value. The table lookup is accomplished through a formula. The formula for the first
employee is entered in cell C11; then it is copied to cells C12:C15 to get the formulae for the
remaining employees. This formula is:
=VLOOKUP(B11, $K$7:$L$11,2,FALSE)
The V in the VLOOKUP in the above formula denotes that the lookup table is vertical: the keys,
A,B,C,D, and E are in a column and so are the corresponding values for Basic Wage.
The first argument in the above formula denotes the lookup value: the lookup value, the type of
employee E11 is in cell B11, and hence the first argument of the above VLOOKUP function is
B11.
The second argument indicates the range of the lookup table, which is K7:L11. This address is
surrounded in $ symbols, because the range remains the same, even for other employees. Lookup
involves going down the first column of keys in the lookup table to find which of them is
matching with the given lookup-value. In this case, the lookup-value is E, and this is found to
match with the key of the fifth row of the lookup-table.
The idea of lookup is to take as result a value from the matching row; which column of the
matching row has the result is specified as the third argument. The third argument in this case is
2, implying that the result of the lookup is contained in the second column of the matching row,
that is the second column of the fifth row. So, the result of the vlookup is 45, which is the value
of the second column of the matching row of the lookup table.
Range lookup in VLOOKUP. What happens if the lookup value does not match with any of the
keys in the lookup table? In this case, lack of a match implies an error in the lookup value, and
hence an error needs to be indicated. However, in some other contexts, if no exact match is
obtained, one of the closest keys is taken as the matching value, and such a lookup is called
range-lookup. Whether or not we need range-lookup is indicated as the fourth argument of the
VLOOKUP function: FALSE implying that range-lookup is not to be used (which means only

Page 15 of 260

IIMA/CISG0104TEC

exact match is needed, and otherwise an error is to be reported), and TRUE implying that rangelookup is to be used (which means that if exact match is not found an approximate match, as per a
rule, is to be found). In the present context, an exact match is needed and hence FALSE is given
as the fourth argument.
Range look up is also needed when the range of lookup keys is very large, and divided into
intervals. Each key given in the first column of the vlookup table corresponds to an interval. and
as a part of the search, first the interval into which the lookup value is determined, and then from
the corresponding row, the result is taken.
As the VLOOKUP formula is copied vertically downwards in the range C11:C15, it is enough if $
symbols are put only in front of the row numbers, that is, even the following specification would
work correctly:
=VLOOKUP(B11, K$7:L$11,2,FALSE)
The logic for the formulae in other columns is the same as before and hence we do not explain
them here.
HLOOKUP function. The keys column can also be horizontal, instead of being vertical. In that
case, you need to use the function HLOOKUP. The keys in a HLOOKUP table are in the first
row, the search first determines the matching column of the HLOOKUP table, and the result is in
a row of the matching column( specified as the third argument). The match can be exact ( that is
the fourth argument of HLOOKUP is FALSE), or it can be interval-based ( that is the fourth
argument is TRUE). In the case of range lookup, the key values in the first row are to be in the
ascending order, and the search takes place from left to right.

Figure-1.1 a Main Spreadsheet for example 1.1


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Parameters:
1. Std. Rt
2.Incntv. Rt

(Pcs/hr)
(Rs/piece)

Emp
Code

Emp
Type

Basic
Wage
(Rs/Hr)

Hrs
Worked

E1
E2
E3
E4
E5

E
D
C
B
A

45
40
30
25
20

40
48
56
32
40

Pieces
Produced

Extra
Prodn

Pay
Regular
(Pcs)

Pay
Incntv
(Rs)

Pay
Total
(Rs)

440
530
490
350
350

40
50
0
30
0

1800
1920
1680
800
800

200
250
0
150
0

2000
2170
1680
950
800

10
5

Figure 1.1 b. Lookup Table in the Spreadsheet of Example 1.1

Page 16 of 260

IIMA/CISG0104TEC

6
7
8
9
10
11

K
Emp Type
A
B
C
D
E

L
BasicWage
20
25
30
40
45

Figure 1.1c. Important formulae in the spreadsheet of example 1.1


Cell
C11
F11
G11
H11
I11
G17
I18

Formula
=VLOOKUP(B11,$K$7:$L$11,2,FALSE)
=IF(E11>$E$4*D11,E11-$E$4*D11,0)
=D11*C11
=F11*$E$5
=G11+H11
=SUM(G11:G15)
=100*H17/I17

The range to which the cells


formula is copied
C12:C15
F12:F15
G12:G15
H12:H15
I12:I15
H17:I17

Page 17 of 260

IIMA/CISG0104TEC

Example 1.2 Weekly Wage Computation: Extension-2.


Consider another extension, independent of the previous extension, to example 1. Suppose that
the basic wage (rupees per hour) depends on a performance index (PScore) which is computed
and updated periodically for each worker. PScore forms one of the inputs to the problem. The
PScore is divided into several intervals and the basic wage of a worker depends on the interval to
which his/her PScore belongs. This relationship is defined by the following table:
Range of PScore Basic (Rs/hr)
PScore 10
20
10 < PScore 20
25
20 < PScore 30
30
30 < PScore 40
40
PScore > 40
60
You can assume that PScore is computed to two decimal places; it is never negative, and rarely
exceeds 40. Other inputs and outputs required remain the same as in the original version of the
problem (Example 1).
A solution to the above problem is given in the spreadsheet shown in Figures 1.2a and 1.2b. A
new feature in this spreadsheets is the conversion of PScore to basic wage. This is done through
the formulae in range C11:C15.
As can be guessed, these formulae used VLOOKUP. The lookup table is given in range K7 :
L11. Let us analyze the following formula in cell C11:
= VLOOKUP (B11, K$7 : L$11, 2, TRUE)
The arguments in the above formula have the meanings already explained in the previous
example. The only difference here is that the fourth argument is TRUE, which means that during
the lookup, range lookup procedure needs to be followed. Let us explain this using the data for
worker E1 whose PScore is given as 10.5 in cell B11. Therefore, the lookup value in VLOOKUP
is 10.5. This is compared with the keys in the first column of the lookup table from top-down till
a matching value is found, or till a key that exceeds the lookup value is encountered for the first
time. If an exact match is found, then the result is the value in the column number (of the
matching row) given by the third argument of the VLOOKUP. Else, the row previous to the key
that first exceeds the lookup value is taken as the matching row, and the result as before is taken
from the column specified by the third argument of the VLOOKUP. In the present case, as 10.5
is compared with the keys in the first column of table K7 : L11, the first key that exceeds 10.5
happens to be 20.01, which is in the third row of the lookup table. Therefore, the matching row is
taken to be row 2, one row prior to the row in which 20.01 occurs. In row 2, the result is in the
second column, which is 25. The basic of Rs 25/ hr is of course correct according to the problem
definition.
In a similar way, for the second worker, the matching row is the third row, and hence the result is
30. In general, the rule for finding matching row is as follows:
The matching row is that row whose key is the greatest key less than or equal to the lookup value.
The lookup table has to be formulated such that keys of successive rows are in ascending order,
and no key is duplicated. If the lookup value is greater than all the key values in the lookup table,
the last key is taken to be the greatest key less than or equal to the lookup value and accordingly
the last row becomes the matching row. On the other hand, if the lookup value is smaller than
even the first key, then the VLOOKUP fails to yield a result, and prints an error message.

Page 18 of 260

IIMA/CISG0104TEC

The formulae in other columns (see Figure 1.2 c) are similar to those in the other two versions of
the problem and hence are not explained further.

Figure 1.2a Spreadsheet of Example 1.2: Main area


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Parameters:
1. Std. Rt
2.Incntv. Rt

(Pcs/hr)
(Rs/piece)

Emp
Code

PScore

E1
E2
E3
E4
E5

10
5
Basic
Wage
(Rs/Hr)

Hrs
Worked

Pieces
Produced

Extra
Prodn

Pay
Regular
(Pcs)

Pay
Incntv
(Rs)

Pay
Total
(Rs)

25
30
60
40
20

40
48
56
32
40

440
530
490
350
350

40
50
0
30
0

1000
1440
3360
1280
800

200
250
0
150
0

1200
1690
3360
1430
800

10.5
20.5
42
35
6

Figure-1.2b Spreadsheet of Example 1.2: Lookup Table


K
7
8
9
10
11

0
10.01
20.01
30.01
40.01

L
20
25
30
40
60

Figure-1.2c Important formulae in the spreadsheet of example 1.2.


Cell
C11
F11
G11
H11
I11
G17

Formula
=VLOOKUP(B11,$K$7:$L$11,2,TRUE)
=IF(E11>$E$4*D11,E11-$E$4*D11,0)
=D11*C11
=F11*$E$5
=G11+H11
=SUM(G11:G15)

I18

=100*H17/I17

The range to which the cells


formula is copied
C12:C15
F12:F15
G12:G15
H12:H15
I12:I15
H17:I17

Page 19 of 260

II.2

Example 2.

IIMA/CISG0104TEC

Comparison of two sales commission plans

Through this example we discuss the design of formulae in spread sheets, copying of formulae
from one range to another and simple what if analysis.
A company wants to compare two proposed plans for sales commission. In Plan-A, when the
number of units sold is less than or equal to 20,000 (call it Volume-1) no sales commission is to
be paid; otherwise, sales commission is to be paid at the rate of Re. 1 for each unit sold beyond
20,000. In Plan-B also, for sales upto 20,000 units there is no commission. For sales between
20,000 and 60,000 (call it Volume-2) the commission is at the rate of Rs. 0.6 for each unit above
20,000; for sales beyond 60,000, the commission is at the rate of Rs. 1.5 for each unit in excess of
Rs. 60,000.
The variable costs are estimated as follows:
Raw material cost per unit of final product = Rs. 15
Utilities cost per unit of final product = Rs. 5
The fixed costs per year are given as:
Rent = Rs. 60,000; Salaries = Rs. 2,00,000; Advertising Expenditure = Rs. 80,000
Other Miscellaneous fixed costs = Rs. 20,000.
The sales price per unit is Rs. 25.
In comparing the two policies, we are required to find the break even sales volume for each of the
two plans. We are also required to find the sales volume, if any, at which both the policies yield
the same profit; below this sales volume, one of the policies is the more profitable, and above it,
the other policy is the better.
1. A spread sheet design for this problem is presented below: (see Figure 2a).Parameters: As
some data is common for both policies, this data is entered in the range A3:C14. In this range,
Column A is reserved for the titles of the parameters, and C for their values. Column B is left
blank for the sake of legibility.
2. The data on sales commission, which is different for the two policies, is given in the range
E3:G7. Column E consists of the titles, F the data for Plan-A, and G the data for Plan-B.
Output
The output can be split into two parts: in one we show the total costs and total revenues for each
of the plans for a certain sales volume. In another, we show the sensitivity analysis: how the net
income varies with sales volume for each plan. The first part is shown in the range E9:G15, the
second in I5:K16.
Cell Widths. To choose the widths of columns D and H as 1, click the mouse on the desired
column, and use the menu options Format -- Column Width. In the dialogue box that appears
enter the desired width in the Column Width field. The other columns will remain at the default
column width.
Cell Formulae . The cell formulae in the range E9:G15 are shown in Figure 2b. Most of the
formulae are self explanatory, and can be easily derived by the reader; for example, total raw
material cost = raw material cost per unit of product (cell C5) * number of units sold (cell C14).
Hence the formula to be entered into F10 is either C5*C14 or $C$5*$C$14. Of these two, we
choose the latter, because while copying this formula to the corresponding cell in Plan-B we do
not want the cell addresses to change.
The formulae for total sales commission are more complex than the others. These can be derived
as below:

Page 20 of 260

IIMA/CISG0104TEC

Total sales commission in A

= 0 if sales (cell C14)<=20000 (cell F4)


= (sales volume-20000)*1 otherwise.

The format of IF function is IF (Condition, expression-1, expression-2); this means that the
contents of the current cell should be obtained by evaluating expression1 if condition is true, and
by expression2 otherwise. The condition to be verified here is $C$14<=F4. If the condition is
satisfied, then the commission is 0; otherwise it should be equal to ($C$14-F4)*F5. Accordingly
the formula in cell F12 is
= IF($C$14 <= F4, 0, ($C$14-F4)*F5)
As the formulae in Plan-A and Plan-B are similar, enter the formulae only for Plan-A, that is in
column F, range F9:F15, and then copy these into column G, range G9:G15. The formula for sales
commission in cell G12 needs to be changed through editing, because sales commission is
computed differently in the two policies.
Figure-2a: Comparison of two sales commission plans
A

Plan-A

Plan-B

1
2
3

Common Data

Sales comm

Sales Volume vs Net income

Volume-1

Unit r.m. cost

Unit util cost

Unit price

15
5
25

Comm-1/unit

20000

20000

0.6

Volume-2

Rent

60000

Tot fix cost

10 Salaries

200000

Tot rm cost

11 Advertising

80000

Tot util cost

12 Other fixed csts

20000

Tot sales comm

13
14 No.of units sold

90000

15

c14

f15

g15

20000

21000
-3500

60000

83000

-8000

1.5

84000

-4000

85000

3500

360000

86000

4000

7000

1350000 1350000

87000

8000

10500

Comm-2/unit

8
9

Data Table-1

360000
450000

450000

88000

12000

14000

70000

69000

89000

16000

17500

Tot cost

2230000 2229000

90000

20000

21000

Tot sales tev

2250000 2250000

91000

24000

24500

92000

28000

28000

93000

32000

31500

Net income

16

20000

21000

Figure-2b: Formulae and other entries in range E9:G15


9
10
11
12

E
Tot fix cost
Tot rm cost
Tot util cost
Tot sales comm

F
= SUM($C$9:$C$12)
= $C$14*$C$5
= $C$14*$C$6
= IF($C$14<=F4,0,
($C$14-F4)*F5)

13
14
15

Tot cost
Tot sales rev
Net income

= SUM(F9:F12)
= $C$14*$C$7
= F14-F13

G
= SUM($C$9:$C$12)
= $C$14*$C$5
= $C$14*$C$6
= IF($c$14<=G4,0,
(IF($C$14<=G6,
($C$14-G4)*G5,
($C$14-G6)*G7+(G6-G4)*G5))
= SUM(G9:G12)
= $C$14*$C$7
= G14-G13

Page 21 of 260

IIMA/CISG0104TEC

Sensitivity Analysis
The break-even volumes can be found by changing the entry in cell C14 till the net income
reaches a value zero in cell F15 or G15. However, this process involves considerable amount of
search and hence is tedious. This process can be simplified considerably by building a table with a
range of sales volumes in one column, and the corresponding net income figures in the other
columns. This is achieved by letting the spreadsheet fill what is known as a data table. First,
choose the range of the data table as I5:K16. Fill the first column of this range, starting from cell
I6, with the range of the sales volumes that we are interested in testing. In J5, the first cell of the
second column, enter the cell address of the first dependent variable, that is, =F15; and in K5, the
first cell of the third column, enter the address of the second dependent variable, that is, =G15.
Highlight the table region, that is, I5:K16 by positioning the mouse pointer on I5 and dragging it
to K16 with the left button pressed. Next choose the menu options Data -- Table. A dialogue box
with two fields, row input cell and column input cell appears. Keep the row input cell field blank,
and fill the column input cell field with the address C14. Then press the OK button. The software
fills the second and third columns of the table automatically.
Figure-2 shows the results of sensitivity analysis for sales volume varying from 83,000 to 93,000.
From this we get the answers for all the given questions:
1. The break-even sales volumes for Plan-A and Plan-B are 85,000 and 84,000respectively.
2. For the sales volume 92,000 both the policies give the same net income. For sales
volumes less than 92,000 policy B is better than A; and for those above 92,000, A is
better than B.

II.3

Example 3.

Extension to Example 2

Through this example we discuss the use of functions, particularly IF and VLOOKUP in Excel.
In the above example we have assumed that the advertising expenditure is fixed and is independent of the sales volume. Suppose this assumption is to be relaxed. Let the relation between
the sales volume and advertising expenditure be specified as below:
Sales volume
0 - 29,999
30,000 - 59,999
60,000 - 79,999
80,000 - 89,999
>= 90,000

Advertising Expenditure
5,000
10,000
30,000
60,000
90,000

The spread sheet for this is shown in Figure-3. Note that this spread sheet has a new partition, the
range A16:B22, to accommodate the data given above. The following changes are made to the
spread sheet in Figure-2 to incorporate the new feature:
The advertising expenditure is no more a fixed cost, but it is to be computed for any given sales
quantity. Hence it is removed from the parameters set, and is included as a separate item in the
range F8:G8. The values in these cells are to be obtained by matching the sales volume with the
values in the range A18:A22, and taking the corresponding value of advertising expenditure from
the next column, column B. Therefore the formula for cell F8 and G8 is
VLOOKUP($C$14,A18:B22,2). The results of the sensitivity analysis for this modification show
that, unlike in the previous case, the net income does not exhibit a monatomic behaviour; it
fluctuates, with increase in sales.

Page 22 of 260

IIMA/CISG0104TEC

Figure-3 : Sales Commission Example - Extended Version


A

1
Plan-A

2
3

Common Data

Volume-1

20000

20000

15

Comm-1/unit 1

0.6

Unit util cost

Volume-2

60000

Unit price

25

Rent

10 Salaries
11 Other fixed csts

Comm-2/unit

60000

Example 4.

12000

16500

84000

16000

20000

85000

20000

23500

60000

Tot fix cost

280000

280000

86000

24000

27000

200000

Tot rm cost

1425000

1425000

87000

28000

30500

20000

Tot util cost

475000

475000

88000

32000

34000

76500

89000

36000

37500

Tot cost

2345000

2346500

90000

10000

11000

Tot sales rev

2375000

2375000

91000

14000

14500

Net income

30000

28500

92000

18000

18000

93000

22000

21500

16 Table: Ad exp vs Sales


Sales
Adv
17
Exp
5000
18 0

21 80000
22 90000

28500

83000

90000

95000

10000

g15

30000

1.5

13

19 30000
20 60000

f15

90000

12

15

c14

Adv cost

Tot sales comm 75000

14 No.of units sold

Data Table-1
Sales Volume vs Net income

Unit r.m. cost

II.4

Plan-B

Sales comm

30000
90000

Investment Analysis

Through this example we discuss two functions, NPV and IRR, very important for investment
analysis; additionally, we use the data table feature, already introduced partly in the previous
example.
First consider a simple investment proposal which involves making a certain investment at the
beginning and receiving cash at the end of each year of the period under consideration,. The
investment and the cash to be received at the end of the first year are known with certainty; they
are Rs 10,000 and Rs 4,000 respectively. The amount to be received at the end of the second and
third years is not known exactly; it is however known that from the first year onwards, the amount
received at the end of each year increases by a constant amount, say X. That is, at the end of the
second year the cash inflow would be Rs 4000 + X, and at the end of the third year Rs 4000 + 2X
.The life of the investment is only three years. All you know about X is that it lies in the range Rs
500 to 1300. Analyze the above data and find whether the investment proposal is financially
acceptable for various possible values of X. Use in your analysis the discount rate Rs 0.18 per
rupee per year.
As the cashflows mentioned above are spread in time, you need to convert each of the cashflows
to equivalent values at the beginning of the period, and compute their sum. Such a sum is called
the net present value (NPV) of the cashflow. A negative value of NPV implies that the proposal is
loss-making, and a positive value implies the opposite. Converting a cashflow occurring
sometime in future to its present value is called discounting. For discounting you need to use a
certain fraction called discount rate, which is 0.18 in the present problem. It is also customary in
investment analysis to find that value of discount rate(s) at which the net present value becomes
zero; this discount rate is called the internal rate of return(IRR).The IRR is compared with a
specified rate of return called minimum acceptable rate of return, and the proposal is considered
acceptable when IRR is greater than the acceptable rate, and is considered unacceptable
otherwise. It needs to be emphasised here that the above rules are somewhat gross simplifications

Page 23 of 260

IIMA/CISG0104TEC

of the process followed in practice , and that many assumptions are needed to justify these rules.
For example, the analysis becomes confusing when the cash flows under consideration yield
multiple IRRs. Therefore, the above two measures are to be used not blindly but with caution. We
are concerned here not so much with the philosophy behind using each measure, but with how to
use Excel to compute them.
Consider the spreadsheet of Figure-4a for the above problem. As we need to experiment with
different values of X, X is stored separately in cell B3. The discount rate is also stored separately
in cell D3. This is done to facilitate experiments with this parameter, to validate the results, even
though you are not explicitly asked to experiment with the discount rate. The cash flows at the
end of each year are given in cells B6 through E6. The beginning of the first year is considered
the same as the end of the zeroeth year; the beginning of the second year is considered to be the
same as the end of the first and so on. The time indexes shown in the range B5 through E5 are to
be interpreted as follows: the index i refers to the end of the ith year or the beginning of (i+1)th
year; thus the end of the investment project, which is the end of the third year, is denoted with
index 3. The cash flows at time 0 and 1 are given and these are entered in their corresponding
cells. As the cash inflow at 2 is more than that at 1 by X, and that at 3 is more than that at 2 by X,
the entries in cells D6 and E6 are the formulae =C6+$B$3 and =D6+$B$3 respectively.
The cells F6 and G6 are used for NPV and IRR respectively. The formula in F6 is
NPV(D3,C6:E6)+B6. This formula may appear somewhat awkward to you, especially if you are a
beginner; you may expect to see instead the formula NPV(D3,B6:E6), because the series of cash
flows are contained in the range B6:E6,and therefore the range C6:E6 specifies the cash flows
only incompletely. The necessity for the above awkwardness arises because of the way NPV
function operates. This function always assumes that the first cell of the range which is specified
as the second argument of the function consists of the cash flow at the end of the first year; that
the next cell consists of the cash flow at the end of the second year and so on. With this
assumption it finds the net discounted value of cash flows at the beginning of period 1. Therefore,
in using this function, include in its argument only the range for cash flows from time 1 onwards,
and if there is a cash flow at 0 add it separately to the NPV.
What happens if you give wrongly, using common sense, the formula NPV(D3,B6:E6) in cell F6?
Then, the flow at time zero would be interpreted by the system as the flow at time 1, the flow at 1
would be interpreted as that at 2 and so on; as a result the value of the function would be the net
discounted value at time 1 (that is, one period prior to the origin) and not the one at time 0. That
is, the answer given by the function would be the actual NPV divided by (1+d), where d is the
discount rate.
The formula in cell G6 is IRR(B6:E6,0.18); the first argument is the range of cash flows
beginning from time zero; the second argument is the users guess for the value of IRR. Note that
the range for IRR function is to be specified differently from that for NPV.
With the different entries in place, it is easy for you to conduct experiments with this spreadsheet.
Simply change the value in B3 from 500 to 1300 with a step size of your choice and for each
value read off the NPV and IRR values from cells F6 and G6 respectively.
As you experiment with various ranges of values, you will feel the need to record the values of
the independent variable (also called the input variable) and the corresponding values of dependent variable; making these entries yourself in some part of the spreadsheet will be very tedious
and inefficient. To overcome this difficulty, you can use the Data Table feature already introduced
in the last example. Choose an empty part of the spread sheet, which in the present case is
B10:D18, as the range for your data table; In the first column of this table, leave the first cell
blank, and enter in the other cells the values of the variable X that you want to experiment with;
the next two columns, the second and the third, are to be filled by the computer; enter at the top of
the second column, that is in cell C9, the formula for the first dependent variable , which in this
case is =F6; in the corresponding cell of the third column, that is in cell D9, enter the formula for
the second dependent variable, which in this case is =G6. Now, highlight the table range B9:D18;

Page 24 of 260

IIMA/CISG0104TEC

choose the menu options Data


Table. Specify the column input cell as B3. The result of this
command is shown in Figure-4a.
Let us now extend the example to include one more investment proposal. Call the two proposals
under consideration project A and project B. As in the previous case, here also for each project
you know with certainty the initial investment and first years inflow; these are Rs 10,000 and
4000 for project A and Rs 15,000 and 3000 for B. From the second year onwards, the inflow each
year increases at the constant rate of Rs X per year in project A and Rs Y in B; X can vary from
700 to 1200 and Y from 4500 to 4700. Using the NPV criterion find for different values of X and
Y which of the two projects is the better.
A spreadsheet for this problem is shown in figure-4b. For the two projects the cash flows are
shown in ranges B5:E5 and B8:E8 respectively; and their NPVs in F5 and F8. As X and Y are
the parameters that you will be required to experiment with they are given separately in cells B2
and B3. The discount rate, Rs. 0.18 per rupee per year, is given in cell D2. As before the entries in
the cash flows at time 2 and 3 are not numbers but formulae using X and Y. It is clear from the
problem statement that for some combinations of (X,Y) values project A may turn out to be the
better and for some other combinations project B may be the better. Therefore, unlike in the
previous case, you are now required to experiment with two variables simultaneously. What will
be your dependent (or output) variable? it can be chosen as the difference between the two NPVs,
=F5-F8. Since the experiment involves two independent variables, you have to now use Data
Table feature by giving both row input cell and column input cell.
The organization of the data table for this case is somewhat different from that for the previous
case: In the top left cell of the table enter the formula for the output variable; in the first column,
leaving the corner cell mentioned just now, enter the values of the first independent variable; in
the first row, leaving once again the first cell of the table, enter the values of the second independent variable. In the spreadsheet of figure-4b the table range is B11:G17. Thus the output
formula =F5-F8 is entered in cell B11; in the range B12:B17 are entered the different values of
variable X(of cell B2) can take; and in the range C11:G11 are entered the values of Y (of cell B3).
When data table option is chosen, you will be asked to supply the addresses of the following:
column input cell and row input cell. Remember that column input cell is that cell into which
different values in the first column of the table are to be substituted automatically one after the
other; similarly, row input cell is that cell into which the values of the first row are to be
substituted. Accordingly, in the present case, column input cell is B2 and row input cell is B3.
Once these addresses are supplied the experiment is performed by the system and the results are
filled in the table as shown. The interpretation of the results is as follows: the value of the
dependent variable resulting from a combination of X and Y is shown at the intersection of the
row for X and column for Y; for example, the difference in NPVs when X=900 and Y=4550 is
shown in cell D14 and is equal to 109.89.
From this example, it is clear that the data tables of Figure-4a and 4b differ in their abilities: the
first
allows experimentation with only one input variable, while the second allows
experimentation with two. The first however allows you to tabulate the values of any number of
dependent variables, whereas the second allows the tabulation of only one dependent variable. In
case, while experimenting with two variables, you need to tabulate more than one dependent
variable, use separate data tables. Furthermore, you will notice that when some changes are made
to the values or formulae in the spreadsheet the data tables are automatically re-computed.

Page 25 of 260

IIMA/CISG0104TEC

Figure-4a : Spread Sheet for Cash Flow Analysis


A

NPV

IRR

1
2

Example on NPV, IRR, and DT1

1000

0.18

4
5

Time(Yrs)

Cashflow

-10000

4000

5000

6000

Rs.632.54 22%

7
8

Data Table : B9:D18

Rs.632.54

22%

10

500

-335.185

0.159753

11

600

-141.641

0.171527

12

700

51.90404

0.183076

13

800

245.4487

0.19441

14

900

438.9933

0.205541

15

1000

632.5379

0.216478

16

1100

826.0825

0.227231

17

1200

1019.627

0.237807

18

1300

1213.172

0.248215

Figure- 4b : Spread Sheet for Comparison of Two Projects


A
1

Comparison of Projects A and B

700

4500

0.18

Time(Yrs)

CF Proj_A

-10000

4000

4700

5400

Rs51.90

CF Proj_B

-15000

3000

7500

12000

Rs232.33

3 NPV

6
7
8
9
10
11

Data Table (B11:G17)


=F5-F8-->

(Rs180.42)

4500

4550

4600

4650

4700

12

700

-180.423

-277.195

-373.967

-470.7394622

-567.512

13

800

13.12208

-83.6502

-180.423

-277.1948447

-373.967

14

900

206.6667

109.8944

13.12208

-83.65022714

-180.423

15

1000

400.2113

303.439

206.6667

109.8943904

13.12208

16

1100

593.7559

496.9836

400.2113

303.4390079

206.6667

17

1200

787.3006

690.5282

593.7559

496.9836254

400.2113

Page 26 of 260

II.5

IIMA/CISG0104TEC

Example 5. Computation of shipping cost.

A company supplies its product to four cities from five warehouses. The shipping plan is given in
range B3:D8 of the spread sheet of Figure-5a. For example, it is planned to ship 150 units from
ware house-1 to city-3, as indicated by the third row of this range. The per unit shipping cost per
unit distance is given as 5 monetary units. This is given in cell K2 of Figure-5a. The distances
between the five warehouses and the four cities are given in range C13:F17.For example, the
distance between warehouse-2 and city-3 is 17 distance units. With this data compute the cost of
shipping the various quantities given above between the warehouses and the cities.
1. Compute th
st of shipping one unit between each pair of warehouse and city. That is, you
need to obtain a five by four array by multiplying each element of the distance array by the per
unit cost given in K2. Let us allocate the range C22:F26 for this purpose. Highlight this range and
enter in it the following array formula (ctrl, shift, enter):
= $K$2*C13:F17
2.In the range E3:E8, compute the cost between each warehouse city pair for the given shipping
plan, by multiplying the shipping quantity with the per unit shipping cost between the
corresponding warehouse and city. Focus on the data in row-3 of the spreadsheet. Here the
quantity of shipment is 100, the ware house index is 2 and city index 3. The per unit cost of
shipment for this warehouse-city pair is obtained as 85, by looking up the cost matrix in its
second
row
and
third
column.
The
corresponding
lookup
formula
is
INDEX($C$22:$F$26,B3,C3). This value needs to be multiplied by the quantity of shipment
given in D3 to obtain the cost of shipment. Thus the formula to be entered in cell E3 is:
=D3*INDEX($C$22:$F$26,B3,C3)
As a similar computation needs to be done in other cells of the range E3:E8, copy the above
formula to E4:E8.
Extension to example 5. Suppose rows and columns of the distance matrix are labeled with
names of their respective warehouses and cities respectively as shown in Figure-5c; similarly, in
the shipping plan, instead of warehouse and city numbers, the corresponding names are given. In
this case, in each transaction, you need to convert the warehouse and city names to the row and
column numbers in which their costs occur in matrix H13:K17. This requires you to use a
function which can tell you the position of a given value within a vector of values. This capability
is provided by the function MATCH. The MATCH function is to be provided with two
parameters: the key and the range address of the lookup vector. The lookup vector can be vertical
or horizontal. The formulae to be used for this case are listed in Figure-5d.
Note that the two functions INDEX and MATCH are somewhat opposite in their tasks: INDEX
returns a value occurring at a specified location in a specified vector or a matrix, whereas
MATCH returns the location in a vector where a given value occurs.
General points about array formulae.
1. In the above example, one array formula was introduced, for multiplying each element of a
vector by a scalar. The output was obviously a vector. In general, when the output of a
computation is a vector or a matrix, and when the computation is done through an array formula,
the procedure for typing in the formula is special. First highlight the range that is to contain the
results of the computation. Then, type in the formula by beginning as usual with an equals sign;
after the whole formula is typed in, end it by pressing simultaneously the three keys, Control,
Shift and Enter.
There are array formulae for several matrix operations. Some of these are : MMULT for
multiplying two matrices, MINVERSE for inverting a matrix, TRANSPOSE for obtaining the
transpose of a matrix. For adding two matrices there is no special function; the formula consists of

Page 27 of 260

IIMA/CISG0104TEC

references of the two matrices separated by the plus (+) symbol. Similarly, the formula for
subtracting two matrices consists of the reference of the first matrix followed by a minus sign
followed by the reference for the second matrix.
2. Several other formulae use ranges (or arrays) as their arguments, but their results are not arrays.
As the result of such a formula is not an array, it should be entered simply by pressing the Enter
key. An example is the VLOOKUP function.
Another function of this category is the SUMPRODUCT function for which the arguments are
two arrays of identical dimensions; the result would be the sum of the products of the
corresponding elements of the two arrays. Consider for example the formula
=SUMPRODUCT(A1:C3,A3:C3). The formula multiplies the corresponding elements of the two
three-element vectors A1:C3 and A3:C3, and takes the sum of the three products, which is its
final result; that is, its result is (A1*A3) + (B1*B3) + (C1*C3). Consider as another example the
formula =SUMPRODUCT(A1:C3, F7:H9). In this formula each argument refers not to a vector
but a rectangular range, consisting of three rows and three columns, that is nine cells. Therefore
the result of the formula is the sum of nine products, each product involving a pair of
corresponding elements of the two ranges; thus, the result of the formula is (A1*F7) + (B1*G7) +
(C1*H7) + (A2*F8) + (B2*G8) + (C2*H8) + (A3*F9) + (B3*G9) + (C3*H9).
In statistical computations you need to evaluate

(x y)

where x and y denote the

corresponding elements of two vectors of the same length; this can be computed by the function
SUMXMY2 with appropriate arguments. Similar functions are available for computing sum of
squares of corresponding elements of two vectors of the same length; and for difference of two
squares of two vectors of the same length.
Figure-5a: Spreadsheet for Computation of Shipping Cost
A

1
2

Warehouses
Warehouses

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

W.No.
2
2
1
1
4
5

1
2
3
4
5

1
2
3
4
5

C
D
E
F
Shipping Cost Computation
City
No
Quantity
Cost
3
100
8500
4
200
25000
3
150
11250
2
75
3750
2
35
3850
1
40
5400

Shipping cost per unit per unit


distance

1
12
10
5
18
27

Distances
Cities
2
10
16
30
22
17

3
15
17
22
17
16

4
20
25
28
16
20

1
60
50
25
90
135

Shipping cost per unit


Cities
2
3
50
75
80
85
150
110
110
85
85
80

4
100
125
140
80
100

Figure-5b: Important formulae in the e Spreadsheet of Figure-5a

Page 28 of 260

IIMA/CISG0104TEC

S.No. Range
1
C22:F26

Formula
=$k$2*C13:F17

=D3*INDEX($C$22:$F$26,B3,C3)

E3

Comments
An array formula. Computes the
shipping cost per unit between
each warehouse and city
Total cost of shipping the
quantity indicated in D3, between
ware house indicated in B3 and
city indicated in C3.
This formula is copied to E4:E8.

Figure-5C. Spreadsheet for extension to example-5.


A
1
2

WName W.No. City Name


BLR
BLR
AHD
AHD
DEL
HYD

2
2
1
1
4
5

MUM
NAG
MUM
BHV
BHV
ALB

City
Quantity
No
3
100
4
200
3
150
2
75
2
35
1
40

Warehouse

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

L M

Shipping cost per unit


per unit distance

Cost
8500
25000
11250
3750
3850
5400

AHD
BLR
CAL
DEL
HYD

ALB
12
10
5
18
27

Distances
Cities
BHV MUM NAG
10
15
20
16
17
25
30
22
28
22
17
16
17
16
20

Figure-5d. Important formulae in the spreadsheet of Figure-5C.


S.No. Cell
1
C3

E3

G3

Formula
Match(B3,$G$3:$G$17,0)

Comments
Returns the position of BLR
in vector G3:G17.
Copy this to range C4:C8
Match(D3,$H$12:$K$12,0)
Returns the position of MUM
in the vector H12:K12.
Copy this to range E4:E8
$M$3*$F$3*Index($H$13:$K$17,C3,E3) Copy this to range G4:G8

Page 29 of 260

II.6

IIMA/CISG0104TEC

Example-6. Matrix Arithmetic: A Problem in Economic Planning.

The planning commission of a country has divided its economy into two sectors, agriculture and
manufacturing, during its preliminary analysis. All input quantities, output quantities and
consumption quantities are expressed in standard monetary units (MUs).
The two sectors are mutually dependent: each sector uses in its production, its own outputs and
those of the other sector.
Specifically, the output of the agriculture sector is used in the following three ways:
1.
2.
3.

by the agriculture sector itself at the rate of 0.1 units of input per one unit of agricultural
output
by the manufacturing sector at the rate of 0.6 units of input per one unit of manufacturing
output
all the remaining, for direct internal consumption or for exports

Similarly, the output of the manufacturing sector is used as follows:


1.
2.
3.

by agriculture sector at the rate of 0.5 units of input per one unit of agricultural output
by the manufacturing sector itself at the rate of 0.1 units of input per one unit of
manufacturing output
all the remaining, by direct internal consumption or by exports

The planning commission wants to plan the sectoral outputs such that the quantities available for
direct internal consumption and exports are 20 units of agricultural output and 50 units of
manufacturing output. What should be the total outputs of each of the two sectors to achieve the
above target?
In the following discussion we assume that the reader is familiar with the idea of a matrix and
with matrix operations such as matrix multiplication, and matrix inversion.
The above is a standard problem in economics and is studied under the subject of input-output
analysis. Refer to a standard book on economics or applications of matrices (see Hadley, G,
Linear Algebra, Narosa Publishing House, New Delhi, 1987) for further details related to this
problem. The solution of this problem consists of the following steps:
1. Represent the interdependencies between the sectors in the form of a square matrix A, with the
number of rows and columns each equal to the number of sectors; in this case, A is a 2 by 2
matrix. The element in the ith row and jth column of this matrix denotes the number of units of
sector I needed as input to produce one unit of output of sector j. Therefore, the A matrix of the
above example is:
A =

0 .1 0 .6

0 .5 0 .1

Enter the elements of the above matrix in the range B4:C5 of your spreadsheet, as shown in
figure-6a below.
2. Represent the quantities of direct consumption and export of the outputs of each sector as a
column vector b. In our example the b vector has two rows, as shown below:

20

50

b =

Enter the above two elements in the range E4:E5.


3. Enter the two by two identity matrix

Page 30 of 260

IIMA/CISG0104TEC

1 0

I =
0 1
in the range G4:H5.
4. Compute the difference between the two matrices I and A. As I-A is a two by two matrix, you
need a two by two range in your spreadsheet to contain this matrix. In the figure below, the range
J4:K5 serves the above purpose. The matrix difference is obtained by an array formula. To enter
the array formula, first highlight the range J4:K5 which is to contain the result of this array
formula. With the highlight on, enter the formula = (G4:H5 B4:C5) in the formula box and at
the end of your entry press the three keys control, shift and enter together; this would tell the
computer that what you have entered is an array formula ( and not an ordinary formula, which
would have been ended by the pressing of the enter key), and the output of the array formula is
spans the array indicated by the highlight. After the array formula is entered, you will notice that
the entire formula is automatically enclosed within curly brackets, and hence would appear as
{= (G4:H5 B4:C5) }.
5. Compute the inverse of (I-A). The inverse of (I-A) is also a 2 by 2 matrix and in the
spreadsheet of figure it is contained by the range B8:C9. As you need to compute a matrix, you
need to enter an array formula with the range B8:C9 highlighted; the formula is =
MINVERSE(J4:K9). As before, after typing in the formula press Control, Shift and Enter keys
together.
6. You are now ready to obtain the two row vector, X, of the aggregate output of each sector.
Allot the range E8:E9 to contain the X vector. The formula for X is X = (I-A) 1 * b. Thus X is
obtained by the multiplication of two matrices, and the spread sheet formula to perform this task
is MMULT. Therefore, highlight the range E8:E9 and enter the array formula = MMULT(B8:C9,
E4:E5) in it to obtain the X vector.
Figure-6a: Spreadsheet to perform Input-Output Analysis
A

1
2
3
4
5
6
7
8
9

(I-A) 1
1.76471
0.98039

F G

Input-Output Analysis
Vector-b

Matrix-A
0.1
0.5

0.6
0.1

20
50

1.18
1.76

X= (I-A) 1 * b
94.117647
107.84314

Matrix-I
1
0

Matrix (I-A)
0
1

0.9
-0.5

-0.6
0.9

Figure-6b: Array formulae used in the above spread sheet.


S.No.
1
2
3

Range
J4:K5
B8:C9
E8:E9

Array Formula
=(G4:H5-B4:C5)
=MINVERSE(J4:K5)
=MMULT(B8:C9,E4:E5)

Explanation
To compute (I-A)
To compute the inverse of (I-A)
To multiply the matrix (I-A) -1 with the vector b

Page 31 of 260

II.7

IIMA/CISG0104TEC

Example 7. Regression Estimation: Literacy Rate and Per Capita Income

The chief minister of a certain state in India wants to know the influence of literacy rate on the per
capita income. Specifically, he would like to estimate a linear relationship between per capita
income and literacy rate, which would help him answer questions such as : what would be the per
capita income if the literacy rate is ninety percent?
To answer the above question data on per-capita in come (in Rs 00) and literacy rate (percentage)
of twenty one states was collected (source: Statistical Outline of India, 1996-97, Tata Services
Limited, Deparment of Economics and Statistics) as shown in Figure-7a.
Figure-7a. State-wise Per Capita Income and Literacy Rate

State
Andhra
Assam
Bihar
Delhi
Goa
Gujarat
Haryana
Himachal
Karnataka
Kerala
MP
Maharashtra
Manipur
Meghalaya
Nagaland
Orissa
Punjab
Rajasthan
Tamil Nadu
UP
WB

PerCapita
(Rs'00)
R
66.51
59.16
36.5
147.14
116.58
76
103.59
65.19
70.29
62.42
54.85
109.64
53.62
55.19
58.7
47.26
123.19
52.2
73.52
47.44
60.55

Literacy
(%)
L
44.1
52.9
38.5
75.3
75.5
61.3
55.8
63.9
56
89.8
44.2
64.9
59.9
49.1
61.6
49.1
58.5
38.6
62.7
41.6
57.7

Using the above data we need to estimate a linear relationship ( or linear regression equation)
between per capita in come( R ) and literacy rate ( C ). This will be of the form:
R = m* L + C
The above equation consists of dependent variable R, one independent variable L, and two
parameters m and C. The parameters m and C are to be estimated from the data, such that the sum
of squares of differences between estimated and given values of R at the twenty one given values
of C will be a minimum. Once m and C are known, the equation can be used for purposes such as
estimation, and hypothesis testing.
For estimating the above equation, use the array function linest of the excel package. For this,
follow the steps given below (see figure-7b):
1. Enter the known values of dependent variable R in the range C21:C41, and those of
independent variable in the range D21:D41.

Page 32 of 260

IIMA/CISG0104TEC

2. Choose the range G22:H26 with five rows and two columns ( which is equal to the number of
independent variables plus one) to contain the results of the linest formula.
3. Highlight the output range G22:H26, and enter the formula
= LINEST( C21:C41,D21:D41,TRUE,TRUE)
and end it by pressing simultaneously the three keys Control, Shift and Enter. In this formula the
first argument indicates the range which contains the known values of the dependent variable, the
second indicates the range containing the known values of the independent variable, the third
parameter indicates that the regression equation should not assume that constant is zero, and the
fourth parameter indicates that in addition to the coefficients and constant value, the output should
contain other statistics.
4. As soon as the formula is entered, the results appear in the output range.
5. For estimating the per-capita income for a given literacy rate, enter the literacy rate in the cell
G29. In cell G30 enter the formula
=G22*G29+H22
to get the desired estimate.
The numbers in the output range are to be interpreted as follows:
Values in the first row(G22:H22): m= 1.24 and C = 2.29; therefore the regression equation is
R = 1.24 * L + 2.29
Values in the second row (G23:H23): The standard error of m is 0.43 and the standard error of
constant is 25.4
Values in the third row (G24:H24): r 2 = 0.30, and standard error of the dependent variable=25.06
Values in the fourth row (G25:H25): Value of F statistic = 8.2 and degrees of freedom = 19
Values in the fifth row (G26:H26): SS reg = 5147.8 and SS residuals = 11929.1
An explanation of the meaning of the above statistics is beyond the scope of this note.
The reader is cautioned at this point not to take the above way of formulating the causal relation
as a correct one. The example is concerned merely with illustrating the mechanics of estimating a
linear equation connecting a dependent variable with one or more independent variables. It is not
concerned with discussing modeling or statistical nuances of regression analysis. In fact, it is not
at all advisable to estimate a regression equation unless the analyst is clear on the concepts
behind regression analysis. Decisions based on such immature attempts can lead to disastrous
consequences.
General points regarding regression equation estimation:
1. Note that the general syntax for the LINEST function is:
LINEST(range of known y, range of known x1, range of known x2,range of known xm, want to
estimate constant, want to get regression statistics)
The above syntax allows multiple independent variables X1,X2,,Xm, where m is the number of
independent variables. When there are multiple independent variables, you can enter them in
adjacent columns of your spreadsheet or in non-adjacent columns. When the variable values are in
adjacent columns, you can specify a single range for all variables together. When multiple

Page 33 of 260

IIMA/CISG0104TEC

independent variables are given the regression coefficients are printed in the order: coefficient of
mth variable first, then that of (m-1)th variable,, and in the last that of the first variable.
Note that the last two parameters in the above syntax are boolean that is you can give TRUE or
ALSE in the corresponding position. If you say 'FALSE' for 'want to estimate constant', then the
constant in the regression is assumed to be zero; otherwise, it is estimated. If you say 'FALSE' for
'want to get regression statistics', then the system outputs only the regression coefficients and
constant; otherwise, several other statistics associated with the regression line are output.
Figure-7b: Spreadsheet for regression calculation in Example-7
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

II.8

Andhra
Assam
Bihar
Delhi
Goa
Gujarat
Haryana
Himachal
Karnataka
Kerala
MP
Maharashtra
Manipur
Meghalaya
Nagaland
Orissa
Punjab
Rajasthan
Tamil Nadu
UP
WB

PerCapita
(Rs'00)
R
66.51
59.16
36.5
147.14
116.58
76
103.59
65.19
70.29
62.42
54.85
109.64
53.62
55.19
58.7
47.26
123.19
52.2
73.52
47.44
60.55

State

D
E
F
G
H
I
Regression Equation for Literacy rate and per capita income
Literacy
(%)
Results (G22:H26)
L
L
C
44.1
52.9
Coeffs 1.2418793 2.287759
38.5
Se 0.4337055 25.39935
75.3
R2,Se(y) 0.3014489 25.05684
75.5
F,df 8.1991536
19
61.3
Ssreg, SSresid 5147.7976 11929.05
55.8
63.9
56
90
89.8
114.0569
44.2
64.9
59.9
49.1
61.6
49.1
58.5
38.6
62.7
41.6
57.7

Example-8. Queries on a Personnel Data Base

This example deals with the facilities of Excel for selectively retrieving a part of the information
from a specified range and processing it further in various different ways.
Figure-8a contains, in the range A1:F11, data on the staff of a company. The first row of this
range, that is row 1, contains the labels of the data items, and the other ten rows contain the data
values, one row for each employee. For the sake of convenience, let us refer to the rows as
records, and columns as fields. Call the above range (including the labels row) as input range or
data base or list range.
Question: Extract from the above data base the details of all the female employees with experience of 8 years.
Through a simple visual inspection, you can easily answer the above question. The employee
with S.No. 4 is the only one who is female and has eight years of experience. Hence the
corresponding record (that is row 5) is the record to be extracted. But visual inspection becomes

Page 34 of 260

IIMA/CISG0104TEC

difficult when the input range is large and the queries are complex. For such cases, Excel provides
some useful menu options under the group Data and functions called data base statistical
functions.
For answering the above question, choose the menu options Data
Sort & Filter
Filter. As a
result of this, each of the field titles in row 1 will have a button similar to the drop down box
button appears at its right edge. Since we are interested in filtering the records based on values in
the fields Sex and Exp, first press the button on the Sex field title. A box showing the different
values available in this field appears. Click on the value F, indicating that you would like to see
those records with value F in Sex field. Immediately, all records of the data range, except the
three corresponding to the female employees, will disappear. Next, click on the button in the Exp
field. Again from the box that appears click on the value 8 indicating that from among the records
that are currently being shown, you would like to see only those with 8 in the Exp field. Now only
one record, that corresponding to serial number 4, remains in view. If you want to get back on
display all the records simply choose the menu options Data
Sort & Filter
Filter. Note that
filter option is like a toggle switch. In the earlier versions of excel, this option was called autofilter.
Figure-8a : A Personnel Data Base
A
1
S.No.
2
1
3
2
4
3
5
4
6
5
7
6
8
7
9
8
10
9
11
10

B
Name
Agarwal B
Jain A
Rao D
Sharma V
Desai N
Patel M
Narayan V
Rao K
Srinivas J
Nayar Y

C
D
E
F
G
Age Exp Sex Salary Cadre
28
3F
1500 A
30
4M
1600 A
26
2M
1400 B
32
8F
2000 B
29
4M
1400 A
33
9M
2200 C
44 20 F
1000 C
34
8M
2000 C
44 21 M
6000 A
27
2M
1100 D

Figure-8b. Criterion range

14
15

A
B
S.No. Name

C
Age

D
Exp
>5

E
F
Sex Salary
F

The filter option works only when the criteria for choice are simple ones, and the filtering is to be
done based on only one field at a time. How to deal with questions such as the following: Give
the details of the female employees whose experience is more than five years. Here, the criterion
involves an inequality, namely, Exp >5.
For this we need to use the feature called advanced filtering. Advanced filtering requires you to
prepare a range called a criterion range. The criterion range specifies for each field the kind of
values that are to be possessed by a record for it to be selected. The first row of the criterion range
should contain the names of the fields, with the same spellings as in the original data range, which
are to be used in the selection process. They need not however be in the same order as in the
original data range (also called list range). In the second row specify underneath each field
heading the corresponding selection criterion. For answering the present question, select the range
A14:F15 as the criterion range (Figure-8b). Fill in A14:F14 with the field headings. In D15 type
>5 and in E15 type F. This means we are interested in selecting records with the following
feature: The value in the Exp field should be greater than 5, and the value in Sex field F. Because
the other fields are left blank, those fields do not play any role in the selection process; in fact, a
blank value is supposed to match with every value. Suppose our intention is to copy the selected

Page 35 of 260

IIMA/CISG0104TEC

records into a certain range, say from row 27 onwards. Fill A27:F27 with field headings so that
the output can appear as per these headings. Now select the menu options Data Sort & Filter
Filter Advanced.
In the dialogue box that appears, fill the required addresses as follows, after choosing the option
copy to another location:
List range

A1:F11

Criteria range

A14:F15

Copy to

A27:F27

When you press the OK button of this box, two records will be chosen and will be written in rows
28 and 29.
If you want to filter records with a specified name, you should be a little cautious in making
entries in your criterion range. Note first of all that while comparing names, small letters and
capitals are not distinguished. Secondly, if you give the desired name directly in the
corresponding cell of the criteria range, you will be surprised to find that all the records with
names whose first few letters are the given name, no matter what the other part consists of, will be
filtered. For example if you give Ram in the criterion range, even records with Rama, Ramraju,
Ramanna etc will be selected, because all the above names begin with Ram. To obtain an exact
match, specify the entry in the criteria range as ==text, where text is the desired string; for
example, in the case of Ram the entry in the criterion range would be ==Ram; in this case only
records with Ram in their name field will be selected. An alternative way of accomplishing exact
string match during filtering would be to specify EXACT function in the criteria range. The
EXACT function would be explained later in the example on text processing.
It is possible to handle still more complex queries, queries having several ANDs and ORs (ex:
Exp <10 yrs AND Exp >5 years); the rules for specifying the corresponding criteria will be
discussed later.
Question: Find from the above data base the average salary of all female employees.
There are two ways of answering this question. The first is to extract the records of all female
employees using the advanced filter option mentioned above and then to find the average value of
the entries in the Salary field of the output range. This, however, involves the use of an output
range; then in `what if analysis, the advanced filter option has to be repeated every time an input
value is changed. Furthermore, the size of the output range itself keeps changing, with changes in
input values. These problems can be avoided by using an alternative approach.
In the alternative approach, we achieve the desired result without explicitly writing the selected
records in an output range, (in fact we do not need an output range) but by directly doing the
required computation through a function, which uses the input range, criterion range, and the
desired field position as its arguments. The function to be used in this example is
DAVERAGE(A1:F11,6,A14:F15). Enter this function in an empty cell, and as soon as it is calculated you will see the result 1500, which is the average salary of the three female employees in the
data base. As this entry is a function, it will be recomputed whenever any change is made in the
input (unless the automatic recalc facility is switched off). The DAVERAGE function belongs to
a family of functions known as data base statistical functions, each of which computes a certain
statistic of a specified field in the records selected when a criterion is applied to an input range.
The different statistics that can be computed are: maximum value, minimum value, sum, standard
deviation, average, variance, and number of values. All these functions have the same format: the
function name begins with D, and each function has three arguments. The first argument is the
address or name of the input range; the second is the position of the field to be used in the compu-

Page 36 of 260

IIMA/CISG0104TEC

tation, the offset of the left most field being counted as one; the third argument is the address or
name of the criterion range.
Use of data base statistical functions requires good insight, but a mastery of these enables the user
to perform many tricky, intricate and complex tasks in spread sheets.
Question. In Figure-8a, how do we re-arrange the given data in ascending order of salary? For
this we have to use the Data Sort option. First highlight the list range along with the field titles,
like in the data filter operation. Choose the menu options Data
Sort & Filter
Sort. A table
appears with three columns with the respective titles Column, Sort on, and Order. Each of the
above titles has below it a drop down box. In the column titled as Column, choose the field on
which the sorting needs to be done, which in your case is Salary. In the Sort on column, specify
whether the sorting needs to be based on values or colour of the cell, background or fore goround
colour; choose the option values. In the last column, specify the order of sorting, ascending or
descending; in your case, the order is ascending, ie A to Z. Then press the OK button, to see the
records rearranged in the desired order (Figure-8C). In case the sorting has more than one level,
that is if you want to use a secondary sort key in case there is a tie in the first, you need to give the
corresponding information by adding to the above table as many levels as you need.
Figure -8c. Personnel data base: Sorted in ascending order of Salary
A
1
2
3
4
5
6
7
8
9
10
11

S.No. Name
7
10
3
5
1
2
4
8
6
9

Narayan V
Nayar Y
Rao D
Desai N
Agarwal B
Jain A
Sharma V
Rao K
Patel M
Srinivas J

Age Exp Sex Salary Cadre


44
27
26
29
28
30
32
34
33
44

20 F
2M
2M
4M
3F
4M
8F
8M
9M
21 M

1000 C
1100 D
1400 B
1400 A
1500 A
1600 A
2000 B
2000 C
2200 C
6000 A

It is not necessary that the key field is numeric; it can also have alphabetic values. In the case of
alphabets the order A-Z is considered ascending, and Z-A as descending (strictly speaking, the
order is decided by the ANSI codes of the different characters). In the coding system used by the
EXCEL system (Appendix-V) the order of occurrence of the different characters is the digits (09), then the capital letters (A-Z), and then the small letters (a-z).
Question. In Figure-8a you are also given information on the cadre to which an employee
belongs. Find for each cadre the minimum salary in each sex, and represent the information in the
form of a table, called pivot table, showing the cadres on rows and sexes on columns.
Steps to be followed:
Select the data table
Select the menu options: Insert Tables
Pivot Table Wizard with 4 steps appears.

Pivot Table

Page 37 of 260

IIMA/CISG0104TEC

In step1, it wants to know where is the data you want to analyze; select the answer option:
Microsoft Excel List or Database
In step2, give the range of the database
In step 3, the pivot table template appears, with blank rows and columns. Into the column, drag
and drop the field, sex; into the row, drag and drop the field cadre; and into data area, drag and
drop the field salary. The data will be summarized by sum of salary by default. The summary
statistic will appear as a button. Click on it and you will see a list of possible statistics, from
which choose min.
Then say finish. It wants to know the location of the pivot table; you can say existing worksheet.
The pivot table that is obtained as a result of executing the above steps is shown in Figure-8d.
When you change the source data, the result may not be automatically reflected in Pivot table. In
that case choose the menu options: Data Refresh All Refresh
Even after generating a pivot table, it is possible to modify it; for example, you can change the
field being exhibited in the columns, rows or the field being summarized in the data area. For this
purpose, you need to first highlight the pivot table that needs to be modified and then choose the
menu options Insert Tables
Pivot Table; then a dialog box containing a picture of the pivot
table along with one button for each field appears. By dragging and dropping the field buttons or
by double clicking on the data area the desired modifications can be brought about.
Figure-8d. A Pivot Table
Min of Salary
Cadre
A
B
C
D
Grand Total

Sex
F
1000
1500
2000
1000

Grand
Total
1100 1000
1600 1500
2000 2000
6000 6000
1100 1000

A pivot table is an interesting and useful feature for two-way summarization of data. The default
summary statistic for summarizing the data is sum. The other options are: count (how many data
items are there?), average of the data items, maximum value, minimum value, product of the data
items, standard deviation and variance of the items.

Page 38 of 260

II.9

IIMA/CISG0104TEC

Example -9. Sales Revenue Query: Handling Complex Queries.

The following table (Figure-9) shows the maximum and minimum daily sales revenue earned by a
company in 10 cities, considering the sales in the month of June.
1. How many cities are there whose maximum sales revenue was greater than Rs 50000 OR the
average sales revenue (take the average as equal to half of the sum of maximum and minimum
revenues) was greater than Rs 35000?
2. How many cities are there whose maximum sales revenue was greater than Rs 80000 AND
minimum was less than Rs10000 ?
Figure-9. Spreadsheet for Example-9.
A
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

City
A
B
C
D
E
F
G
H
J
K
Max
>50

B
C
D
Sales Revenue per day during June
(Rs 000)
Max
Min
90
30
40
40
60
50
85
20
40
20
35
30
85
5
75
48
55
45
64
60
X
TRUE

Max
>80

Answers
8
1

Q1
Q2

Min
<10

In order to answer the questions first of all give the following names to the various ranges as below:
Range
A3:C13

Range Name
Datalist

A15:B17
A19:B20

CRTR1
CRTR2

Then create the criteria ranges for the two questions respectively in the ranges CRTR1 and CRTR2,
and obtain the answers in cells C16 and C17. The text entries in these cells are already shown in the
figure. Some cells have formulae behind them, and these are shown below:
Cell
B17
C16
C17

Formula
=(0.5*(B4+C4)>35)
=DCOUNT(Datalist,,CRTR1)
=DCOUNT(Datalist,,CRTR2)

Page 39 of 260

IIMA/CISG0104TEC

Let us now discuss the criterion range for question 1. This question asks us to count the number of
rows satisfying a condition which consists of two simpler conditions connected by OR. In such a
case, the criteria range should consist of multiple rows, in addition to the field names row, one row
for each condition. Thus we have a total of three rows in CRTR1, one for the field headings, and the
remaining two showing the two conditions respectively. The first condition is straight forward: the
value in the Max column should be greater than 80. Hence give in cell B16 the entry >50. Obviously,
the field name is specified in cell B15 as Max. For the second condition, a formula is to be specified,
to the effect that 0.5*( value in Max + value in Min) should be greater than 35. This calls for using
cell addresses in the formula, and these vary for each of the rows of the Datalist. In such case, the rule
is to specify the formula that applies to the first data row (the one following the headings row).
Accordingly, the formula to be given in the third row of the criterion range in its second column is :
(.5*(B4+C4) > 35 ). As this condition refers to cells of multiple columns, the column heading to be
given in B15 is not clear. In such a case, you are allowed to give any heading, as long as the given
heading is not one of the field headings occurring in the Datalist; hence, we have chosen the heading
X. In the DCOUNT function of cell C16, the second parameter is left blank, implying that all the
records of Datalist that satisfy the criterion of CRTR1 need to be counted.
The second question also contains a compound condition; however, this time the two conditions to be
satisfied are joined by an AND. In this case, we need to allocate one column for each of the
conditions in the criterion range, and all conditions should be given in the same row under their
respective columns. Accordingly, the criterion range CRTR2 consists of two columns and just one
row, in addition to the headings row. As the both cells of row 20 have entries, these are interpreted to
jointly indicate a composite condition whose component conditions are joined by AND. Therefore
the condition applied is (Max>80 AND Min<10). The use of DCOUNT for the answer in cell C17 is
obvious.
The main points related to composite conditions in data filter are:
1. If a criterion range has multiple rows (in addition to the headings) each row is interpreted to
refer to one condition; when this criteria range is used as a part of data filter or in a Dformula (like DCOUNT, DAVERAGE ), a row of the data list is selected, if it satisfies at
least one of the conditions (ie OR is used for selection).
2. If a row has multiple columns then the conditions under each column are combined using
AND; that is, for a row of the data list to pass such a criterion, it should pass all conditions
contained in the criterion row.
3. If a criterion range has multiple rows and columns, then the rules stated above are applied
together.
4. If an expression in the cell of a criterion range consists of a formula with cell addresses, then
the corresponding field heading should be different from the field headings in the data list.
The heading could be an arbitrary one, or can even be blank.
5. If a formula has to be used as a part of a condition, the cell addresses in the formula should
be those referring to those of the cells of the first row of the data list. In applying the formula
for selection of different rows in the data list, the system internally adjusts the formula by
changing the relative cell references, if any, as per the rules applicable to copying of
formulae.
For further details related to criteria ranges, you are referred to the on-line help feature of the Excel
package. Specifically, invoke the Help menu item, and within that go to the Index tab, and seek help
on the item criteria.

Page 40 of 260

II.10

IIMA/CISG0104TEC

Example-10. Bishops Move


Figure-10a. Possible moves of a Bishop from position (1,3)
A B C D E F G H I J
1 1 3
Bishops Move
2
1 2 3 4 5 6 7 8
3
1
4
2
5
3
6
4
7
5
8
6
9
7
1
0
8

Figure-10b. Possible Moves of a Bishop from position (3,3)


A B C D E F G H I J
Bishops Move
1 3 3
1 2 3 4 5 6 7 8
2
1
3
2
4
3
5
4
6
5
7
6
8
7
9
10
8

Treat the range c3:J10 of a spreadsheet (see Figure-10a or Figure-10b) as depicting the squares of
a chess board; that is, c3:j3 as the first row of the board, c4:j4 as the second row, and so on , and
finally, c8:j8 the eighth row. Similarly, the range c3:c10 depicts the first column, d3:d10, the
second column and so on, and finally the range j3:j10 the eighth column. The row numbers of the
chess board are entered in the column to the left of the board ( that is, in column B, in the range
b3:b10), and the column numbers in the row above the board, that is in the range c2:j2. Initially,
the board is empty. A bishop is to be placed in a certain square of the above board; the row
number and column number of the Bishops position are given in cells A1 and B1 respectively.
Indicate the position to be occupied by the Bishop in colour grey, and the squares to which the
Bishop can move, from the given position, in colour red . Of course, an empty chess board with a
lone Bishop is an absurdity in a real game of Chess; the problem is meant merely to illustrate, for
a learner, the permissible moves of a Bishop.
As per the rules of chess, a Bishop can move to any square in the same diagonal(s) as its current
square, without jumping any square, already occupied by a piece, if any.
For example, suppose the current position of the Bishop is row-3, and column-3 ( as in figure).
Let us refer to each square of the board with its row number and column number, mentioned in
that order. As can be seen from the figure, the Bishop is at the intersection of two diagonals: 1. the
climbing diagonal starting at the square (5,1), and ending at the square (1,5), and 2. the downward
diagonal starting at square(1,1) and ending at square (8,8). The Bishop currently occupies the
square (3,3). Thus, the Bishop can move into a square of any of the above two diagonals, that is

Page 41 of 260

IIMA/CISG0104TEC

into any of the squares (5,1), (4,2),(2,4),(1,5), (1,1), (2,2), (4,4),(5,5),6,6),(7,7), and (8,8). These
squares, according to the problem, are to be filled with red. The square (3,3) which is currently
occupied by Bishop is to be filled with grey.
Although the diagonal squares mentioned in the above discussion can be seen easily, identifying
them for spread sheet formulae requires some effort. Referring to the same example as above, can
we derive a rule that tells whether a given square, say (r,c), is on one of the diagonals passing
through the square (br,bc) in which the Bishop is located? A little reflection reveals that, to move
into a diagonal square, you need to travel horizontally by a certain number of squares from the
Bishops current position, and by the same number of squares vertically. Here, by a horizontal
move, we mean a move rightwards or leftwards, and by a vertical move, a move upwards or
downwards. Therefore, to figure out whether the given square is on a diagonal with respect to the
Bishop, all we need to find is whether the horizontal distance, in squares, between the Bishop and
the given square is the same as the vertical distance between the Bishop and the given square; that
is, whether | br r | equals | bc c |. Thus, the rule to be checked is: is it true that | br r | = | bc
c |? If the answer is yes, then we conclude that the given square is on one of the diagonals and
hence is eligible to receive the Bishop, and no implies the opposite.
To make the example even more concrete, suppose bc = 3, and br = 3; that is the position of the
Bishop is (3,3). We want to find whether the very first square of the chess board, that is square
(1,1) is eligible to receive the Bishop. That is, in formulating the rule we need to use r = 1 and c =
1.
From the above paragraph, the rule turns out to be:
is it true that | 3-1 | = | 3-1 |?
It is easy to see that the answer is yes, leading us to conclude that the Bishop can move into
(1,1) from (3,3).
Proceeding further with the same example, let us express the above rule in terms of spreadsheet
notation; that is using the spreadsheet function for the absolute difference, and cell addresses for
(br,bc), and for (r,c). Therefore we need to use, in the rule, A1 for br, B1 for bc, B3 for r (
remember that the row numbers of the chess board are in the range b3:b10) , and C2 for c
respectively. The function that gives the absolute difference between two numbers is ABS. Thus
the required rule is:
=(ABS(A1- B3) = ABS(B1-C2))
The above rule can also be used to find whether the cell in question , that is the cell C3, is to be
filled with colour red.
Using the same logic as above, we can derive rules that tell us , for any given cell on the chess
board, whether it is to be coloured red. For example, the rule for cell H7 which tells us the
condition to be satisfied for the above formatting is:
=(ABS(A1- B7) = ABS(B1-H2))
Suppose that the rule that tells us whether to format a cell let us call such a rule as a conditional
formatting rulecan be stated with relative and absolute referencing conventions that apply to
cell formulae, and further suppose that the conditional formatting rules also can be copied
between cells. Then, the conditional formatting rules need not be devised separately for each cell;
it is enough to devise the rule for the first cell of the chess board , that is for cell C3, and copy it to
other cells. Such a formula for cell C3 would be:
=(ABS($A$1- $B3) = ABS($B$1-C$2)).
It can be easily verified that the above conditional formatting formula when copied (assuming that
such copying is possible) into cell H7 becomes:
=(ABS($A$1- $B7) = ABS($B$1-H$2)), which is the same one derived above .
The above capability for stating conditional formatting rule for the first cell of a range and making
it applicable ( in a relative sense ) to other cells of the range is indeed provided in EXCEL by the

Page 42 of 260

IIMA/CISG0104TEC

conditional formatting menu option. This option enables us not only to specify the conditional
formatting rule, but lso the format to be applied when the formula is true for a cell. The steps to be
followed in formatting the chess board using the conditional formatting feature are as below:
1. Highlight the range C3:J10, which is the chess-board range
2. In the Home tab of the ribbon, the conditional formatting option is contained in the Styles
group. Click on it.
Home

Styles

Conditional formatting

A box drops down with several options. The option Clear rules for the selection removes existing
formatting rules, if any. Choose it , and then repeat the above step (ie step-2), and choose this time
the option New rule. A box with several rule types appears; for the options, choose Use a formula
to determine which cells to format. Then a dialog box appears for you to type in the conditional
formatting formula, and the desired format. In the text box with the label Format values where
this formula is true, enter the formula that you have already designed for the first cell of the range.
Make sure that the formula has been designed with absolute and relative referencing notation
mentioned above. Then the formula is copied internally ( without the users intervention) to other
cells of the range. There is another button underneath the text box, with the label Format. Click
the button and choose from the resulting format cells dialog box, the desired format, which in the
current problem is to fill the cell with red colour. The above series of choices is summarized
below:
Clear rules clear rules for the selection
Home Styles Conditional formatting New rule
Rule type
Use a formula to determine which cells to format
give the formula for the first
cell, and choose the desired format
click OK.
There is still one more problem to be resolved. Soon after the completion of the above steps, not
only are the cells into which the Bishop can move are coloured red, but also the current position
of the Bishop receives the same colour. The problem however requires that the Bishops current
position should be coloured grey, and not red.
The grey colour for the current position can be obtained by entering an additional rule for the
whole range of the chess board by the same new rule route as above; the conditional formatting
rule now should be:
=AND($A$1 = $B3, $B$1 = C$2),
which , expressed in words means,
Are both the following conditions true?:
the row number of the first cell is equal to the row number of Bishops current position
the column number of the first cell is equal to the column number of Bishops current position
In the conditional formatting rules input box, grey colour is chosen by pressing the Format
key.
Now every cell of the chess board has two rules for conditional formatting. There is no guarantee
that for each cell one and only one of them will be true. Indeed for the cell currently occupied by
the Bishop, both the rules will be true. In that case, how is the cell formatted? with red, grey, or a
mixture of both?
The answer is that the rules are organized into a priority order, with the first entered rule getting
the lowest priority, and the last getting the highest priority. The cells format would be the one
corresponding to the first rule in the priority order that becomes true. In the current example, the
second rule gets the higher priority, and hence, the cell containing the Bishop would be coloured
with grey. For each of the other cells only the first-entered rule would be true, and hence they
would be coloured red.

Page 43 of 260

IIMA/CISG0104TEC

The cells coloured as a result of putting the Bishop in position (1,3) or in position (3,3) are shown
in Figures 10a, and 10b respectively.
Conditional formatting: General remarks

The option of formatting cells for which a given formula would be TRUE is quite flexible,
general, and can handle the requirements in a variety of situations. For simpler, more specialized,
and frequently required conditions, the conditional formatting feature provides other options that
would make the users task simple. The reader is encouraged to explore each of the several options
provided by excel under the new rule option. These are:
Format all cells based on values. Here the user can specify for example a colour for the minimum
vale of the chosen range, another colour for the maximum. The system will develop a colour
range beginning with the colour for minimum and ending with the colour for maximum, and
applies the appropriate colour for each value depending on where it occurs between the maximum
and minimum.
Format only cells that contain : Here the user can format a cell based on whether the cell has a
value that is 1. equal to a specific value, 2. greater than a specific value, 3. less than a specific
value, 4. not equal to a specific value, 5. not greater than a specific value, 6. not less than a
specific value, 7. in between two specific values, or 8. not in between two specific values. The
specific values can be given constants, or cell addresses that contain constants.
This option is not confined to cells with numerical values. It can also be used to conditionally
format cells with text values, with date values, with blanks, non-blanks, error messages and no
error messages.
Format only top or bottom ranked values. This option allows the user to specify that the top n or
bottom n values for a specified n should be formatted according to a chosen format. n can also be
specified as a percentage.
Format only values above or below average. This option allows the user not only to specify that
the cells above or below the average value of the chosen range be formatted, but also those which
are one, two or three standard deviations away from the average.
Format only unique or duplicate values.
Conditional Formatting versus Advanced Filter. The option of advanced data filter also serves
somewhat the same purpose as conditional formatting, namely to draw attention to records that
meet specified criteria. However, there are two important differences between the two.
Firstly, conditional formatting rules are reevaluated automatically whenever the contents of any
of the cells change; in the case of advanced filter, the filter needs to be applied again.
The conditional formatting rules can be specified at cell level, whereas the data filter selects a
whole record or rejects a whole recordnot individual cells in a record.

Page 44 of 260

IIMA/CISG0104TEC

II.11 Example-11. A Preventive Maintenance System


Through this example we discuss how dates and date arithmetic are handled in Excel.
Suppose the following data for a set of machines is available: the date on which last preventive
maintenance was done, and the gap in days after which the next preventive maintenance has to be
undertaken. Using this data, we have to compute the date of next preventive maintenance for each
machine, and indicate everyday the machines whose preventive maintenance is over-due as on that
day.
A spread sheet for the above problem is shown in Figure -10.
From the column headings of the spread sheet it is clear that Columns A,B, and C contain the input
data, whereas D and E contain the computed values. Column A contains the machine code
(MCODE) of each machine entered as a string. Column B contains the date on which the last
preventive maintenance (DateLPM) has been carried out for the corresponding machine. This date is
entered as a string with three numbers, each number having a maximum of two digits, separated from
its successor by a slash(/). The first (left most) number stands for the day number within the month,
the next number stands for the month number within the year, and the last number for the year
number . Unless otherwise specified these entries are treated as normal strings by the general spread
sheet operations. Column C contains the specified maximum gap (PMCycle) in days between
successive preventive maintenances of each machine. The entries in this column are simple numbers.
For each machine, the gap specified in column C is added to the date of last preventive maintenance
in column B to get the date of next preventive maintenance (DateNPM) in column D. The current
date ( that is, today's date) is available in cell E2; this is compared with the next preventive
maintenance date in column D to see whether an over-due warning for a machine needs to be
generated.
Let us now explain the formulae in the output columns in detail. Consider first the generation of next
preventive maintenance dates in column D. This generation consists of two stages: first to increment
the date in column B by the number of days in column C; and second to display the result, whatever
its internal representation, in the date format (dd/mm/yy). For the first task, Excel requires that each
value that participates in an increment operation be a number. So far as the values in column C are
concerned, this does not pose a problem because they are already entered as numbers. There could be
however some doubt about the entries in column B. The moment you enter a number followed by a
9slash followed by another number, Excel system recognizes the entry as a date. Dates are
represented internally by the system as serial numbers. The serial number of a date is the number of
days the date is aware from January 1, 1900. The serial number of January 1, 1900 itself is 1, that of
January 2, 1900 is 2, and so on. The Excel date system allows any date between January 1, 1900 to
December 31, 9999. Thus, since it is the internal representation that matters even the data entered in
column B does not pose a problem. The formula in cell D8 therefore would be =B8+C8. Copy this
formula to cells D9:D12. As per the above explanation, the result of this formula would be a number,
which is nothing but the serial number of the date of next preventive maintenance. The numerical
property of the cell contents applies however only for its internal representation, which in turn
decides the functions and formulae in which the cell can participate. For the display purposes,
however, we can choose a different format, which in our case should be the date format. This desired
format is specified by choosing the menu options Home Cells Format
Format Cells
Number
Date; in the resulting dialogue box fill in the custom format as DD/MM/YY. Before
invoking the above mentioned option, make sure to highlight the block of cells D8:D13 so that the
format applies to the entire block. This format is used not only for cell D8 but for the whole range
D8..D13. As a result of choosing the display format as above, we are sure to see the serial numbers of
column D as dates. Even if you do not go through the above route, still the Excel system may
succeed in displaying the result of the above formulae in the form of dates using certain default
formats, but there is no guarantee that the defaults would always succeed.

Page 45 of 260

IIMA/CISG0104TEC

Next let us consider the formulae in column E. These formulae output a "*" if the date for next
maintenance is exceeded by today's date; otherwise the output would be a blank. What can be
actually compared are not dates themselves, but the serial numbers of the dates. As mentioned before,
when cells are referred in a formula, the internal values are used while evaluating the formula; what is
being displayed is of no consequence. We know that the values in column D are internally available
as numbers. Therefore we should ensure that todays date also is available in one of the cells, say E2
as a serial number. For this, enter the formula =TODAY() in E2. This function takes the date
directly from the system and converts it to the corresponding serial number; hence, whenever the
system date changes, TODAY() automatically re-evaluates today's date. As in the case of column D,
the serial number contained by cell D2 can also be displayed as a date by using the Format -- Cell
menu option. After obtaining today's date in this fashion, the design of formula in cell E8 (and in
other cells below it) is quite simple: it should be =IF(D8<$E$2," *",""). This means that the output
should be "*" in case the serial number of the next maintenance date, which is contained in cell D8, is
less than the serial number of toadies date, which is contained in cell E2(why the dollar signs?);
otherwise no output is needed. This formula is copied from E8 to E9:E13.
In using this spread sheet, whenever preventive maintenance is done for a machine, the corresponding date has to be entered in column B in the cell of the corresponding machine, so that the
spread sheet always reflects the latest status of the machines.
Date Formats You might have already noticed in the above discussion that the above spread sheet
can produce different results depending on how its data is interpreted. For example, the pattern
03/01/90 can stand for the first of March 1990, or for the third of January 1990 depending on whether
the format being followed is mm/dd/yy or dd/mm/yy. This format is to be declared by the user
through the settings in the Regional and Language options under the control panel of your Windows
system. If you are using Windows 2000 XP, choose the menu, icon, and tab options : Start
Settings
Regional and Language Options
Regional Options
Customize
Date. This will
present you with an interactive screen from which you can choose the setting you want; in particular,
you can choose the format in which the date (dd) and the month (MM) numbers are in the relative
positions you want. Furthermore, you can also choose the separator between the three components in
a date; the normal preferences are / or -. If the suggested options do not contain the pattern you want,
you can type in your own pattern using the following notation:
S.No.
1
2
3
4
5
6
7
8
9

String
d
dd
dddd
m
mm
mmm
mmmm
yy
yyyy

Meaning
Day number in the month, with one or two digits depending on the need
Day number in the month, with two digits, the first digit being zero if necessary
Weekday in words
Month number in the year, with one or two digits depending on the need
Month number in the year, with two digits, the first digit being zero whenever needed
Month name in three letters
Full name of the month
Year number in two digit format
Year number in four digit format

To clarify the notation described in the above table, we present below the different ways in which the
date 17 July 2004 is to be input as per the different settings:
S.No.
1
2
3
4
5
6
7

Format chosen in the


Regional date setting
m/d/yyyy
m/d/yy
Mm/dd/yy
Mm/dd/yyyy
Yy/mm/dd
Yyyy-mm-dd
dd-mmm-yy

How 17 July 2004 is to be input


as per this setting
7/17/2004
7/17/04
07/17/04
07/17/2004
04/07/17
2004-07-17
17-jul-04

Page 46 of 260

IIMA/CISG0104TEC

Before using a worksheet with dates the user should ensure that the desired format is chosen through
the above command. Furthermore, the date strings that are entered in the spread sheet should conform
to the default format chosen as above; if not, an explicit error message will not occur, but wrong
results are produced because of incorrect interpretation when date data is processed.
Five other options are available for displaying in the form of a date the numerical values (standing for
the serial number of a date) stored in a range. These options are displayed when the user chooses the
menu options Cells Format Format Cells, and, within that, clicks on the tab for numbers.
Format Type
1
2
3
4
5

Format
dd/mm/yy
dd-mmm-yy
dd-mmm
mmm-yy
Dd/mm/yy h:mm

It should be noted that the format desired by the user need not necessarily be one among the above
five. In such a case, the desired format (for example, mm/dd/yy) can be typed in the code box.
Other Date Functions
We have discussed above a date function whose output is a serial number. Excel provides four other
date functions, DAY, WEEKDAY, MONTH, and YEAR, which can be used to convert
such a serial number to its day number within its month, day number within its week, month number
within its year, and year number respectively. For example, suppose the International Date Format
chosen through control panel of Windows is dd/mm/yy. Suppose the date 3/1/97 is entered into cell
A1. Then the function =DAY(A1) in any other cell displays the result 3 indicating that within the
month to which the date corresponds, the date falls on the third day. The function =weekday(A1)
displays the result 6 indicating that the given date falls on the sixth day of its week ( counting the
days as Sunday = 1, Monday = 2, ), that is Friday. The function =month(A1) yields the result 1,
and =year(A1), the result 1998.
Figure-11: Spread Sheet of Example 4 (Values are shown)
A

1
2
3
4
5
6
7
8
9
10
11
12

Today
22/6/98
(dd/mm/yy):

MCODE DateLPM
PMCycle DateNLPM
(dd/mm/yy) (Days)
(dd/mm/yy)
M0001
M0002
M0003
M0004
M0005

10/1/98
25/2/98
15/1/98
31/12/97
30/11/97

180
360
360
120
180

Warning

9/7/98
20/2/99
10/1/99
30/4/98 *
29/5/98 *

Page 47 of 260

IIMA/CISG0104TEC

II.12 Example-12: Time-Study Data


To set productivity standards for performing a certain manufacturing task, the Industrial
Engineering department of a company has conducted a time-study of the task. The starting and
ending times of the performance of this task were collected with a stop-watch when different
workers in different shifts performed the task, over a period of three days. The total number of
times the task performance was observed was fifty. The times were recorded in the format date
(dd/mm/yyyy) and time (hh:mm:ss AM/PM), and were entered in the same format in a
spreadsheet in the range I6:J55 ( see the following spread sheet).
In the spreadsheet, obtain in the corresponding cells of column-I the duration in minutes taken by
each task-repetition. In M14:N22, obtain the frequencies of the different durations, from 16min
to 24 minutes.
First of all, to enter the time-study readings in the spreadsheet, set the format of the corresponding
cells (I6:J55) by choosing the following menu options:
Home

Cells Format Format Cells

Number

Custom

In the list of formats exhibited under the custom formats box, if the desired format is available, it
can be chosen. Otherwise in the box with the caption Type: type in the desired format as below:
dd/mm/yyyy hh:mm:ss AM/PM
According to the above format, you need to type in the data in three parts, each separated from the
previous by a space: date, time, and AM or PM. Date is to be given as day, month, and year with
separating slashes; time is to be given in the twelve hour notation with hour,s, minutes, and
seconds, with separating double colons.
The data input as above is represented internally as the serial number corresponding to the date
and a fraction corresponding to the time.
For example, the start time of the very first observation is input as :
01/01/2005 08:15:00 AM.
This is represented internally (which can be verified by changing the format of the above cell to
General) as:
38353.34375
In the above internal representation, 38353 is the serial number of the date first January of 2005,
and 0.34375 is the fraction of the day at which the time 08:15:00 AM occurs.
If the finish time of a task is subtracted from its start time in the spreadsheet, the corresponding
internal are subtracted, yielding a number which is in days, or a fraction of a day. As we want the
duration of the task shown in minutes, the above result is to be converted to minutes by
multiplying it with 24*60 (which is the number of minutes in a day).
Accordingly, the formula in cell K6 for the duration in minutes for the first observation is:
=24*60*(J6-I6)
The above formula can be copied to the range K7:K55.
To count the number of times a certain value of the duration occurs, enter the given duration
values, ie the values 16,17,,24, in the range M14:M22. In the right neighboring cell of each of
the above cells, enter a corresponding COUNTIF formula; that is, in N14 enter the formula

Page 48 of 260

IIMA/CISG0104TEC

=COUNTIF(K$6:K$55,M14)
and copy it to N15:N24.
In the above problem specification, the frequencies were required for discrete values of the
durations, specifically for durations of 18, 19, 20, 21, 22, 23, and 24 minutes. If istead you were
asked to find the frequencies for duration values falling in given intervals, then instead of
COUNTIF, you need to use the array function FREQUENCY. As an illustration, suppose the
given intervals are:
0 < duration 15
15 < duration 18
18 < duration 20
20 < duration 22
22 < duration 24
Note that the intervals need not be equal in width.
For obtaining the desired frequency distribution using the FREQUENCY function, follow steps
given below:
1.

Set apart two column ranges. It is desirable that the two ranges be adjacent, although not
necessary. The length of the first range, called the bin range, is equal to the number of
intervals being dealt with, that is five in this case. The second range, called the
frequencies range, should have a length equal to one plus the length of bin range.

2.

Fill the bin range with upper bounds of each of the cell intervals. In this example, the cell
values of the bin range would be 15,18,20,22,and 24.

3.

Highlight the frequencies range, and enter the formula =FREQUENCY(data range, bin
range) and end the formula with control+shift+enter. The frequencies range would be
filled with the frequencies of the respective intervals denoted by the bin range. The last
cell of the frequencies range contains the number of values greater than the upper bound
of the last interval denoted by the bin range.

The third spreadsheet shown below contains the bins in the range N6:N10. The frequencies are
obtained in the range O6:O11, using the array function
=FREQUENCY(K6:K55,N6:N10)
In the above function, the first range K6:K55 denotes the range that contains different data points,
and the second range N6:N10 the bins range.
Interpretation of Intervals: How FREQUENCY differs with VLOOKUP and MATCH
VLOOKUP when used with range lookup feature interprets the first vector as denoting intervals;
MATCH function also treats the lookup vector as denoting intervals if the match type is 1 or -1.
However, both VLOOKUP and MATCH differ from FREQUENCY, in the way the intervals are
formed using the given data. In VLOOKUP, in the first column of the lookup table, the lower
bounds of the respective intervals are given; In the lookup vector of the MATCH also, the values
of the cells are interpreted to denote the lower bounds of corresponding intervals, if the MATCH
type is 1. In contrast, in the FREQUENCY function, the values in the bins range of a are
interpreted to denote the upper bounds of the respective intervals , and not the lower bounds.
.

Page 49 of 260

IIMA/CISG0104TEC

Figure-12a. Spreadsheet for Time-study Data Analysis


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

I
Start
01/01/2005 08:15:00 AM
01/01/2005 08:25:00 AM
01/01/2005 08:45:00 AM
01/01/2005 09:15:00 AM
01/01/2005 09:30:00 AM
01/01/2005 09:45:00 AM
01/01/2005 10:00:00 AM
01/01/2005 10:15:00 AM
01/01/2005 10:30:00 AM
01/01/2005 10:45:00 AM
01/01/2005 11:00:00 AM
01/01/2005 11:15:00 AM
01/01/2005 11:30:00 AM
01/01/2005 11:45:00 AM
01/01/2005 12:00:00 PM
01/01/2005 12:15:00 PM
01/01/2005 12:30:00 PM
02/01/2005 08:25:00 AM
02/01/2005 08:40:00 AM
02/01/2005 08:55:00 AM
02/01/2005 09:10:00 AM
02/01/2005 09:25:00 AM
02/01/2005 09:40:00 AM
02/01/2005 09:55:00 AM
02/01/2005 10:10:00 AM
02/01/2005 10:25:00 AM
02/01/2005 10:40:00 AM
02/01/2005 10:55:00 AM
02/01/2005 11:10:00 AM
02/01/2005 11:25:00 AM
02/01/2005 11:40:00 AM
03/01/2005 08:12:00 AM
03/01/2005 08:24:00 AM
03/01/2005 08:36:00 AM
03/01/2005 08:48:00 AM
03/01/2005 09:00:00 AM
03/01/2005 09:12:00 AM
03/01/2005 09:24:00 AM
03/01/2005 09:36:00 AM
03/01/2005 09:48:00 AM
03/01/2005 10:00:00 AM
03/01/2005 10:12:00 AM
03/01/2005 10:24:00 AM
03/01/2005 10:36:00 AM
03/01/2005 10:48:00 AM
03/01/2005 11:00:00 AM
03/01/2005 11:12:00 AM
03/01/2005 11:24:00 AM
03/01/2005 11:36:00 AM
03/01/2005 11:48:00 AM

J
Finish
01/01/2005 08:35:00 AM
01/01/2005 08:44:00 AM
01/01/2005 09:05:00 AM
01/01/2005 09:37:00 AM
01/01/2005 09:46:00 AM
01/01/2005 10:05:00 AM
01/01/2005 10:20:00 AM
01/01/2005 10:33:00 AM
01/01/2005 10:49:00 AM
01/01/2005 11:02:00 AM
01/01/2005 11:20:00 AM
01/01/2005 11:37:00 AM
01/01/2005 11:49:00 AM
01/01/2005 12:06:00 PM
01/01/2005 12:20:00 PM
01/01/2005 12:33:00 PM
01/01/2005 12:49:00 PM
02/01/2005 08:44:00 AM
02/01/2005 08:58:00 AM
02/01/2005 09:14:00 AM
02/01/2005 09:29:00 AM
02/01/2005 09:46:00 AM
02/01/2005 10:00:00 AM
02/01/2005 10:16:00 AM
02/01/2005 10:32:00 AM
02/01/2005 10:45:00 AM
02/01/2005 11:01:00 AM
02/01/2005 11:15:00 AM
02/01/2005 11:29:00 AM
02/01/2005 11:43:00 AM
02/01/2005 11:58:00 AM
03/01/2005 08:29:00 AM
03/01/2005 08:43:00 AM
03/01/2005 08:57:00 AM
03/01/2005 09:09:00 AM
03/01/2005 09:20:00 AM
03/01/2005 09:33:00 AM
03/01/2005 09:43:00 AM
03/01/2005 09:54:00 AM
03/01/2005 10:07:00 AM
03/01/2005 10:20:00 AM
03/01/2005 10:33:00 AM
03/01/2005 10:44:00 AM
03/01/2005 10:55:00 AM
03/01/2005 11:10:00 AM
03/01/2005 11:21:00 AM
03/01/2005 11:31:00 AM
03/01/2005 11:45:00 AM
03/01/2005 11:54:00 AM
03/01/2005 12:08:00 PM

K
Durn
20
19
20
22
16
20
20
18
19
17
20
22
19
21
20
18
19
19
18
19
19
21
20
21
22
20
21
20
19
18
18
17
19
21
21
20
21
19
18
19
20
21
20
19
22
21
19
21
18
20

Page 50 of 260

IIMA/CISG0104TEC

Figure-12b. Frequency distribution obtained using COUNTIF

13
14
15
16
17
18
19
20
21
22

M
Duration
16
17
18
19
20
21
22
23
24

N
Frequency
1
2
7
13
13
10
4
0
0

Figure-12c. Frequency distribution obtained using FREQUENCY


5
6
7
8
9
10
11

II.13

M
Interval
<=15
16--18
19--20
21--22
23--24
>=25

N
Bins
15
18
20
22
24

O
Freq
0
10
26
14
0
0

Example-13. To Change the Date Display Format in a Cell or a Range.

Suppose you are required to change the display format of the current date in cell E2 of the spread
sheet of Figure-10 to mm/dd/yy. How do you bring about this change? However as mentioned before
this change in display format does not in any way alter the internal representation of the
corresponding date; the internal representation remains to be a number, standing for the serial number
of the date. Hence a change in the display format does not affect the results of computations in which
the contents of E2 are participating. How to change the display format of a cell is important because,
dates are represented in a variety of ways by different users.
In the previous section we have briefly discussed the steps involved in changing the date display
format of a cell or group of cells. The required steps are listed in Figure-12a. Essentially, you are
required to block the cells concerned and choose the menu commands Cells Format Format
Cells. In the resulting dialog box, choose one of the date formats available, or type in a custom format
(which in this case is mm/dd/yy).
The above procedure becomes rather tedious and time-consuming, if it has to be repeated frequently.
Fortunately, it possible to automate this procedure; not only this, but any set of keystrokes. For this
we need to create what is known as a macro, which is a named code, written in Visual Basic; a
macro can be stored in the same work book as the original worksheet, or in a separate workbook.
When invoked a macro performs the keystrokes and the programming tasks, specified in its code.
Thus, to solve the above problem through a macro, you must learn to perform two tasks: 1. To create
the macro, and, 2. To run the macro. Of course, it is assumed that you already know how to manually
perform the basic task, namely changing the date display format.

Page 51 of 260

IIMA/CISG0104TEC

A macro can be explicitly entered by you in the Visual Basic language, provided you are familiar
with Visual Basic. However, for a beginner, and in most cases, even for an advanced user, it is not
advisable to go through this difficult route. Excel system itself can be made to automatically generate
a macro; for this, before the beginning of the key stroke sequence, instruct your spreadsheet to record
a new macro, while you yourself manually perform the task under consideration. At the end of the
key stroke sequence, instruct the system to stop recording the macro. Between the starting and
stopping of the recording, whatever task was performed by you is translated in to the macro code and
stored in the workbook chosen by you. Once the macro recording is over, you can execute the macro
in one of the following 3 ways:
(1)
(2)
(3)

by going through the menu options View Macros Macros,


by pressing a specified single letter key along with the control key, or
by pressing a button on the spreadsheet to which the desired macro has been assigned.

The name to appear in the list of macros when you choose View Macros Macros Record
Macro, and the single letter-key that should be pressed along with the control key are specified just
before starting the recording itself. The command button for the macro can be created any time after
its recording. For this you need to invoke the Forms tool bar, and from it the button icon.
Application of the above procedure to our example is simple. Suppose you choose the name of your
macro as American Format. Suppose you want to store the macro in the same book as the original
spreadsheet. Suppose you want this macro reference to appear as American Date in Tools menu, and
also want to execute it ,some times, using the short cut, control+ A.
Accordingly, execute all the steps of Figure-12b, with the following entries and choices:
Step-2a: Enter the name of the macro as AmericanFormat.
Step 2b: name of the short cut key: Shift+A
Step 2c: choose the option same work book
Step3: perform all the steps listed in Figure-12a.
For executing the macro, click on the cell E2. Then choose the menu option View
Macros Macros Record Macro. In the resulting Macro dialog box, enter the name
AmericanFormat explicitly in the Macroname input box, or click on the above name in the list
exhibited below. Then click on the command button Run. Immediately, the above macro gets
executed, and you will notice that the display in E2 changes from 22/6/98 to 6/22/98. You could also
execute the macro directly, without going through the Tools menu option by pressing the key
combination Control+Shift+A, which will give the same result as above.
For assigning a command button to the above macro, the steps are as below:
Developer

Controls

Insert

Form Controls.

From Controls click on the icon for button. Then move the mouse pointer to the location at which
you want the button to appear. Holding the left button of the mouse pressed, and drag the mouse over
the rectangular area defining the size of the button. Once you release the mouse button, the Assign
Macro dialog box showing the names of all stored macros appears. Choose the name of the macro to
be assigned to the button, and click OK. Place the mouse pointer on the button and click the right
button of the mouse. In the dialog box that appears, click on the button Edit Text. This would allow
you to change the text on the face of the button.
Note that the macro features power extends far beyond mere automation of keystrokes. Macros can
be written to perform many tasks which are beyond the reach of menu based operations. For
example, through a macro you can create your own dialog boxes, your own user-defined functions.

Page 52 of 260

IIMA/CISG0104TEC

Figure-13a. To set cell format for display of date data


Step-1. Highlight the cells (or range) whose format you want to set.
Step-2. Choose the menu commands Cells Format Format Cells..
Step-3. In the resulting dialog box click on the tab titled Number.
Step-4. Click on the item Date in the list titled Category.
Step-5. In the list titled Format codes a number of date formats are displayed. If the format you
want is available there click on it. Otherwise, enter the desirable format, mm/dd/yy, in the input
box titled Code.
Then click on the OK button to quit the dialog box.
Figure-13b. To record a macro
Step-1. Choose the menu commands: View

Macros Macros Macro

Record Macro

Step-2: The dialog Box titled Record New Macro appears.


2a.In the input box for macro name, type in the name of your macro, which is to be
specified when you want to run, edit or delete the macro later. Fill in the input box for
description with details like author, date, and what the macro does
2b. In the input box for short cut key enter a single letter, or Ctrl+single letter, which
should be pressed along with the control key to invoke the macro.
2c. The box titled store in: presents three options, one of which is to be chosen by pressing
the radio button against it. You can store the code of the macro in a separate workbook, in a
personal macro workbook, or in the current workbook itself as a separate module.
2d. Click the OK button to finish with the dialog box.
Step-3. Perform manually the task to be automated. Note that only your key strokes and menuchoices while you are operating within the spread sheet system can be recorded. While you
perform the task, the macro code gets generated.
Step-4. Once you are through with your recording, stop the recording, by choosing the menu
options View Macros Macros Stop Recording.

II.14 Example-14. Modification of Part Codes


Through this example, we learn how to manipulate strings in a spread sheet. Excel provides several
powerful functions for string manipulation. Some of these will be used in this example, while, for the
use of the others, the reader is referred to Appendix.
Currently ABC company uses the following coding method for its pipes. A pipe code consists of a
minimum of 3 fields; additionally, an imported product consists of one more field, thus making the
maximum number of fields in a pipe code 4. A field is separated from its next field by a dash (-). The
three necessary fields are: 1. the pipe length in (integral) metres. The width of this field varies from 1
to 2 characters. 2. the diameter of the pipe in (integral) centimeters. The width of this field also
varies from one to two characters. 3. The material of the pipe. There are four categories of material
possible: steel, aluminium, plastic, and brass. These are to be denoted by the codes A, B, C, and D
respectively in the part code. In addition, if the pipe is imported its first field consists of the character
F. Thus the code F-5-8-B indicates that the pipe under question is an imported one, with length 5
metres and diameter 8 centimeters, and that it is made of aluminium. Similarly, the code 8-15-D
refers to the non imported brass pipe with length 8 metres and diameter 15 centimeters.

Page 53 of 260

IIMA/CISG0104TEC

The above method has been designed several years back. The systems department, during a recent
study, suggested the following modifications to this coding system.
1. The first character of a pipe code should explicitly indicate whether the pipe is imported or
indigenous. The existing practice of using F as the first character for the imported ones should be
continued, whereas for the indigenous ones the character I should form the first field. This
makes the number of fields in each part code uniformly equal to four.
2. The material code which forms the last field of a part code should be more self explanatory: it
should be the first character of the spelling for the concerned material. Accordingly, in the last
(or fourth) field of their part codes, steel pipes are denoted by S, aluminium pipes by A, plastic
pipes by P, and finally the brass ones by B.
3. To be consistent with some engineering specifications, the diameter of a pipe is to be denoted in
millimeters instead of in centimeters.
Consider for example the existing code 8-5-B. This indicates an indigenous pipe. Hence its first
field in the modified code should be I. The diameter of this pipe is 5 centimeters, which when
expressed in millimeters becomes 50. Hence the third field in the modified code should be 50. The
material is aluminium. Hence the fourth field of the modified code should consist of the character A.
Thus the modified code for the above pipe is I-8-50-A.
All the existing part codes are available in a spread sheet. We are required to produce the modified
code for each of the existing codes using the spread sheet facilities.
Figure-13a shows a spread sheet with a sample of 7 codes in column A, in the range A3:A9. The
other columns consist of various formulae to solve our problem. The new codes obtained by these
formulae are shown in column E. Columns B, C and D show the results of the intermediate steps in
converting the old codes to the new codes. The range G3:H6 consists of the table that shows the old
material codes and their corresponding new ones. Let us now explain in detail how the conversion of
the part codes is achieved. The formulae in the cells of each column are such that it is enough for us
to explicitly enter the formulae in row 3; others are obtained by copying these formulae to the cells in
the remaining rows. Hence, in the following discussion we focus on only the formulae in row 3 of
each column.
Let us first introduce some preliminary notions about strings in Excel. These are the notion of a sub
string, the length of a string, the position of a character within a string, and the concatenation of two
or more strings. A part of a given string is called a sub string of the given string. For example,
consider the string INSTITUTE. The strings INS, TI, STIT are some of the sub strings within the
above string. The length of the above string is nine, which means that the string is made of nine
characters. The character S occurs in the third position of the above string. By concatenating one
string to another we get a larger string, with the second string at the tail end of the first string. For
example, if we concatenate the string ABC with the string DEF we get the string ABCDEF. The
ampersand character,&, is used in Excel as the concatenation operator. In the following discussion
we use string functions that can do the following tasks: 1. To extract the sub string of a given length
from the left end of a given string, 2. To extract the sub string of a given length from the right end of
a given string, 3. In a given string, to replace a specified sub string with another string.
The spread sheet of Figure-13a uses the following steps in converting a given part code to its corresponding new one:

For each part code under consideration, find the new material code to be used, and write it in
column B

Page 54 of 260

IIMA/CISG0104TEC

In each part code, replace the old material code with the new code found in the above step. Write
the resulting intermediate code in column C

If a code obtained in column C does not start with F, then put I as the first field of the corresponding code. Write the resulting codes in column D.

For the diameter value which ends at the last but second position, append the character zero, to
convert the diameter value from centi meters to millimeters, and write the resulting code in
column E. This completes the conversion process.

Let us now examine the formulae in columns B,C,D, and E.


1. Column B shows the new material code to be used in the last field of each of the given part.
These values are easily obtained by using VLOOKUP function, with the old material code as the
value for the table look up, the range $G$3..$H$6 as the table range, and the column position for
the result as 2. However, in order to use this VLOOKUP function, we must be able to first
extract the old material code from the given part code. For this we use the string functions
RIGHT, which can produce as its result the sub string of a specified length, occurring at the right
end of another specified string. Thus the arguments of this function are two in number; the first
one indicates the original string given as a literal (i.e. the string itself enclosed in double
quotation marks), or by the address of the cell which contains the string; the second one indicates
the length in number of characters of the sub string to be extracted as output. In each of the old
part codes the material code consists of only one character, and it occurs at the extreme right of
the part code. Hence, taking the specific case of the code given in cell A3, the function that can
produce the material codes from this part code is RIGHT(A3,1). Therefore, the VLOOKUP
function entered in cell B3 is VLOOKUP(RIGHT(A3,1),$G$3..$H$6,2). This function is copied
from B3 to B4..B9, to obtain the new material codes for the rest of the part codes.
2. Column C shows the partially modified part codes, after the old material code is replaced by the
new material code of column B. This replacement is achieved by using the string function
REPLACE. Among the arguments of this function are an original string, a sub string within the
original string, and a replacement string. The function replaces the given sub string of the
original string with the replacement string; the resulting string is produced as the output in the
cell in which the REPLACE function is contained. The sub string to be replaced is specified not
directly but by means of two arguments: the starting position of the sub string within the original
string, and the length of the sub string in number of characters. Both the original string and the
replacement string can be given within the function as literals or by references to the cells which
contain them. Specifically, the function used in cell C3 is REPLACE(A3, LEN(A3),1,B3). Note
that the first argument is A3 because the original string which needs to undergo modifications is
in cell A3. The second argument should denote the position from where the sub string to be
replaced begins. Here, the sub string to be replaced is the last character of the original string.
Accordingly, the starting position of this sub string is equal to the length of the original string.
The length of a string, in turn is given by the string function LEN. Thus the second argument
above is LEN(A3). The third argument specifies the length of the sub string to be replaced,
which in this case is only one character. Accordingly, the third argument is given as 1. The
fourth and the last argument is the replacement string. This string is contained in cell B3. Hence
the fourth argument is given as B3.
3. The partially modified codes of column C are further modified by incorporating the sub string "I"wherever needed, to get the codes in column D. The above modification, that is appending (or
concatenating) the string contained in column C to the string "I-" is needed only when the code
being dealt with does not belong to an imported item, that is when the first character (or the left
most character) of the code in column C is not the character F. Taking cell D3 as an example, the
formula there should be an IF function. The condition of the IF should be whether the left most
character of the string in C3 is F. If the condition is true, then the output of the IF should be the

Page 55 of 260

IIMA/CISG0104TEC

string in C3 itself without any modification; else, the output should be the string obtained by the
concatenation of the strings "I-" and the string of C3. Thus the IF can be stated informally as IF
(the given condition, C3, "I-" & A3). Note that in the third argument we specify two strings, the
literal "I-" and the string in A3 with the ampersand character in between. The ampersand
character is the concatenation operator, the result of which is to produce the string obtained by
joining the given strings in the given order, (i.e. the second string is attached at the right end of
the first). The IF function is complete except for the first argument. This condition is to be given
as left most character of C3="F". How do we get the left most character of C3? by the string
function LEFT(C3,1). Just as the RIGHT function is used to extract any sub string of given
length from the right end of a string, LEFT is used to extract a sub string of a given length from
its left end. Now, the full IF function in D3 is
IF(LEFT(C3,1)="F",C3,"I-"&C3).
4. We are now left with only one more modification, that is converting the diameter expressed in
centimeters to millimeters. All we have to do for this is append the character zero to what is
already there in the third field of each code in column D. Let us concentrate as before on the first
code of the sample, the one in cell D3. The character in the third field of this string is 5; therefore
after the appending of the zero character, it becomes 50, thus making the complete new code F10-50-A. One way of accomplishing the above task would be to consider the old code as
consisting of the two components, F-10-5,-A. To obtain the new code, we must simply
replace the second component with 0-A, i.e. with 0 appended to the front of the already
existing second component. This is accomplished by the formula given in cell E3.
Figure-14a: Spreadsheet for part code change
1
3
4
5
6
7
8
9

A
OLDCODE
F-10-5-A
10-10-B
8-15-C
F-10-5-B
F-8-5-C
5-5-D
F-4-4-A

B
S
A
P
A
P
B
S

C
F-10-5-S
10-10-A
8-15-P
F-10-5-A
F-8-5-P
5-5-B
F-4-4-S

D
F-10-5-S
I-10-10-A
I-8-15-P
F-10-5-A
F-8-5-P
I-5-5-B
F-4-4-S

E
NEWCODE
F-10-50-S
I-10-100-A
I-8-150-P
F-10-50-A
F-8-50-P
I-5-50-B
F-4-40-S

G H
A
B
C
D

S
A
P
B

Figure-14b : Important Formulae in the Spreadsheet of Figure-12.


Cell Address
B3
C3
D3
E3

Formula
=VLOOKUP(RIGHT(A3,1),$G$3:$H6,2)
=REPLACE(A3,LEN(A3),1,B3)
=IF(LEFT(C3)="F",C3,"I-"&C3
=REPLACE(D3,LEN(D3)-1,2,"0"&RIGHT(D3,2))

Page 56 of 260

IIMA/CISG0104TEC

II.15 Example-15. An Optimal Product Mix Problem


A company produces two products P1 and P2. Each of these products requires processing in three
factories. The time required (in suitable time units) to process each unit of P1 and P2 in each of
these factories is given below:
P1 P2
Plant-1 2 0
Plant-2 0 2
Plant-3 2 2
To explain, the time needed to process product P2 in Plant-3 is 2 time units per one unit of the
product. The time available in each of these plants for production during the next planning
horizon is given below:
Plant
Time available
Plant-1
4
Plant-2
12
Plant-3
18
The per unit profit for each of the products is:
Product
P1
P2

Profit (Rs/unit)
3
5

To evaluate a given product mix plan


You are asked to develop a spreadsheet that can evaluate a given product mix plan for the above
company for the next planning horizon; that is, given the quantities of production of P1 and P2,
the spread sheet should tell us the following:
What is the profit of the given plan?
How much time (capacity) of each plant is going to be consumed if the given plan is
implemented?
A spreadsheet for this is shown in Figure-14a, and its important formulae are tabulated in Figure13b.
Let us assume that the given product mix plan is to produce 2 units of P1 and 4 units of P2. These
quantities are shown in range B8: C8. The per-unit profits of P1 and P2 are shown in cells B4 and
C4 respectively. Therefore, the total profit of this plan is obtained by the formula =
B4*B8+C4*C8. This formula can be also looked at as multiplying the corresponding cells in the
two ranges B4: C4 and B8: C8, and summing the two products so obtained. This is expressed
more elegantly by the function
SUMPRODUCT(B4:C4,B8:C8).
The SUMPRODUCT function is used to multiply corresponding pairs of values in two vectors of
equal length, and summing the products. In Figure-14a, cell F4 is chosen to display the total profit
and hence the formula =SUMPRODUCT(B4:C4,$B$8:$C$8) is entered in it to obtain the total
profit of 36.
The time consumed per unit of production for P1 and P2 in Plant-1 are given in the range B5:C5;
the corresponding values in Plant-2 are given in B6:C6, and those in Plant-3 in B7:C7. For each

Page 57 of 260

IIMA/CISG0104TEC

plant, the total time required by the given product mix is obtained by multiplying the
corresponding values of quantities range with those in per unit time required range, and taking the
summation of the products. Therefore, we can use once again the SUMPRODUCT function for
computing the time consumed in each plant. These formulae are entered in cells D5, D6 and D7 as
shown. For the sake of comparing the time required with time available, the values of time
available in plant-1, plant-2 and plant-3 are entered in E5, E6, and E7 respectively.
Figure-14a shows that the total profit that would be obtained if the given plan were implemented
would be 26 monetary units (value in cell F4). The capacity required in Plants 1,2,and 3 would be
4,8, and 12 time units respectively ( values in range D5:D7). Comparing these values with the
corresponding values in the range E5:E7, it is clear that the given plan consumes the capacity
available in Plant-1 completely, whereas Plants 2 and 3 would be left with surpluses of 4 time
units and 6 time units respectively.
To find an optimal product mix plan.
How do you find a product mix plan that yields the maximum profit while not requiring more
than the given plant capacities?
A product mix plan such as the one you are asked to find is called an optimal product mix plan.
An obvious way of answering the above question is to substitute various different product mix
plans in the range B8:C8. For each such plan note whether the plan is feasible (that is, whether the
quantities are non-negative, and whether the time required is less than or equal to time available in
each plant), and if so its profit. The plan (or plans) which is feasible and has the maximum profit
is the optimal product mix plan. The problem with this approach is that the number of feasible
plans tends to be too large to permit you to do an exhaustive search. Fortunately, through its
solver feature Excel allows you to find an optimal solution directly.
The solver program should be supplied with input so as to ensure the following: it treats the
values in the range (B8:C8) as adjustable; and adjusts them with non-negative values such that
the resulting total profit (that is the value in Cell F4) is a maximum, and the resulting capacities
required (i.e. the values in range D5:D7) are less than or equal to the corresponding capacities
available (that is, the values in range E5:E7).
Follow the steps given below to get the above tasks performed through Solver:
1.

Invoke the Solver feature by clicking on the menu items Data Analysis and
within it by clicking on Solver; alternatively, you can choose the menu path: Data Data
tools Analysis Solver

2.

In the solver parameters window, enter the following data against the boxes
indicated as below.
Item
Set Target Cell
Equal to:
By changing cells:
Subject to the constraints:

Value to be entered/ item to be chosen


$F$4
The radio button Max
$B$8:$C$8
$D$5:$D$7<=$E$5:$E$7

In filling the subject to the constraints box, the following ritual is to be followed:
To add a new constraint, click the Add button.

Page 58 of 260

IIMA/CISG0104TEC

Then a box titled Add Constraint appears. This box has three slots: the first is for entering the
cell reference for the left hand side of the constraint, the second is to choose the type of
constraint ( , , = ), and the third is to give the cell reference (or constant ) for the RHS of
the constraint.
After filling in the add constraint box, press the OK button, to finish with the entry of
constraints, or the Add button to add one more constraint.
1.

After filling in the dialog box as above, click on the button Options. Choose
the following two options by clicking the corresponding radio buttons:

Assume linear model


Assume non-negative
Then click on the button OK to return to solver dialog box
2.

Click on the button Solve.

After finishing the solution procedure, the system prompts you to know whether the solution
needs to be saved. Reply in the affirmative to see the answer as shown in Figure-14C. According
to this, the maximum possible profit is 36 monetary units, and an optimal production plan is to
produce 2 units of P1 and 6 units of P2. With this plan, the available capacities in Plants 1 and 2
would be completely consumed and Plant-3 would have 2 units of un-used capacity.
The type of optimization problem described above is called a linear program (LP).
Mathematically, the linear program of the above problem can be formulated as:
Find x1 and x2 to
(1) Maximize 3x1+5x2
Subject to:
(2) 2x1 4
(3) 2x2 12
(4) 2x1 + 2x2 18
(5) x1 0
(6) x2 0

The expression in (1) is called the objective function of the problem and the inequalities in
(2)(6) are called constraints; for each inequality the value to the right of less than or equal to is
called the right hand side (RHS). In a general LP, you can have inequalities of greater than or
equal to () , or equal to (=) types also. When you are solving an LP with more thane one type of
inequality, it is a good practice in Excel to group the different types of constraints together while
entering their coefficients and RHS values. Accordingly, while specifying the constraints in the
solver dialog box, you have to specify not just one set (unlike in the present case) but different
sets depending on the different groups you have.
To find a product mix to attain a given total profit
Suppose you are asked to find a feasible product mix that yields a profit of 33 monetary units. A
solution can be found using the same steps as above, except that while setting the target sell equal
to Max (which means compute the maximum value of the specified target cell), click on the radio
button equal to; in the slot titled value of , enter the goal to be attained, that is the value 33. When
you click the button solve, the system finds the desired product mix as quantity of P1=1, and
quantity of P2 = 6; these values are stored in the range B8:C8 as before. This process is called

Page 59 of 260

IIMA/CISG0104TEC

goal seeking. Remember that goal seeking does not always succeed, and sometimes the process is
prone to numerical inaccuracies.
Figure-14a. Evaluation of a given product mix plan
A
3
4
5
6
7
8

Proft/unit
Plant-1
Plant-2
Plant-3
Quantity

B
C
D
Product-1 Product-2 LHS
3
5
2
0
4
0
2
8
2
2
12
2
4

E
RHS

F
Tot.Profit
26

4
12
18

Figure-14b: Important formulae in Figure-14a.


Cell
F4
D5
D6
D7

Formula
=SUMPRODUCT(B4:C4,$B$8:$C$8)
=SUMPRODUCT(B5:C5,$B$8:$C$8)
=SUMPRODUCT(B6:C6,$B$8:$C$8)
=SUMPRODUCT(B7:C7,$B$8:$C$8)

Explanation
Profit = (quantity* profit per unit)
Time taken = (quantity* time per unit)

Figure-14C: An optimal product mix plan.


A

3
4
5
6
7
8

B
C
D
E
F
Product-1 Product-2 LHS RHS Tot.Proft
Proft/unit
3
5
36
Plant-1
2
0
4
4
Plant-2
0
2
12
12
Plant-3
2
2
16
18
Quantity
2
6

Page 60 of 260

IIMA/CISG0104TEC

II.16 Example-16. How to solve Transportation Problems with Excel.


Suppose you are required to satisfy the demand for a certain commodity at three different
destinations, D1, D2, and D3 with what is available at two different origins (or sources), S1 and
S2. The quantities available at S1 and S2 are 3 units and 6 units respectively, and the demands at
D1, D2, and D3 are 2,3, and 4 units respectively. As the total supply is the same as the total
demand, obviously, there is at least one feasible allocation of the commodity between the origins
and destinations. As the number of origins is less than the number of destinations, at least one of
the origins has to supply to more than one destination. Indeed, there is more than one feasible
solution to this problem. Two feasible solutions are shown below:

Solution-1. S1 to D1: 2 units


S1 to D2: 1 unit
S2 to D2: 2 units
S2 to D3: 4 units
Solution-2. S1 to D1: 1 unit
S1 to D2: 2 units
S2 to D1: 1 unit
S2 to D2: 1 unit
S2 to D3: 4 units
The above solutions could be shown more conveniently in the form of matrices, as below, with
each source denoted by a row of the matrix, and each destination by a column, the value in a cell
indicating the quantity to be supplied by the corresponding source to the corresponding
destination:
Solution-1:

S1
S2
Demand

D1
2

D3

D2
1
2
3

D1
1
1
2

D2
2
1
3

D3

4
4

Supply
3
6

Solution-2:

S1
S2
Demand

4
4

Supply
3
6

The per unit transportation cost ( monetary units/ unit transported) between each origindestination pair is different and is given by the following matrix:
Cost matrix:

S1
S2

D1
2.9
2.3

D2
4.2
8

D3
0.8
7.1

As per the above cost matrix, the cost of solution-1 is 2*2.1 + 1*4.2 + 2*8 + 4*7.1 = 54.4
monetary units (mu), and that of Solution-2 is 1* 2.9 + 2*4.2 + 1*2.3 + 1*8 + 4*7.1 = 52.0 mu. It
is quite possible that there are some more feasible solutions. The important question is: among all
the feasible solutions to the above transportation problem, which is a least cost solution?

Page 61 of 260

IIMA/CISG0104TEC

The above problem can be formulated as a linear program, by using the following symbols:
x(i,j) to denote the quantity to be supplied by origin i to destination j,
c(i,j) to denote the per unit cost of transportation from origin i to destination j,
d(j) to denote the demand at destination j,
and s(i) to denote the supply at origin i, i = 1,2 and j = 1,2,3.
Of course, in the problem we are given c(i,j), d(j), and s(i) for all i and j, and we are required find
values for x(i,j) for I = 1,2 and j =1,2,3.
With the above symbols, the linear program can be written as:
Find x(i,j), i =1,2 and j = 1,2,3 to
Minimize
c(1,1)*x(1,1)+c(1,2)*x(1,2)+c(1,3)*x(1,3)+c(2,1)*x(2,1)+c(2,2)*x(2,2)+c(2,3)*x(2,3)
Subject to:
x(1,1)+x(1,2)+x(1,3)
x(2,1)+x(2,2)+x(2,3)
x(1,1)
+x(2,1)
x(1,2)
+x(2,2)
x(1,3)
+x(3,3)

=
=
=
=
=

3
6
2
3
4

x(i,j) 0, i = 1,2 and j =1,2,3

We need not worry about specifying the requirement that the variables need to assume only
integral values; the problem structure automatically guarantees that requirement.

Solver dialog boxes: Some comments


Details of the various features of Solver and the algorithms behind it are given in the
paper by Flystra etal ( Flystra, Daniel; Lasdon, Leon; Watson, John; Waren, Allen,
Design and Use of Microsoft Solver, Interfaces, Vol 28, Sep-Oct 1998, pp 29-55); some
of the points of the above paper relevant to this note are summarized below:
1. Some of the terminology, particularly the terms target cell, and changing cells are not standard
in the linear programming field. The above non-standard terms were chosen in order that they are
compatible with those of the EXCEL feature Goal Seek.
2. Solver is used not only to solve linear programs but also for pure integer programming, zeroone programming, mixed integer programming and non-linear programming problems.
3. Different algorithms work well for different problems; further, in large problems the procedure
takes a long time to arrive at the exact optimal solution. At times, the numerical errors go out of
bounds leading to absurd solutions. Solver provides a number of options for the user to exercise
control on efficiency and accuracy. For some options, the values need to be specified by the user,

Page 62 of 260

IIMA/CISG0104TEC

some are chosen or not chosen through check boxes, and in others the algorithm to be used can be
chosen from a few choices available. These can be accessed by the solver options dialog box.
4. The two main solution procedures are simplex method, meant for linear programs, and
generalized reduced gradient algorithm (GRG2), meant for non-linear programs. Integer programs
are solved by branch and bound, which fixes the values of only a subset of integer variables at
each node, while not imposing the integer restriction on other integer variables, and solves the
relaxed problem as LP. If the objective function and constraints are linear, then the relaxed
problem is a linear program.Appendix-12 explains the various options provided to the user in
dealing with the above algorithms.
5. The user should keep in mind the fact that SOLVER is a part of a spreadsheet and is not a
dedicated optimizing package. Hence, it may not be as rugged as some of the major dedicated
optimization packages like CPLEX. Furthermore, SOLVER itself imposes limits on the
maximum size of the optimization problem that can be fed to it. For a linear program ( for which
the option assume linear model is chosen), the maximum number of variables is 200, while there
is no explicit limit on the number of constraints. For a non-linear program, the maximum number
of decision variables is 200; maximum number of constraints on variables which are not decision
variables is 100; in addition, a lower bound and upper bound can be specified on each decision
variable, and any of the decision variables can be restricted to be an integer.
6. Several third party products are available that can be added on top of EXCELs built-in
SOLVER, to enhance its performance and the size of problems that can be handled.
7. Getting Solver Executed through a Macro
While executing Solver for the first time store your key strokes in a macro, say Macro1
Assign the macro to a command button
o

Developer

Controls

Insert

Click on the icon corresponding to a command button in the form controls group.

Place the mouse pointer at a desired location on the spreadsheet , press the right
button of the mouse, and drag the mouse to expand the command button to the
size you want.

In the assign macro dialog that automatically appears, choose the macro
(Macro1 in this case) from the list of existing macro names and click OK

View the macro code by performing the following steps:

Right click on the command button

In the ensuing dialog box, choose assign macro and click Edit.

VBA editor opens and displays the macro code as below:

Page 63 of 260

IIMA/CISG0104TEC

Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+Shift+M
'
SolverOk SetCell:="$F$4", MaxMinVal:=1, ValueOf:="0", ByChange:="$B$8:$C$8"
SolverAdd CellRef:="$D$5:$D$7", Relation:=1, FormulaText:="$E$5:$E$7"
SolverOk SetCell:="$F$4", MaxMinVal:=1, ValueOf:="0", ByChange:="$B$8:$C$8"
SolverOptions MaxTime:=100, Iterations:=100, Precision:=0.000001, AssumeLinear :=True,_
StepThru:=False, Estimates:=1, Derivatives:=1, SearchOption:=1, _
IntTolerance:=5, Scaling:=False, Convergence:=0.0001, AssumeNonNeg:=True
SolverOk SetCell:="$F$4", MaxMinVal:=1, ValueOf:="0", ByChange:="$B$8:$C$8"
SolverSolve
End Sub

You will notice that in the above dialog box SolverOK statement appears twice; delete one of the duplicate
lines.
Edit the statement SolverSolve as
Solver Solve True. You will get the following edited VBA code which can be saved and executed by
pressing on the command button created above:
Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+Shift+M
'
SolverReset
SolverAdd CellRef:="$D$5:$D$7", Relation:=1, FormulaText:="$E$5:$E$7"
SolverOptions MaxTime:=100, Iterations:=100, Precision:=0.000001, AssumeLinear _
:=True, StepThru:=False, Estimates:=1, Derivatives:=1, SearchOption:=1, _
IntTolerance:=5, Scaling:=False, Convergence:=0.0001, AssumeNonNeg:=True
SolverOk SetCell:="$F$4", MaxMinVal:=1, ValueOf:="0", ByChange:="$B$8:$C$8"
SolverSolve True
End Sub

The meanings of the calls SolverReset, SolverAdd, SolverOK, and SolverSolve, along with a few other
solver functions are described in Appendix-12.
At times, the execution would not be successful, with an error such as the following appearing on the
screen:
Compile error: Sub or Function not defined
might result if a link to the the file solver.xlam is not properly given in VBA.
Check that Solver reference exists in VBA by clicking on Tools References in VBA. A list of references
with check boxes against them appears . If you do not find in the list the item SOLVER with its check box
ticked, then you need to choose solver.xlam from an appropriate library and incorporate it in VBA. In the
authors desktop,for Office-2007 and excel-2007, the path in which the above file is found is:
c:\program files\Microsoft Office 2007\Office12\library.

Page 64 of 260

IIMA/CISG0104TEC

Figure-16a. Transportation Problem. Spreadsheet Layout-1.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

ObjFn

38.1

ObjInitial

54.4

VarNames
CostCoefs
VarValues
VarInitial

X(1,1)
2.9
0
2

X(1,2)
4.2
0
1

X(1,3)
0.8
3
0

X(2,1)
2.3
2
0

X(2,2)
8
3
2

X(2,3)
7.1
1
4

LHS

RHS

Constraints
S1
S2
D1
D2
D3

1
0
1
0
0

1
0
0
1
0

1
0
0
0
1

0
1
1
0
0

0
1
0
1
0

0
1
0
0
1

3
6
2
3
4

3
6
2
3
4

Figure-16b. Important formulae in the above spread sheet.


Cell
B5
E5
I13

Formula
Sumproduct(C8:H8,C9:H9)
Sumproduct(C8:H8,C10:H10)
Sumproduct(C13:H13,C$9:H$9)

Explanation
Value of objective function, to be minimized
Value of objective function with initial solution
LHS of S1 constraint; copied to 14:I17

Figure-16c. Solver parameters for the above problem


Parameter
Target cell
Equal To:
Changing cells
Constraints
Options

Value
B5
Min
C9:H9
I13:I7 = J13:J17
Assume linear model
Assume non-negative

Spreadsheet Layout-1 for the above problem.


An Excel spreadsheet containing the above formulation is shown in Figure-15 a. The spreadsheet
also shows the optimal solution given by Excel Solver. The main features of this formulation are:
1. The range C9:H9 is set apart for containing the values of the six variables respectively. These
cells are to be filled by some initial values which are later adjusted by solver while solving the
problem.
2. The cost coefficients of the variables in the objective function are given in range C8:H8.
3. The formula that evaluates the objective function is given in cell B5. The formula is:
SUMPRODUCT(C8:H8,C9:H9)

Page 65 of 260

IIMA/CISG0104TEC

4. There are five constraints in the problem. The coefficients for each are given in corresponding
rows of the range C13:H17, the coefficients of the constraint of S1 in C13:C17, those of S2 in the
next row, and so on. These coefficients are 1s and zeros.
5. For each constraint the LHS is evaluated in a corresponding cell of range I13:I17 and the RHS
values are given in the range J13:J17. For example, the LHS formula of the first constraint is
given in cell I13; this formula is SUMPRODUCT(C13:H13, C$9:H$9).The formula from I13 is
copied to cells I14:I17, to get the formulae for LHS of the other constraints.
6. For the sake of comparison, and for repeated use, the vector of initial solution (this could be
arbitrarily chosen by the user) is stored in the range C10:H10, and the corresponding objective
function value in E5.
With the above layout, it is clear what we need to tell the solver:
The values in rage C9:H9 need to be adjusted to minimize the value in the target cell B5, subject
to the constraint that LHS values in range I3:I7 should be equal to the RHS values in the
corresponding cells of the range J13:J17, that is I3:I17 = J13:J17.
The solver parameters are shown in Figure -15 c.
Figure -15 a shows in C9:H9 the solution found by solver and in B5 the corresponding objective
value. It should be noted that the optimal solution is different from the two solutions, solution-1
and solution-2, mentioned in the beginning.
Spread sheet Layout -2.
In the above layout, the cost coefficients and solution values are given as row vectors; similarly,
each constraint is explicitly represented as one row. Instead, we could store the cost coefficients in
a two dimensional array of cells (or a two dimensional range), one row corresponding to each
origin, and one column for each destination; and the solution values also in another two
dimensional range. The resulting layout would be more elegant than the earlier one. See Figure-15
d for the alternative layout.
The cost coefficient matrix is given the range name CMat, the solution matrix the name XMat.
The supplies available at each origin are given as a column vector with range name Sups, the
demands at each destination as a row vector with range name Demnds. The cell that contains the
formula for computing the value of the objective function is given the name ObjFn. The LHS
values of origin constraints are obtained by summing all outflows from the corresponding
origins, are obtained through formulae in range XSups; similarly, the LHS values of destination
constraints are given in the range XDemnds.
With the above layout and range names, we would like to give the following instruction to solver:
Minimize the value of target cell ObjFn, by adjusting the values of variables in XMat, subject to
the constraints:
XSups = Sups
XDemnds = Demnds
And all variables should be non-negative.
The various formulae, range names and solver parameters are given in Figure-15f and Figure-15g.
The second layout is compact because it eliminates the need for showing the constraint
coefficients explicitly.

Page 66 of 260

IIMA/CISG0104TEC

Figure-16d : Transportation Problem. Initial Solution


A
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

ObjFn
Cost Matrix
(C7:E8)
S1
S2
Demands

D1
2.9
2.3
2

D2
4.2
8
3

D3
0.8
7.1
4

Supplies
3
6

54.4

X Matrix
(C15:E16)
S1
S2
Demands

D1
2
0
2

D2
1
2
3

D3
0
4
4

Supplies
3
6

Figure-16e: Transportation Problem. Optimal Solution


A
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

ObjFn
Cost Matrix
(C7:E8)
S1
S2
Demands

D1
2.9
2.3
2

D2
4.2
8
3

D3
0.8
7.1
4

Supplies
3
6

38.1

X Matrix
(C15:E16)
S1
S2
Demands

D1
0
2
2

D2
0
3
3

D3
3
1
4

Supplies
3
6

Figure-16f: Range names in the spreadsheet for transportation problem


Range address
C7:C8
C15:E16
C17:C19
F15:F16
F7:F8
C9:E9
H5

Range name
CMat
XMat
XDemnds
XSups
Sups
Demnds
ObjFn

Expanation
Cost matrix
Solution matrix
Vector of total inflows for destinations
Vector of total outflows for origins
Vector of supplies at origins
Vector of demands at destinations
Value of objective function

Figure-16g. Solver Parameters for the Transportation problem


Solver Parameter
Set Target Cell
Equal To:
By changing cells
Subject to Constraints

Value
ObjFn
Min
XMat
XDemnds >= Demnds
XSups <=Sups

Page 67 of 260

II.17.

IIMA/CISG0104TEC

Example-17. Determination of Sample Size.

A machine M in a workshop is used for cutting steel tubes to a specified length. To ensure quality,
the quality control department wants to introduce a periodical inspection scheme. Every week, a
sample of steel tubes is taken and the length of each item of the sample is measured and the
average length of the sample computed. The average is used as an estimate of the mean length of
the population of tubes produced by the machine. Based on experience with the earlier behavior
of the machine, it can be assumed that the population of lengths follows a normal distribution
with standard deviation ( Sigmax) 0.1 cm. The mean has a tendency to shift slightly from time to
time. While in a meeting of the various managers to discuss the above estimation scheme, every
body agreed that it would be impossible to estimate the exact population mean, no matter how
large the sample size. Given a sample size, n, and a given tolerance ( that is, the allowed
maximum absolute difference between the population mean and sample average), the probability,
alpha, of the absolute difference between the actual sample average and the population mean
exceeding the tolerance can be estimated. Conversely, given alpha, and the tolerance, what should
be the sample size such that the probability of the absolute difference between sample average and
population mean is less than or equal to (1-alpha)?
A standard equation available in statistics books for the minimum sample size (n) to satisfy the
above criterion is (see for example pages 152-154 of the book Hadley, G., Introduction to
Business Statistics, Holden-Day, 1966, for a derivation of the formula):
n = ( F -1 ( 1- (alpha/2)) * sigmax/tolerance))2
where F-1 () indicates the inverse cumulative distribution function for standard normal
distribution.
But how do you choose alpha? The lesser the alpha the more the confidence we have in the
sample result, but the greater the sample size. The same is the case with the tolerance. Therefore
the management of the above company requires that the value of n be found for different
combinations of alpha and tolerance.
The following spreadsheet achieves the above task by finding the value of n in cell G4 for
Sigmax = 0.1 cm, alpha = 0.2, tolerance = 0.05 cm. For these values the above formula yields n =
21.64758. As this value is not an integer, the required sample size is obtained by using the
CEILING function to obtain a sample size of 22 in cell G4.
Sample sizes for different combinations of alpha and tolerance are obtained through the data table
feature as below:
In D7:H7 enter the range of alpha values in your combinations; in C7:C12 enter the different
values of tolerance in your combinations. In C7 enter the formula =G4, that is the value to be
tabulated. Highlight the table range C7:H12, and choose the menu options Data What if analysis
Data Table. In the resulting dialog box identify D4 as your row input cell and E4 as your
column input cell.
The results of the above data table can be visualized well by presenting them in the form of a
chart (or graph) as shown in the figure below. Excel presents you with a wide variety of chart
types; the type we want is the scatter, which deals with a series of data values ( each presented as
a column or row); the first series is taken as values on the x-axis and each of the other providing
values on Y-axis, each series corresponding to a separate line on the chart. Before inserting the
chart, highlight the range of the data series, including the series for x-axis values. In the current
example the range to be highlighted is C8:H12.

Page 68 of 260

IIMA/CISG0104TEC

Then the chart is to be inserted by the menu choices


Insert

1
2
3
4
5
6
7
8
9
10
11
12

Chart

Scatter

C
D
E
F
G
H
I
J
K
Determination of Sample Size
(Reference: Hadley, G., Introduction to Business Statistics, Holden-Day, 1966, Pages 152-154)
n
Nrounded
Sigmax Alpha Tolerance
0.1
0.02
0.05
21.64758
22
Data Table for n; each column for a value of Alpha, and each row for one value of tolerance
22
0.025
0.02
0.015
0.01
0.005
0.05
21
22
24
27
32
0.04
32
34
37
42
50
0.03
56
61
66
74
88
0.02
126
136
148
166
197
0.01
503
542
592
664
788

Formulae in the above spreadsheet

S.No.
1
2

Cell Address
F4
G4

Formula
=((C4/E4)*NORMSINV(1-D4/2))^2
=CEILING(E4)

The resulting chart would display a series of curves that you do not want; by default, excel uses
the first row of the highlighted range as values for x-axis, and each of the other rows for one of
the Y-axis series. We want exactly the opposite: the first column to represent the x-axis values
and each of the other columns to represent a Y-axis series. The get excel modify the default
interpretation in the above way, use the menu options, after clicking the chart boarder
Chart tools

Design

Data

switch row/column

Now you would see the chart with five curves; the curves representing the way sample size
changes with tolerance. For each curve the x-axis is the tolerance; each curve corresponds to a
value of alpha, the bottom most to alpha = 0.025, the next to alpha=0.02, the next to 0.015, and so
on , and the finally the top most to alpha = 0.005.
The formatting of each of the above curves, particularly, their thickness, line colour, and the
pattern of dashes, can be changed according to your convenience. To accomplish such changes,
first click the curve in the chart to which you desire to make the changes, and then select the
following menu options:
Chart tools

Format

Format selection

Page 69 of 260

IIMA/CISG0104TEC

Page 70 of 260

IIMA/CISG0104TEC

III. Exercises-I

Page 71 of 260

IIMA/CISG0104TEC

III. Exercises-I
1.

A Copying Problem
1
2
3
4
5
6
7
8

1
5
9

2
6
10

3
7
11

4
8
12

-2
-3
-4

-1

Consider the cells D1:J8 in a spreadsheet as shown above. What is shown on the screen in cells
J6 and G8 is concealed from you. The formula behind cell H7 is: =F2-D3+$d$1. This
formula is copied to cells J6 and G8. With the entries in other cells as shown above, what will be
the formulae behind J8 and G6, and which values are displayed in these cells as a result of
evaluation of these formulae? Assume the format of display is the same for all cells, and is
Numeric General; and that all the columns not shown above have zero values.
Answer:
Formula in J8:
Value in J8:
Formula in G6:
Value in G6:

2.

An NPV Question.
B
10
11
12
13
14
15

0.18
NPV:
YearNo.
Inflow
Outflow

0
1000

1
500
100

2
500
100

3
500
200

Consider the above spread sheet in which the formula behind cell C11 is:
=NPV(B10,D12:F12)+C12. This formula is supposed to find the NPV of a three year
project with cash in-flows and out-flows shown in rows 14 and 15 above. What is visible on the

screen in the cells in row 12, and in cell C11 is concealed from you. What are the
formulae behind cells C12,D12,E12, and F12?
Answer:

Page 72 of 260

IIMA/CISG0104TEC

3. A Four-Year Investment
A four-year project consists of making an investment at time zero, and receiving revenues at times
1,2,3,and 4. A spreadsheet is to be setup to analyse the above cash flows. With respect to the
above context, answer the following two questions, which are independent of each other.
Question-1.
Suppose, as in the following figure, the following are given as inputs (ie the corresponding cells
are filled with numerical values as mentioned):
Revenues at times 1,2,3, and 4 in cells B4,C4,D4 and E4 respectively;
Discount rate in cell B1; and
Value of NPVin cell G4.

1
2
3
4
5

A
DiscRate
Investment at 0

Revenue at 1
1000

Revenue at 2
2000

Revenue at 3
3000

Revenue at 4
4000

0.18
NPV
2000

Write a formula in A4, which should work for any valid inputs, to compute the corresponding
investment, which is to be shown as a positive value:
Formula in A4:___________________________________________________
Question-2.
Suppose, as in the following figure, the following are given as inputs (ie the corresponding cells
are filled with numerical values as mentioned).
Discount rate in cell B1
Investment, a positive value, in cell A4,
Revenues at times 1,2, and 3 in cells B4,C4, and D4 respectively, and
Value of NPV in cell G4.
1
2
3
4
5

A
DiscRate

0.18

Investment at 0
4172.87

Revenue at 1
1000

Revenue at 2
2000

Revenue at 3
3000

Revenue at 4

NPV
2000

Write a formula in E4,which should work for any valid inputs, to compute the revenue at time 4.
Formula in E4: ________________________________________________________

Page 73 of 260

4.

IIMA/CISG0104TEC

Distances On a Square Grid

A square grid consists of six horizontal lines and six vertical lines, evenly spaced at 10-meter
intervals. The x-coordinates for the six vertical lines , expressed as their distance from the y-axis
in centi-meters, are 0, 1000, 2000, 3000, 4000, and 5000; similarly, the y-coordinates for the
horizontal lines, expressed as their distance in meters from x-axis, are 0, 10, 20, 30, 40,and 50
respectively. Consider, the 36-points formed by the intersection of the above lines . A spreadsheet
is to be designed to compute the distance in meters of each of the above points from the origin.
The x-coordinates of the points are given, as shown in the following figure, in the range B9:B14,
and the y-coordinates in the range C8:H8. Each cell in the range C9:H14 corresponds to a point in
the above grid, with its x-coordinate in the corresponding cell in column-B, and y-coordinate in
the corresponding cell in row-8.
1
2
3
4
5
6
7
8
9
10
11
12
13
14

100

200

40001

10

20

30

40

50

0
1000
2000
3000
4000
5000

The distances from origin of each of the above points are to be obtained in C9:H14 using the
Data Table feature.
Cell C5 consists of the formula = (A5/100)^2 + (B5)^2
Question 1.
What is the formula in cell B8? The formula can have any constants and arithmetical operators,
but cannot use any cell address other than C5.
Formula in B8:____________________________________________________
Question 2.
Give below the row input cell and column input cell that are to be specified in the window that
appears when Data Table menu option is invoked to compute the distances mentioned above.
Row input cell:____________________________________________________
Column input cell:_________________________________________________

Page 74 of 260

5.

IIMA/CISG0104TEC

A Simple Lookup
B

19 CCODE CTYPE PCODE


20
C1
1
P1
21
C2
2
P1
22
C1
1
P2
23
C3
2
P2
24
C2
2
P3
25
C3
2
P3

QTY AMOUNT
10
10
10
20
20
20

H
PCODE
P1
P2
P3

D1
10
20
5

D2
8
15
3

The above spreadsheet shows the customer code (CCODE), Customer type (CTYPE), product
purchased (PCODE), quantity purchased (QTY), and the total monetary value (AMOUNT) of
the sale for six sales transactions (The values in AMOUNT field are concealed from you). The
AMOUNT is computed as quantity multiplied by unit price after applying an appropriate
discount; unit price is Rs 10 for all products; however, the percentage discount, D1 or D2,
depends on whether CTYPE is 1 or 2 respectively. The values of D1 and D2 for each of the
products are given in the range H20:J22. The AMOUNT is computed through a formula in cell
F20 for the first transaction; the formula is copied to cells F21:F25. What is the formula in cell
F20?Do not use any cells other than the ones shown above.
Answer:

6.

Data Table for Frequencies


C
30
31
32
33
34
35
36
37
38
39
40
41

Marks
10
20
30
15
90
60
70
55

Grade
F
F
D
F
A
C
B
C

Marks
15

Grade
B

G
A
B
C
D
F

1
1
1
2
1
3

The range C30:D38 in the above sheet shows the marks and letter grades obtained by eight
students in a course. Range F31:G35 shows the frequencies of each of these letter grades. These
frequencies were obtained through the menu option Data Table. What is the formula behind the
cell G30? Do not use any cells other than the ones shown above.
Answer:

Page 75 of 260

7.

IIMA/CISG0104TEC

Length of Employment

Cells A2:A101 contain the date of joining and B2:B101 contain the date of completing the
service related to 100 employees of a company. In C2:C101, you should get an asterisk (*)
displayed if the corresponding employee has put in greater than or equal to 1000 days of total
service in the organization; Otherwise display the number of days spent in service. This has to
done by a formula entered in cell C2, which is to be copied to C3:C101. What is the formula to be
entered in cell C2?
Answer: _________________________________________________________

8.

Cash Flow Analysis.


A

1
2
3
4
5
6
7
8
9
10
11

Disc.Rate
YearNo.
QuantyPrdctn
SalesRevenue
Total Cash Outflow
Net Cash Flow
NPV

5
5.5
7.8
8

The spreadsheet designed for computing NPV of the cash flows in an 8-year project is shown
above. The quantity of production, all of which can be sold, in each year is given in B7:J7, sales
ravenue is obtained through formulae in B8:J8, Total cash out flow is given as input in B9:J9, Net
cash flow obtained by subtracting total cash outflow from sales revenue, in B10:J10, and NPV
obtained through a formula in B11. Discount rate is given in B4.
The unit slaes price varies from year to year and is known to be Rs 5 in year 0, Rs 5.5 in years
1,2,and 3, Rs 7.8 in years 4,5 and Rs 8 in Years 6,7,8. Answer the following questions without
using any cells or referring to any cells other than those given or referred to in the formulae.
A. The formula in B8 is : =B7* VLOOKUP(B6,$N$6:$O$9,2,TRUE). What are the values in
N6,N7,N8,and N9 respectively?

Your Answer:__________________________________________________

B. The formula in B11 is : = NPV(B4,B10:J10) * ( ----- + ------). Fill in the two blanks indicated
by ----- in the above formula. Use only a constant or a cell reference for filling each blank.

Page 76 of 260

9.

IIMA/CISG0104TEC

Retirement Benefits.
2
3
4
5
6
7
8
9
10
11

A
ECode

B
JDate

C
RDate

D
LastBasic

E
PFEmp

F
PF

G
SevcMnths

H
SrvcPay

The above spreadsheet computes some of the retirement benefits for nine of the employees who
retired in the past few months. The employee-code (ECode), the joining date (Jdate), Retirement
date (Rdate), Last basic salary in Rupees per month (LastBasic) are given as input in the
respective rows of the columns A,B,C and D of range A3: D11. The Provident fund amount
contributed by each of the employees is given in the range E3:E11.
1. If an employee has put in a service, including the joining date and the retirement date, of more
than or equal to 5 years (counting an year as equal to 360 days for this purpose), the company
contributes an amount equal to the Provident fund contributed by the employee himself or herself,
and pays him on retirement twice the amount contributed by himself. If the service of the
employee is less than 5 years, the company does not contribute any amount to the employees PF.
This amount, employees PF contribution + companys PF contribution, is computed and shown
in the range F3:F11. What is the formula behind cell F3? This formula is to be copied in to the
other cells of the same column of the range of our interest.
Your answer: ____________________________________________
2. If the employee has put in a service of greater than 60 months (counting a month as equal to 30
days for this purpose, and rounding up if there is any fractional month that results in the above
calculation; for example 35.23 months is to be rounded to 36), he or she becomes eligible for the
amount known as service pay. For an eligible employee, the service pay is equal to number of
months of service, as computed above, multiplied by 1/10 of the last basic (given in column D).
The number of service months is computed as an intermediate value and shown in column G
whereas the service pay in column H. What are the formulae behind the cells G3 & H3 which are
to be copied to the other cells in their respective columns.
Your answer:
2.1

Formula in cell G3:____________________________________

2.2

Formula in cell H3: ____________________________________

Page 77 of 260

IIMA/CISG0104TEC

10. Households below Poverty Line.


A Household is said to be below poverty line if it consumes less than or equal to 2100 Kilo
Calories per day per adult. For each of ten households, the following data has been collected:
Household-code, total number of adults, total number of children, and total number of old
persons, along with total number of KiloCalories consumed by the household per day.
Treating two children as equal to one adult, and 1.5 old persons as one adult, compute the number
of households below the poverty line for the given data.
A template for the spreadsheet is given with appropriate headings. Fill in the cells F14,G14,H14
and H25 with appropriate formulae and copy them to other cells wherever necessary.
A
13
14
15
16
17
18
19
20
21
22
23
24

Household
Code
1
2
3
4
5
6
7
8
9
10

No. of
adults
2
2
2
3
3
3
4
4
4
4

No. of
children
4
4
6
6
6
6
2
2
2
2

No. of old
people
3
3
3
2
2
2
2
3
3
3

Total Kcal
per day
10000
15000
20000
20000
20000
8000
25000
9000
12000
14000

F
Total No of
equivalent
adults

G
Kcal/
adult

H
Below poverty
line?
(1 or 0)

Total No. below


poverty line

25

11. Evaluation of Job Applicants.


The following spreadsheet shows the score obtained by ten applicatnts for a job. The three
components of an applicants score are: academics, written test, and interview.
A weighted score is computed with the weights 0.3,0.4,0.3 for above components respectively.
For a candidate to be selected, he or she should obtain a weighted score of at least 75. How many
candidates will be selected?
A template for the spreadsheet is given below. Fill in the following cells with appropriate
formulae:
E17, F17, and F28. Copy these formulae to others cells wherever necessary.
16
17
18
19
20
21
22
23
24
25
26
27
28

A
Candidate
Code
1
2
3
4
5
6
7
8
9
10

B
Score in
academics
90
60
60
70
50
90
95
50
60
75

C
Score in
written test
75
90
80
70
40
80
50
70
60
75

D
Score in
interview
95
80
60
40
45
85
55
95
60
75

E
Weighted Score

Total Selected:

F
Selected or not?
(1 or 0)

Page 78 of 260

IIMA/CISG0104TEC

12. Publishing Game.


B
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

Name of the
Candidate
ABC
XYZ
BBV
ABF
FFK
GGF
MOP
CCR
RCC
BBB

Number of
National
papers
10
15
8
15
30
10
5
30
25
12

Number of
A-grade
international
papers
1
0
2
3
4
1
3
4
1
2

Number of
B-grade
international
papers
5
0
1
10
2
1
15
0
10
3

Total number of equivalent Agrade international papers

G
Total
number
of papers

Number of candidates
eligible for promotion:
Number of candidates
eligible for cash reward:

A reader in a university is eligible for promotion to professor only if she/he has published at least
five papers in A grade international journals. Publications in national journals, and publications in
B grade international journals are also counted for this purpose, but only after converting them to
equivalent number of Grade A international publications. In the counting process, twenty national
publications are treated equal to one A-grade international publication; and five B-grade
international publications as equivalent to one A-grade international publication. If the total
number of papers published (counting all categories as equal) by a candidate is more than 20,
she/he becomes eligible for a cash reward.
For the sample data on ten candidates presented in the above spreadsheet, the total number of
candidates eligible for promotion is to be obtained in cell F36, and total number eligible for cash
award in cell F37.
Fill cells F24 and G24 with suitable formulae and copy them down wherever necessary.
Fill also cells F36 and F 37 with suitable formulae.
In case you need, you can use cells H23,H24,I23, and I24 for any other purpose. No other cells
should be used.

13. Centigrade to Farenheight.


The formula for converting Centigrade (C) temperature to Farenheight (F) temperature is F =
(C*1.8)+32.
Convert the Centigrade values given in D52:D57 to Farenheight values and show them in the cells
adjoining the centigrade values, ie in E52:E57. You can enter a formula in E51, and then get the
other work done through Data Table feature.

Page 79 of 260

IIMA/CISG0104TEC
D
50
51
52
53
54
55
56
57

F
12
14
34
56
43
34

14. Number of Passes.


The marks obtained by ten different students in an exam are given in A28:B37. A student passes
the exam by getting greater than or equal to 50 marks. In D31, and B40 enter formulae or
expressions to get the number of passes in D31.

27
28
29
30
31
32
33
34
35
36
37
38
39

A
S.No.
1
2
3
4
5
6
7
8
9
10

B
Marks
50
40
67
83
68
93
45
32
22
85

No. of Passes

Marks

15. Components of a Name.


Column A of the following spread sheet consists of several names, one name per row., starting from
row 2 onwards. Each name is written in the order Firs name, middle name, and last name, a space
separating first and middle names, and another separating middle and last names. Into the
corresponding cells of columns D,E, and F are obtained through formulae, the first, middle, and last
names respectively. In doing so, the positions of the first and second spaces in each name are to be
found, and these are obtained in the corresponding cells of columns B and C. What are the formulae
in cells B2,C2,D2,E2, and F2?. These formulae are copied downwards in their respective columns.
A

B
Location of
Space-1
T Rama Rao
2
V Venkata Rao
2
Rekha R Jain
6
B H Jajoo
2
Sanjay K Verma
7
K V Ramani
2
Subhash C Bhatnagar
8

1 Name
2
3
4
5
6
7
8

C
Location of
Space-2
7
10
8
4
9
4
10

D
FirstName

E
F
MiddleName LastName

T
V
Rekha
B
Sanjay
K
Subhash

Rama
Venkata
R
H
K
V
C

Rao
Rao
Jain
Jajoo
Verma
Ramani
Bhatnagar

Page 80 of 260

IIMA/CISG0104TEC

16. Integral Solutions.


Given below are four equations, each in two variables x and y, which are given to be positive
integers. Solve each equation independently using either the solver tool or data table feature of
EXCEL. It is possible that an equation is satisfied by more than one pair of values for x and y.
1.
2.
3.
4.

41 x + 31 y = 1060
37 x + 27 y = 1142
17 x + 11y = 262
53 x + 61 y = 3057

17. City-based Sales Tax.


A company has sold four different products P1,P2,P3, and P4 in four different cities A,B,C, and
D, with the sales quantities shown in range B20:D32.
The unit prices of the products are the same in each city and are shown in I35:J39.
The sales tax depends on the state in which the sale is made.
The percentage sales tax on sales revenue in each state is shown in E35:F38.
The state in which each city is located is shown in B35:C39.
Enter appropriate formulae in the following cells and copy them as instructed:
D36 (to be copied to D37:D39)
E21 (to be copied to E22:E32)
F21 (to be copied to F22:F32)
G21 (to be copied to G22:G32)
H21 (to be copied to H22:H32)
B
20

Product

C
City

Tax(%)
Revenue
Sales
UnitPrice Revenue
after Tax
Quantity
Before Tax
1000
10
10000
10
9000

21 P1

22 P1

2000

10

20000

10

23 P1

1000

10

10000

15

8500

24 P2

2000

20

40000

10

36000

25 P2

1000

20

20000

12

17600

26 P2

2000

20

40000

15

34000

27 P3

1000

5000

10

4500

28 P3

3000

15000

12

13200

29 P3

1000

5000

10

4500

30 P4

4000

15

60000

15

51000

31 P4

5000

15

75000

10

67500

32 P4

2500

15

37500

10

33750

18000

33
34
State

S1

SalesTax
(%)
10

Product

UnitPrice

S1

%Sales
Tax
10

P1

10

S1

10

S2

15

P2

20

S2

15

S3

12

P3

S3

12

P4

15

35 City

State

36 A
37 B
38 C
39 D

Page 81 of 260

IIMA/CISG0104TEC

18. Tuition Fees.


Mr. XYZ has in his house four children (two his own, and two his brothers), all of whom are in
tenth standard in high school. They have registered for tuitions in six different group-tuition
institutes as shown in B24:D32.
The fee varies depending on the Institute and the subject, as shown in B16:F21.
Find the fee for each tuition in E25:E32 and the total in E34.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

B
C
D
Tuition fee (Rs) of various Institutes for different subjects
Physics
4000
6500
7000
5000
5500
3500

YogiSir
MeritIndia
Scholar
ScoreWell
CentPercent
TopRanker

Nameof Student
AAA
AAA
BBB
BBB
BBB
CCC
CCC
DDD

Institute
YogiSir
YogiSir
MeritIndia
CentPercent
MeritIndia
ScoreWell
TopRanker
Scholar

Chemistry
5000
6500
10000
5500
5500
3500

Subject
Maths
Chemistry
Maths
Physics
Chemistry
Biology
Maths
Biology
Total

Maths
8000
6500
8000
7000
7000
4000

Biology
5000
6500
5000
7500
7000
4000

Fee (Rs)
8000
5000
6500
5500
6500
7500
4000
5000
48000

19. Top-30 of Management Times.


A magazine called 'Management Times' has published a list of top 30 companies based on their
annual revenue, annual profit, and latest market capitalization, all expressed in Rs crores. Each
company is categorized into one of ten categories, PetroChem, Banking etc.
1. The basic data is given in range C20:H50. Develop a composite score by taking the weighted
sum of Revenue, Profit and Market Capitalization, using the weights given in E18:G18 for the
respective components.
The composite scores of the companies should be obtained in H21:H50 through an array formula.
Do not re-write the weights anywhere nor use any other cells in this process.
2. Obtain the minimum composite score for each category through data table feature.
The first column of the data table is shown in L34:L43. You can use D52:D53 as a criteria range,
if needed.

Page 82 of 260

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

IIMA/CISG0104TEC

C
Weights
Company
Name
ABC
DEF
GHJ
IJK
LMN
PQR
STU
VWX
ZZZ
AAA
BBB
CCC
DDD
EEE
FFF
GGG
HHH
JJJ
KKK
LLL
MMM
NNN
QQQ
RRR
SSS
TTT
UUU
VVV
WWW
XXX

Category
PetroChem
PetroChem
HeavyEngg
Banking
Banking
HeavyEngg
ITC
ITC
ITC
ITC
FMCG
Banking
FMCG
FMCG
Banking
ITC
SHIPPING
Insurance
Entertainmnt
Insurance
Garments
Entertainmnt
Insurance
Garments
Infrastructure
SHIPPING
Insurance
Infrastructure
Entertainmnt
PetroChem

0.4

0.2

0.4

Revenue
2000
1800
1700
1500
1400
1300
1200
1100
1000
950
800
750
725
710
700
695
690
687
685
680
670
665
650
649
648
647
642
640
600
550

Profit
200
180
100
100
110
115
120
110
50
10
60
70
50
30
5
10
12
20
25
25
30
35
50
45
30
25
45
60
10
40

Market
Caitalization
40000
20000
35000
32000
25000
25000
14000
20000
11000
10000
90000
15000
15000
14000
12000
12000
11000
10000
9000
8500
9000
10000
9000
8000
9000
10000
9000
8500
7500
6500

L
33
34
35
36
37
38
39
40
41
42
43

Banking
Entertainmnt
FMCG
Garments
HeavyEngg
Infrastructure
Insurance
ITC
PetroChem
SHIPPING

Composite
Score
16840
8756
14700
13420
10582
10543
6104
8462
4810
4382
36332
6314
6300
5890
5081
5080
4678.4
4278.8
3879
3677
3874
4273
3870
3468.6
3865.2
4263.8
3865.8
3668
3242
2828

Page 83 of 260

IIMA/CISG0104TEC

20. Weights for the Composite Score.


A magazine called 'Management Times' has published a list of top 30 companies based on their
annual revenue, annual profit, latest market capitalization, all expressed in Rs crores. Each
company is categorized into one of ten categories, PetroChem, Banking etc. The basic data is
given in range C20:H50. A composite score for each company is given in H21:H50; This was
obtained by multiplying revenue, profit, and market capitalization by their respective weights.
Using the basic data and the composite scores, obtain the weights for the above three components
in the corresponding cells of E18:G18 through an array formula.
Obtain the list of companies with Profit greater than or equal to 10% of Revenue.
The headings of the output columns are shown in J45:O45.Use any part of D52:F53 for your
criteria range.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

C
Weights
Company
Name
ABC
DEF
GHJ
IJK
LMN
PQR
STU
VWX
ZZZ
AAA
BBB
CCC
DDD
EEE
FFF
GGG
HHH
JJJ
KKK
LLL
MMM
NNN
QQQ
RRR
SSS
TTT
UUU
VVV
WWW
XXX

Category
PetroChem
PetroChem
HeavyEngg
Banking
Banking
HeavyEngg
ITC
ITC
ITC
ITC
FMCG
Banking
FMCG
FMCG
Banking
ITC
SHIPPING
Insurance
Entertainmnt
Insurance
Garments
Entertainmnt
Insurance
Garments
Infrastructure
SHIPPING
Insurance
Infrastructure
Entertainmnt
PetroChem

0.4

0.2

0.4

Revenue
2000
1800
1700
1500
1400
1300
1200
1100
1000
950
800
750
725
710
700
695
690
687
685
680
670
665
650
649
648
647
642
640
600
550

Profit
200
180
100
100
110
115
120
110
50
10
60
70
50
30
5
10
12
20
25
25
30
35
50
45
30
25
45
60
10
40

Market
Caitalization
40000
20000
35000
32000
25000
25000
14000
20000
11000
10000
90000
15000
15000
14000
12000
12000
11000
10000
9000
8500
9000
10000
9000
8000
9000
10000
9000
8500
7500
6500

Composite
Score
16840
8756
14700
13420
10582
10543
6104
8462
4810
4382
36332
6314
6300
5890
5081
5080
4678.4
4278.8
3879
3677
3874
4273
3870
3468.6
3865.2
4263.8
3865.8
3668
3242
2828

Page 84 of 260

IIMA/CISG0104TEC

21. Queen on a Chess Board.


A

1
2
3
4
5
6
7
8
9
10
11
12

1
2
3
4
5
6
7
8

1
-1
-1
1
-1
-1
1
-1
-1

2
1
-1
1
-1
1
-1
-1
-1

3
-1
1
1
1
-1
-1
-1
-1

4
1
1
0
1
1
1
1
1

5
-1
1
1
1
-1
-1
-1
-1

6
1
-1
1
-1
1
-1
-1
-1

7
-1
-1
1
-1
-1
1
-1
-1

8
-1
-1
1
-1
-1
-1
1
-1

The range C5:J12 represents the squares of an 8 by 8 chess board, with the clumn numbers of the
squares given in C4:J4, and row numbers in B5:B12. Suppose a queen is to be placed in the
square, whose row number is input in cell B2, and column number in C2. A formula is entered in
cell C5 and copied to all the other cells of C5:J12, such that the output would be: a zero in the
cell to be occupied by the queen, a 1 in each of the cells that can be attacked by the queen from
the given position, and a -1 in all other cells. A queen can move along a straight line any number
of squares, horizontally, vertically, or diagonally.
What is the formula behind cell C5? _______________________________________________

22. Knight on a Chess Board.


This is the same as the previous problem, except that instead of a queen, consider here a knight.
Note that a Knight can move two squares horizontally and vertically, or two squares vertically and
one horizontally. As in the previous problem, the spreadsheet is provided below for a specific
position of the Knight:
A
1
2
3
4
5
6
7
8
9
10
11
12

1
2
3
4
5
6
7
8

1
1
-1
-1
-1
1
-1
-1
-1

2
-1
-1
0
-1
-1
-1
-1
-1

3
1
-1
-1
-1
1
-1
-1
-1

4
-1
1
-1
1
-1
-1
-1
-1

5
-1
-1
-1
-1
-1
-1
-1
-1

6
-1
-1
-1
-1
-1
-1
-1
-1

7
-1
-1
-1
-1
-1
-1
-1
-1

8
-1
-1
-1
-1
-1
-1
-1
-1

What is the formula behind C5?___________________________________________

Page 85 of 260

IIMA/CISG0104TEC

23. Coded Marks List.


A
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

CodedRNo
123
234
345
456
789

Marks1
55
65
80
60
70

Marks2
65
70
60
60
50

BothGT50
TRUE
TRUE
TRUE
TRUE
TRUE

TotGT130
FALSE
TRUE
TRUE
FALSE
FALSE

Pass?
FALSE
TRUE
TRUE
FALSE
FALSE

Rno
125
236
347
458
791

Name
ABC
DEF
HGH
MNP
QRS

Pass?
FALSE
TRUE
TRUE
FALSE
FALSE

Rno
236
791
347
125
458

CodedRNo
234
789
345
123
456

In the spreadsheet above, the marks obtained by students in two papers of an exam are listed,
along with their coded roll numbers in B3:D8. For passing th exam, a student obtain greater than
50 marks in each paper, and greater than 130 in total. Whether a student has obtained greater than
fifty (TRUE or FALSE) in both papers is obtained in E4:E8, and whether the total is greater than
130 (TRUE or FALSE) in F4:F8 through formulae. Similarly, whether each student has passed in
the exam as a whole (TRUE or FALSE) is obtained in G4:G8, through formulae which use the
output of previous two columns. In the range B12:B16 the list of real roll numbers is given, and
against each the result of the exam is obtained in D12:D16, through formulae which use the
output in G4:G8.
Question-1. What is the formula behind cell G4 (This formula is copied to G5:G8)

Answer:_______________________________________________________________

Question-2. What is the formula behind cell D12 (This formula is copied to D13:D16)

Answer: _______________________________________________________________

Page 86 of 260

IIMA/CISG0104TEC

24. Rating of Cars.


A
1
2
3
4
5
6
7
8
9
10

Looks
Power
Price

P1
8
6
4

P2
7
7
8

P3
9
8
4

P4
5
5
5

P5
8
8
8

Wscore
WScore

6.4
6.4

7.3
7.3

7.3
7.3

5
5

8
8

Weights
0.5
0.2
0.3

Each of a given set of five car models is given a rating between 0 and 10 on each of the three
dimensions: looks, Power, and Price. The ratings are entered in B5:F7. Weighted scores are to be
obtained by aggregating the three scores after multiplying them with their respective weights,
which are given in G5:G7.
Question-1. The range B9:F9 is highlighted and an array formula is entered to obtain the
weighted scores. What is that formula? ______________________________________________
Question-2: To obtain the weighted scores in an alternative way, a formula is entered in cell B10,
and then it is copied to the cells in C10:F10. What is the formula behind B10?
____________________________________________________________________________________

25. Gas Cylinder Booking


A
1
2
3
4
5
6
7
8
9
10
11
12
13

C
21

D
11/23/2007

CustNo
C001
C002
C003
C005
C006

LastDelivery
10/23/2007
11/15/2007
11/10/2007
11/8/2007
10/15/2007

CustNo
C001

Canbebooked?
1

alreaybooked?
0
0
0
0
1

In the above spreadsheet, a gas cylinder keeps a list of its customer codes in B5:B9, and against
each code, the date on which the last cylinder was delibered (C5:C9), and whether a cylinder is
already booked and still to be delivered ( 1 for yes and 0 for no) in D5:D9. When a new cylinder
is requested by a customer the customer code is entered in B13. Each customer is entitlrf to have
only one cylinder. The booking can be made only if a cylinder is not already booked and its
delivery is pending, and unless a certain gap ( given in B2) in days has elapsed between the date
of the last delivery and today( given in D2). There is a formula in cell C13, which gives 1 if a
cylinder can be booked for the customer code given in B13, and zero if not.
Question: What is the formula behind cell C13? ______________________________________

Page 87 of 260

IIMA/CISG0104TEC

26. Cricket.
A
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

Name
A
B
C
D
E
F
G
H
J
K
L

Runs

Wkts

Catches

10
75
30
55
20
5
60
27
15
20
100

Runs
>=50

0
0
2
0
0
0
3
3
2
0
1

Wkts
>=3

0
3
0
2
0
1
2
1
0
0
3

Catches

No.ofAllrounders
2

The performance of each player in a cricket team is given in B3:B14, in terms of the number of
runs scored (Runs), number of wickets taken (Wkts),and number of catches taken (Catches). An
all rounder is defined to be a player who has scored at least 50 runs and satisfies additionally
satisfies at least one of the following three conditions: 1. the player should have taken at least 3
wickets, 2. the plaer have taken at least two wickets and at least one catch, 3. the player should
have taken at least one wicket and at least three catches. In B23 is computed the number of allrounders according to the above definition, through the formula: =DCOUNT(B3:E14,,C17:E20).
It is given that cell E18 is empty.
What is the entry in C19?_______________________________________________________
What is the entry in D19? _______________________________________________________
What is the entry in E19? _______________________________________________________
What is the entry in C20? _______________________________________________________
What is the entry in D20? _______________________________________________________
What is the entry in E20? _______________________________________________________

27. Guess the Cell Address. .A cell named source is known to be in row-104 of a spreadsheet,
and another cell named destination is known to be in column-CD of the same sheet. The
formula = $F6 +G$5 is entered in source. When this formula is copied from source to
destination, the destination gets the formula = $F3 + I$5.
What is the cell address of source?

____________________________

Page 88 of 260

IIMA/CISG0104TEC

What is the cell address of destination? _________________________

28. Missing first value in cash flow. . In the range A1:D1, four cash flow values are entered.
The formula
=NPV(0.1,B1:D1) yields the result 900, and the formula =NPV(0.1,A1:D1)
yields the result 1000. What is the value in A1? _______________________
(Hint: recall that the NPV function is concerned with finding net present value of a series of cash flows;
For the range specified within the NPV function, excel computes the sum of the first value in the range
divided by (1 + discount rate), second value divided by (1+discount rate)2, third value divided by
(1+discount rate)3, and so on)

29. VLOOKUP Exercise. . A four-row, three-column range named as Vtab has positive
integers in all its cells. Its first column is named as VtabC1. In six cells not belonging to
Vtab, different formulae are entered; the formulae and their results are shown
below:
Formula
Vlookup (10, Vtab, 2, False)
Vlookup (15, Vtab, 3, False)
Vlookup (36.1, Vtab, 2, True)
Vlookup (34.9, Vtab, 3, True)
Vlookup (35.25, Vtab, 3, True)
Match (21, VtabC1, 0)

Value
26
49
100
481
105
3

The values in the 2nd and 3rd columns of Vtab are as shown below. Infer the values of the first
column of Vtab and fill the blank spaces in Vtab:
26
51
48
100

32
49
481
105

Page 89 of 260

IIMA/CISG0104TEC

30. Sequential Activities in a Project.


E

StFstActvty

01/08/2008 08:00:00 AM

1
2
3
4
5
6
7

PrjCompln

PrjDurn

10/08/2008 03:09:00 PM
9.297916667

9
10

Label

Pred

Durn(Hrs)

Gap(hrs)

Start

Finish

11

C1

E1

10

1.25

02/08/2008 10:24:00 AM

02/08/2008 08:24:00 PM

12

C2

P3

25

09/08/2008 02:09:00 PM

10/08/2008 03:09:00 PM

13

C3

E3

30

4.2

05/08/2008 04:57:00 PM

06/08/2008 10:57:00 PM

14

E1

20

6.4

01/08/2008 08:00:00 AM

02/08/2008 04:00:00 AM

15

E2

C1

18

4.2

02/08/2008 09:39:00 PM

03/08/2008 03:39:00 PM

16

E3

E2

35

10.1

03/08/2008 07:51:00 PM

05/08/2008 06:51:00 AM

17

P1

C3

22

5.25

07/08/2008 03:09:00 AM

08/08/2008 01:09:00 AM

18

P2

P1

10

4.25

08/08/2008 06:24:00 AM

08/08/2008 04:24:00 PM

19

P3

P2

12

5.5

08/08/2008 08:39:00 PM

09/08/2008 08:39:00 AM

Shown in the above spread sheet is a nine-activity project, in which the activities are to be
processed sequentially without interruption, except that each activity has to be followed by a
specified time gap before the next activity can start. The final activity does not have to be
followed by a gap .When two activities are scheduled one after the other, the one that occurs
earlier in the schedule is called the predecessor of the one that occurs latter; conversely, the latter
is called the successor of the former. In the range E11:H19, for each activity, you have the activity
label (Label), the label of its predecessor (Pred), the duration of the activity in hours (Durn), and
the time gap (Gap) in hours that has to be necessarily observed before its successor begins. The
initial activitys predecessor is given as *. The date and time at which the first activity is
scheduled to begin is given in cell F5. The activity data is organized in the spreadsheet according
to alphabetical order of activity labels. Thus, in the sample data given above, the activity sequence
for scheduling would be:

E1 C1 E2 E3 C3 P1 P2 P3 C2. The display formats are self explanatory.


The date and time at which each activity is scheduled to start is found in I11:I19. What is the
formula in I11, which is copied to other relevant cells in that column?
Answer: _____________________________________________________
The completion data and time of each activity is found in range J11:J19. What is the formula in
cell J11, which is copied to other relevant cells in that column?
Answer: ________________________________________________________

The project is said to be complete when all the activities are complete. The project completion
date and time is obtained in cell J7. What is the formula in J7?

Page 90 of 260

IIMA/CISG0104TEC

Answer: ______________________________________________________________
The total duration of the project in days is found in cellJ8. What is the formula in J8?
Answer: ____________________________________________________________

31. Commonwealth Games. .


1. The data on the contractual due date and actual completion date, along with the amount to be
paid in Rs millions (agreed payment),if completed on time is given in B4:F9, for each of six
projects related to common wealth games.
If the project is completed late, a certain percentage of the agreed payment (given in cell E1)is
imposed as penalty, for each day of lateness.
2. In G4 enter a formula and copy it to cells down below to get the penalty per day, in millions, to
be imposed on each project for late completion, if any.
3. In H4 enter a formula and copy it downwards to obtain the actual payment to be made in each
project
4. In I4, enter a formula and copy it downwards to obtain the actual total penalty, if any, incurred
by each project.
5. In D2, obtain through a formula the name of the project that incurred the maximum penalty
6. In E2 obtain through a formula the name of the contractor who incurred the maximum penalty.
Assume that no contractor was given more than one project, and that there are no ties for the
answer to this question.
A
1

B
Penalty perday
(%)

D
0.1

8
9

Penalty
per day(
Rs mill)

Actual
Payment
(Rs mill)

Max
Penalty to:

4
5
6
7

E
Name of the
Contractor

Agreed
Completiondate Payment
(mill)
15/02/2010
10
25/03/2010
2
28/03/2010
3

Item

Contractor

Duedate

Indira Pool
Patel Track
Gandhi Garden
AmbhedkarTennis
Court
Sanjay Flyover
Rajiv Football
Ground

A
B
C

01/02/2010
01/03/2010
01/04/2010

01/12/2009

02/02/2010

01/05/2010

01/07/2010

15

01/11/2009

03/03/2010

32. Election Results. .


The numberof seats won by ten different parties in a parliamentary election are listed in the range
C21:E31; this range is named as Eresults.

Page 91 of 260

IIMA/CISG0104TEC

Assume that the total number of seats in the parliament, obtained as the total of the seats won by
each party, is ensured to be an even number.
The field headings are self explanatory.
To form the government, a party, or a coalition formed of at most three parties,
should have a total greater than half of the total number of seats.
1. Write a formula in cell F22 to compute the percentage of seats won by
the first party. Copy the formula to F23:F31 to obtain the percentages for the other parties.
2. In G22:G31, compute for each party the number of seats by which it is short
for forming government; if a party is not short of seats for forming government, the result in the
corresponding cell should be zero.
3. The range D35:D38 is named as CRTRN, and the first cell contains the entry
PARTYCODE. In the other three cells you can enter the party codes of a possible coalition. All
the three cells reserved for party names are filled; if you have less than three parties, the cells
without a party name are filled with NA ( assume NA is not the name of a party)
Write a formula in F36 such that it gives the total number of seats won by all the parties in the
coalition specified in CRTRN.
4. In H36, write a formula that gives "YES" if the coalition given in CRTRN can form the
government

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

C
PartyName
Bribe High
Promote Cast
Eighteenth Century
No Morals
Highly Illiterate
Be Autocratic
Status Quo
All Criminals
Rowdies N Goondas
Remain Poor

D
E
F
G
PartyCod Seats Percentage Shortage
e
BH
200
PC
100
EC
40
NM
25
HI
20
BA
25
SQ
15
AC
5
RG
50
RP
20
Total
PartyCode
BH
EC
HI

500
TotalSeats

CanFormGovt?

33. Late Assignments. .


A professor has given two assignments A1 and A2, the due dates of which are given in cells E21
and E22 respectively( the global date format is dd/mm/yyyy).

Page 92 of 260

IIMA/CISG0104TEC

A student can submit an assignment late; however she/he has to pay penalty at the rate given in
cell E23; if she/he has submitted both assignments late, there is an additional fixed amount
(independent of the lateness)to be paid whose value is given in E24. Thus, for the given values,
suppose a student has submitted each assignment one day late. Then, the total fine to be paid by
her/him is Rs. 10+10+50.
The data on the submission dates of the Assignments for nine students is given in D29:E37.
In F29:F37 you need to compute the penalty due to late submission of A1, if any;in G29:G37,
penalty due to late submission of A2, if any; in H29:H37 the additional penalty due to late
submission of both, if any; and finally in I29:I37 the total penalty for the student.
For each of the above ranges enter a formula in the corresponding top most cell and copy it to the
other cells of the range to obtain the desired results.
In cell G24, enter a formula to obtain the grand total of the fine that all the nine students owe to
the professor.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

C
Date format is dd/mm/yyyy
DueDate for A1
Due Date for A2
Penalty(Rs/day of lateness)
AddnlPenalty (Rs)

StdntCode
S1
S2
S3
S4
S5
S6
S7
S8
S9

Submission
A1
01/06/2009
05/06/2009
04/06/2009
01/06/2009
02/06/2009
01/06/2009
02/06/2009
01/06/2009
01/06/2009

01/06/2009
01/07/2009
10
50

Date
A2
02/07/2009
01/07/2009
03/07/2009
01/07/2009
01/07/2009
01/07/2009
04/07/2009
01/07/2009
03/07/2009

Total Penalty to be collected

A1

Penalty for late Submission


A2
BothLate
Total

34. Software Project management. .


A multinational records, for each software project outsourced by it, the following data:
Estmated time in days, starting date of the project, actual completion date. These are given for
five projects in C5:G9.
If the project has taken more than estimated time, it is said to have incurred delay. If it has
completed before time the number of days saved is recorded as negative delay.
1. Enter a formula in H5 and copy it downwards to compute the delay (with appropriate sign)
incurred by each project.

Page 93 of 260

IIMA/CISG0104TEC

2. The reward (or penalty as negative reward) is to be computed as per the reward and penalty
tables given in L5:M8 and L12:M15 respectively.
Enter a formula in I5 and copy it downwards to compute the reward ( or penalty as negative
reward)

Vendor

Est
Time

5
6
7

A
B
C

CompSys
ITPro
CCS

Reward
Delay(+)
(+) or
StDate
CompDate or Saving
Penalty
(-)
(-)
100 01/01/2008 30/04/2008
20
-50
200 01/05/2008 07/11/2008
-10
15
150 01/04/2008 28/08/2008
-1
10

UnSatyam

250 01/08/2008 28/04/2009

20

-50

9
10

MindPlant

80

-4

10

4 PrjCode

01/10/2008 16/12/2008

Interval Saving
1 to 7
8 to 14
15 to 24
25
onwards

M
Reward
per day

1
8
15

10
15
20

25

25

Penalty Table
Penalty
Interval Delay
per day
1 to 4
1
20
5 to 9
5
30
10 to 14
10
40
15
15
50
onwards

11
12
13
14
15

35. Ahmedabad Auto Fare Card. .


In Ahmedabad, the rules for auto fare have been set as follows:
1. The minimum fare is Rs 1.5, upto 1.5 Km; that is if the distance is <=1.5 Km the
minimum fare is charged.
2. For distances above 1.5 Km, the fare is Rs 6 per Km, for each additional Km.
3. The least count for the distance is 0.1 Km. The auto riksha meter also shows the distance
to the tenth of a kilo meter. The distance is rounded up the next 0.1 Km for the calculation
of the fare. For example, if the distance is greater than 0.1 Km and less than or equal to
0.2 Km, the distance is taken as 0.2 Km.
4. Between 11 pm and 6 am, night fare is applicable. The night fare 25% extra over the
normal fare. For example, if the normal fare is Rs 100, the night fare for the same meter
reading would be Rs 125.
With the above rules, generate an auto fare card that shows in the form of a table the meter
reading and the corresponding fare. The table can start with meter reading of 0.1 Km and go on
till 12.0 Km, in steps of 0.1 Km. Generate a second card for the night fare.
Use spreadsheet to generate the above tables.

Page 94 of 260

IIMA/CISG0104TEC

Ahmedabad Auto Fare Card (Km - Rs)

1.5 - 9.00
1.6 - 9.60
1.7 - 10.20
1.8 - 10.80
1.9 - 11.40
2.0 - 12.00
2.1 - 12.60
2.2 - 13.20
2.3 - 13.80
2.4 - 14.40
2.5 - 15.00
2.6 - 15.60
2.7 - 16.20
2.8 - 16.80
2.9 - 17.40
3.0 - 18.00
3.1 - 18.60
3.2 - 19.20

3.3 - 19.80
3.4 - 20.40
3.5 - 21.00
3.6 - 21.60
3.7 - 22.20
3.8 - 22.80
3.9 - 23.40
4.0 - 24.00
4.1 - 24.60
4.2 - 25.20
4.3 - 25.80
4.4 - 26.40
4.5 - 27.00
4.6 - 27.60
4.7 - 28.20
4.8 - 28.80
4.9 - 29.40
5.0 - 30.00

5.1 - 30.60
5.2 - 31.20
5.3 - 31.80
5.4 - 32.40
5.5 - 33.00
5.6 - 33.60
5.7 - 34.20
5.8 - 34.80
5.9 - 35.40
6.0 - 36.00
6.1 - 36.60
6.2 - 37.20
6.3 - 37.80
6.4 - 38.40
6.5 - 39.00
6.6 - 39.60
6.7 - 40.20
6.8 - 40.80

6.9 - 41.40
7.0 - 42.00
7.1 - 42.60
7.2 - 43.20
7.3 - 43.80
7.4 - 44.40
7.5 - 45.00
7.6 - 45.60
7.7 - 46.20
7.8 - 46.80
7.9 - 47.40
8.0 - 48.00
8.1 - 48.60
8.2 - 49.20
8.3 - 49.80
8.4 - 50.40
8.5 - 51.00
8.6 - 51.60

8.7 - 52.20
8.8 - 52.80
8.9 - 53.40
9.0 - 54.00
9.1 - 54.60
9.2 - 55.20
9.3 - 55.80
9.4 - 56.40
9.5 - 57.00
9.6 - 57.60
9.7 - 58.20
9.8 - 58.80
9.9 - 59.40
10.0 - 60.00
10.1 - 60.60
10.2 - 61.20
10.3 - 61.80

10.4 - 62.40
10.5 - 63.00
10.6 - 63.60
10.7 - 64.20
10.8 - 64.80
10.9 - 65.40
11.0 - 66.00
11.1 - 66.60
11.2 - 67.20
11.3 - 67.80
11.4 - 68.40
11.5 - 69.00
11.6 - 69.60
11.7 - 70.20
11.8 - 70.80
11.9 - 71.40
12.0 - 72.00

Minimum Fare: Rs9 for first 1.5Km


Fare above Minimum Fare: Rs6 per Km
Night Fare: Extra 25% from 11 pm to 6am

36. Apartment Prices.


1. The information on apartments available for sale in blocks A,B,C, and D of an apartment
complex is given in A3:A17, the first row of which consists of field headings.
The apartment number has four characters: the left most character indicates the block, the next
character indicates the number of the floor on which the apartment is located; The right-most two
characters indicate the serial number within the block.
2. B4:B17 contains the area in number of square yards to be used in computing the price of the
apartment. The price in Rs per square yard is given in B2.
3. No. of bed rooms in each apartment is given in C4:C17.
5. Enter a formula in E4 and copy it to E5:E17 to obtain the price in Rs lakhs of each of the
apartments.
6. A prospective buyer wants to know the average price in Rs lakhs of apartments located on a
floor of her choice and having number of bed rooms specified by her.
7. In G3:H4 is to be developed a criteria range for the above purpose.

Page 95 of 260

IIMA/CISG0104TEC

In I4 give a formula that gives the average price according to the above criterion. If no aprtments
satisfy the criteria, then the result in I4 should be "NA" Test your work by finding the average
price of apartments having 2 bedrooms on third floor;
Another test case is find average price of apartments with 4 bedrooms on the first floor.

lakhs

NBdRms

FloorNo

AvgPrice

40

NA

30

30

200

40

B304

120

24

B103

210

42

C104

170

34

C102

200

40

C202

150

30

C301

175

35

14

D104

220

44

15

D301

130

26

16

D302

140

28

17

D303

110

22

Apartments for Sale

Rs PerSqYd

20000

AptNo

Area(SqYds)

NBdRms

FloorNo

A203

200

A305

150

A104

150

B202

8
9
10
11
12
13

Price

37. Expiry Dates


1. The product code (Prde), and Packaging date (PackgDate) for a few items is given in A3:B13.
The first row has field headings. The left most character of a product code indicates the category
(Ctgry) of the product. The shelf life in days (ShlfLife) of a product depends on its category.
2. The shelf life in days for each category is given in the range J3:K8.
3. Enter a formula in C4, and copy it over C5:C13, to obtain shelf life in days for the
corresponding product codes given in A4:A13.
4. Enter a formula in D4 and copy it to D5:D13 to obtain the expiry date in dd/mm/yyyy format
for each item.

Page 96 of 260

IIMA/CISG0104TEC

Ctgry

ShlfLife
30

1
2

Date format:

Dd/mm/yyyy

PrdCode

PackgDate

ShlfLife

ExpiryDate

A23

01/12/2010

30

31/12/2010

15

E54

13/12/2010

20/12/2010

365

F43

24/01/2011

60

25/03/2011

30

B21

02/02/2011

15

17/02/2011

C05

05/04/2011

365

04/04/2012

60

D45

01/05/2011

30

31/05/2011

10

A12

30/04/2011

30

30/05/2011

11

B43

25/05/2011

15

09/06/2011

12

A06

01/06/2011

30

01/07/2011

13

C07

05/06/2011

365

04/06/2012

38. Vacant Property Project (based on problem 8-14, page 133, of Grant, E.L., Ireson, W.G.,
Principles of Engineering Economy, Fourth Edition, The Ronald Press Company, New York,
1960)
An investment consists of buying a 200 square yard vacant property at a cost of Rs 1 lakh and
selling it at the end of the fifth year for Rs 3 lakh. The tax to be paid at the end of the first year
would be Rs 1000, and this would increase at the rate of 5% every year. The cost of maintaining
the plot, which consists of mainly cleaning it every once in a while, is Rs 5 per square yard per
year. The above proposal is evaluated by computing the internal rate of return (IRR), and NPV at
discount rate 0.15, in the following spreadsheet. All the text entries in different cells are self
explanatory. While the basic data is entered as parameters, the other values are obtained through
formulae. You need to identify the formulae behind the cells mentioned below:

Area(SqYds)

Cleaning(Rs/sqYd)

InitiaTax

%IncreaseinTax

Purchase Cost

1,00,000

Selling price

3,00,000

DiscountRate

YearNo.

Tax

1000

1050

1102.5

1157.625

1215.506

10

Cleaning

1000

1000

1000

1000

1000

11

Tax+Cleaning

2000

2050

2102.5

2157.625

2215.506

12

PurchaseCost
Inflow due to
Selling

-1,00,000

3,00,000

NetCashFlow

-1,00,000

-2,000

-2,050

-2,103

-2,158

2,97,784

13
14

200
5
1000
5

0.15

Page 97 of 260
15

NPV

16

IRR

IIMA/CISG0104TEC
42,146.24
23%

Formula in D9 ( which is copied to E9:G9):______________________________________


Formula in C10( which is copied to D10:G10):____________________________________
Formula in B14(which is copied to C14:G14):_____________________________________
Formula in B15:_____________________________________________________________
Formula in B16:_____________________________________________________________

39. Hotel Charges


A

RmNo

Ndays

TotlChrg

RmNo

Type

Type

Chrg/day

25000

2000

3000

5000

DL

8000

6000

8000

GstName

Gupta

Saxena

4000

Shah

3000

Patel

15000

Patil

Iyer

DL

10

11

10

A hotel has kept ten rooms for advance reservation. A room belongs to one of the four types
S,D,L, or DL, each of which has a different per day tariff, and the per day tariffs of the four types
are given in the range I2:J5 of the above spreadsheet. The type to which each of the ten rooms
belongs is given in range F2:G11. The advance bookings received in the last two days are given
A1:D7; as shown, in the above range, column- A consists of the guest name (GstName), columnB consists of the roo number booked (RmNo), and column-C the number of days (Ndays) for
which the room is booked. You are required to compute in the corresponding rows of column-D ,
the total room tariff (TotlChrg) for each of the above bookings.
What is the formula in cell D2, which is copied to D3:D7.
Answer: __________________________________________________________________________

Page 98 of 260

IIMA/CISG0104TEC

40. Due Date for next maintenance

Machine

Type

LatestMDate

NextMDate

L1

01/07/2011

M1

D1

5
6
7
8
9

Type

Intvl

29/09/2011

90

15/07/2011

14/08/2011

120

25/07/2011

23/09/2011

30

S2

01/08/2011

29/11/2011

60

L2

05/08/2011

03/11/2011

M2

10/08/2011

09/09/2011

S1

12/08/2011

10/12/2011

L3

15/08/2011

13/11/2011

A workshop has four different types of machines L,S,M, and D, each of which requires to be
opened for preventive maintenance at the end of a pre-specified interval (Intvl). The maintenance
interval in days for each type is given in range G2:H5 of the above spreadsheet.
Currently the workshop has nine machines, three of type L, two of type S, two of type M, and one
of type D. The machine codes are designed such that each code consists of two characters, the left
one indicating the type, and the second one the serial number within the type. The codes of each
machine are shown in A2:A9. The date on which the latest maintenance on each of these
machines was entered in C2:C9 in the format dd/mm/yyyy. The date on which the next
maintenance is due is obtained in D2:D9 through formulae. To obtain the next maintenance date,
the intermediate values found in B2:B9, which are self explanatory, are used.
1. What is the formula in cell B2, which is copied to B3:B9?
Answer: _______________________________________________________________________
2. What is the formula in D2, which is copied to D3:D9?
Answer:________________________________________________________________________

41. Plots for Political Fasting


A

Plots for Fasting

PlotNo

Capacity

Shelter

200

Yes

1000

Yes

500

No

5000

No

10000

Yes

500

No

1000

Yes

10
11
12

Capcity

Shelter

Page 99 of 260

IIMA/CISG0104TEC

The increasing number of fasts undertaken by several citizen groups fighting for lok pal bill has
caused a real estate business man to develop seven plots for political fasting and offer them for
rent. Each plot has a different capacity, in terms of number of agitators that it can accommodate,
and some have a shelter (YES) for the agitators and some dont (NO). This data is provided in the
range A2:A9, of the above spreadsheet, which includes self explanatory field headings.
Shri Kannan Harrare is planning a fast and estimates that there will be at least one thousand
agitators joining him in the event. He wants to hire a plot with shelter for the event. To find how
many plots satisfy his requirement he has developed a formula in cell D11. This formula makes
use of data filtering using the criterion range given in B11:C12.
1. What is the entry in cell B12?
Answer:_________________________________________________________________
2. What is the entry in cell C12?
Answer:_________________________________________________________________
3. What is the formula in cell D11?
Answer:__________________________________________________________________

4. Blood Pressure and Monthly Income


A

Sno

SystolicBP

Monthly
Income (in
1000s)

Log income

160

100

150

200

2.301029996

150

150

2.176091259

140

75

1.875061263

145

80

1.903089987

165

55

1.740362689

155

68

1.832508913

135

55

1.740362689

10

142

72

1.857332496

11

10

128

75

1.875061263

G
Regression
Results

9.066845

129.5002

A statistician collected data on systolic blood pressure in mm and the monthly income in Rs
thousands for ten individuals , each of age above fifty, and entered them in the range B2:C11 of
the above spreadsheet. She/he hypothesized that the systolic BP in mm (Y) is strongly influenced
by the monthly income (X). The exact relationship hypothesized was:
Y = C + a log10 X
To estimate the values of C and a, the statistician computed intermediate values in D2:D11, and
in the range F2:G2 entered the array formula Linest, whose results are shown above in their
respective cells.
1. What is the value of C given by linest?
Answer:_______________________________________________________
2. What is the value of a given by linest?
Answer:__________________________________________________________
3. What is the formula in cell D2, which is copied to D3:D11?
Answer?_____________________________________________________________

Page 100 of 260

IIMA/CISG0104TEC

4. What is the linest formula entered in F2:G2?


Answer?________________________________________________________________

Page 101 of 260

IIMA/CISG0104TEC

IV.

Exercises-II

Page 102 of 260

IIMA/CISG0104TEC

IV.

1.

Exercises-II

Savings Bank Account.

Design a spread sheet which helps you maintain your own savings bank balance up to date. Every
time you make a deposit or withdrawal, this spread-sheet has to be invoked, and the corresponding
amount has to be posted in the appropriate column, and the spread sheet immediately updates the
balance. The opening balance is to be given as input. Follow the design given below:
A

Savings Account

Opening Balance:

Date

Deposit(Rs)

Withdrawal(Rs)

Balance(Rs)

4
5
A.
B.
C.

Show the transactions corresponding to a withdrawal of more than Rs 1000.


Show the transactions corresponding to a deposit of Rs 1000.
Display constantly the max deposit and min deposit.

2. Price Discount.
A product is sold to several different customers at a certain unit-price, say Rs 10 per unit. If the
number of units ordered is greater than 100, a certain discount on unit-price, say 10 percent, is offered
for each unit over and above the 100 units. For example, suppose the number of units ordered is 102.
Then 100 of the units are charged at normal unit-price, and the extra two at discount price. Design a
spread sheet that computes the total amount to be charged on each order, given the number of units
ordered in each order. Take the unit-price, the quantity upto which discount is not available, and the
percentage discount as parameters. Follow the design given below:
A
1

Unit price

Minimum quantity for discount

Percentage discount

Order No.

Quantity

Amount (Rs)

5
6
7

Extension:
A.
Split the quantity into two parts, and show them separately: The quantity not eligible for
discount, the quantity eligible for discount
B.
Similarly, the amount to be paid also is to be split into two:
The amount for quantity charged at normal rate
The amount for quantity charged at discounted rate

Page 103 of 260

IIMA/CISG0104TEC

3. A School Project.
It is proposed to start a primary school with standards 1 through 5, with one section for each standard,
and with 50 students per class. The estimated number of square feet of floor area per student in the
building is 20. The construction cost will be Rs. 200 per square foot. The staff salary per month is
estimated to be Rs 25,000 per month in the beginning and is estimated to increase at the rate of 10%
per year. Other operational costs of the school per year will be Rs. 20,000. What should be the fee in
rupees per month per student so that the investment cost could be recovered in five years.

4. Comparison of Vendor Quotations.


Two computer vendors have submitted quotations for supplying equipment for a local area computer
network, consisting of one server, 10 nodes, and 15 meters of cable. The unit costs to be charged by
the vendors are summarized below.
Item
Server

Vendor A
Rs. 50,000

Vendor B
Rs. 40,000

Node

Rs. 25,000 per node

Rs. 30,000 per node

Cable

Rs. 100 per meter

Rs. 75 per meter

Develop a spreadsheet to compare the above quotations.

5. Promotion policy.
An organization wants to evaluate its promotion policy for its A,B, and C category employees.
Currently, the policy is to promote an A category employee 5 years after he or she joins that grade, a
B category employee after 6 years, and a C category employee after 7 years. Given below is a sample
list of 10 employees and their relevant data. Through spreadsheet, find the date of promotion of each
employee to the next grade.
How many employees would be promoted on or before 1/1/2000?
Emp.
Code
E0001

Grade
A

Date of joining the Grade


(dd/mm/yyyy)
1/1/1994

E0002

1/1/1993

E0003

1/1/1992

E0004

3/3/1998

E0005

4/3/1998

E0006

5/4/1997

E0007

6/5/1997

E0008

1/3/1996

E0009

3/6/1997

E0010

5/8/1996

Extension: The date of birth of each employee is known. The retirement age is 60 years. If the
retirement age occurs before the date for next promotion, put a star in a separate column.

Page 104 of 260

IIMA/CISG0104TEC

6. Income Tax Computation.


Suppose, in country ABC, if the income of a person is less than or equal to Rs 40,000 in the year
under consideration, no income tax needs to be paid. For income exceeding Rs 40,000, a standard
deduction of 5% ( of the amount beyond 40,000) is allowed and tax is charged at 40% on the
remaining amount. For example, for an income of Rs 70,000, the standard deduction is 0.05 *
(70000-40000) = Rs. 1500; the tax to be paid is 0.04 * ( 70000-40000-1500) = Rs 1,140. Given the
incomes of a number of persons, find the income tax to be paid by each using the above rules.
Sample data is given in the following table.
S.No.

Income (Rs)

40,000

35,000

41,000

75,000

1,00,000

Extension: Suppose the tax computation rule is modified as below. There is no standard deduction.
Compute the tax first and then deduct from it Rs.1000 to get the actual tax to be paid.

7. Vegetable Prices.
The following table, published in news papers from the data given by Agricultural Producers
Marketing Cooperative, shows the price in Rs/Kg of some vegetables for the years 1996 and 1998.
Compute the percentage increase of price for each of the vegetables. Arrange the items in decreasing
order of percentage increase in price.
Name of the vegetable

Price in Rs/Kg 1996

Price in Rs/Kg 1998

Potatoes

6.5

12

Onions

7.5

16

Pumpkin

10

18

Carrot

20

50

Lady's Finger

11

32

Gourd

18

18

Tomatoes

11

32

Coriander leaves

10

44.5

Green Chillies

11

45

Cauliflower

27

50

Cabbage

14

32

Bitter Gourd

14

27

Brinjal

20

20

Parwal

12

26

Extension:
A. Find average percentage increase
B. Find average percentage increase among those whose 1996 price is greater than 15.

Page 105 of 260

IIMA/CISG0104TEC

8. Weekly Wage Bills.


In a factory, wages are paid to workers on a weekly basis. The wage of a worker is computed as
number of hours worked * basic wage per hour. The basic wage differs from worker to worker.
Design a spread sheet for computing the wages each week. Each row of the spread sheet is devoted to
one worker. The columns are: (a) Name of the worker, (b) Employee number, (c) Basic wage per
hour, (d) Hours worked, (e) Amount to be paid. In addition, the spread sheet should compute the total
amount of the wages in the week, the maximum wage paid to a worker, the minimum, and the
average. It has to compute the same statistics (total, average, maximum, and minimum) for the data
on hours worked also.
Extension: Assume that all the workers are producing the same product. A certain standard rate of
production in number of pieces per hour is prescribed. Let the actual number of pieces produced
divided by actual number of hours be called actual rate of production. If the actual rate is less than or
equal to the standard rate the worker is paid at base rate. If it is higher, then the standard time needed
for the extra production is computed, and the worker is paid normal wage for the hours worked +
incentive rate * standard time for extra production. How do you incorporate this in the above spread
sheet. The current incentive rate is 1.5 times base rate.
Assume that the standard rate of production is 10 per hour per worker.
In a wage negotiation exercise it has been suggested that if the incentive rate is increased to 2 * base
rate, instead of the current value of 1.5 * base rate, the overall production is likely to increase by 10
percent. What would be the percentage increase in wage bill as a result of such an increase. Use the
following data on five workers as a typical sample:
Worker Number
1
2
3
4
5

Basic Wage
(Rs/hr)
20
30
40
35
25

Hours worked
50
40
30
30
40

No. of pieces
Produces
400
450
310
275
400

Extension: Suppose the workers are grouped into three types, A,B, and C. The Basic wage per hour
depends on the type to which the worker belongs. Therefore, in the input, you are given only the type
to which the worker belongs, and not the basic wage rate directly. Additionally, the basic wage rate
for each type is given in the form of a table. For the sample of workers given above, assume that the
new data is:
Worker
Number
1
2
3
4
5

Worker
Type
A
A
B
C
B

Worker
Type
A
B
C

Basic
(Rs/hr)
30
40
50

Assuming that the other data remains unchanged, develop a spreadsheet to answers the questions
posed.

Page 106 of 260

IIMA/CISG0104TEC

9. Sales Commission Problem.


The commission paid to a salesman in a company depends on the value of each sales-order. Assume
that the company deals with only one product. Each customer is given a certain percentage discount
on unit price. Call this as the customer discount rate. The customer discount rate differs from
customer to customer. In addition, if the quantity exceeds 1000 units, a certain percentage discount
on unit price is given for each unit above 1000. Develop a spread sheet to record the sales order data
for each sales order and to compute the sales commission to be paid on each order.\
Test Data:
Order Number
1
2
3
4
5

Customer Number
C100
C200
C100
C300
C200

Quantity Sold
500
700
1500
1100
1000

Sales commission is at the rate of 5% of value of the order.


Customer discount rates are 10%, 5%, and 15% for customers C100, C200, and C300 respectively.
The quantity discount rate for each unit above 1000 units is 5%.

10. All-Unit Discount.


A company has purchased several products from its supplier in a month. In all, there are four
different types of products, P1,P2,P3, and P4. If the quantity of purchase is greater than or equal to a
certain threshold value then a certain percentage of discount is available on all units purchased. For
each product type the unit price, the threshold quantity for discount, and the percentage discount are
given below:
Product
Code
P1
P2
P3
P4

Unit
Price
10
25
5
100

Threshold
Quantity
5000
10000
10000
1000

%
Discount
10
15
2
5

The details of products bought through ten purchase orders are given in the next table:
Purchase
Order No.
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010

Product
No.
P2
P3
P1
P4
P2
P2
P4
P3
P2
P3

Quantity
Purchased
500
1500
1000
10000
7500
1500
1000
2000
1700
5000

Compute using a spread sheet the total amount due to be paid on each purchase order.

Page 107 of 260

IIMA/CISG0104TEC

11. Profit And Loss Projection For ATC.


The revenue and cost figures for ATC, a private road transport undertaking, for the year 1988-89 are
presented in the following table:
A number of alternatives to improve the profit next year are under consideration. Consider them as
independent of one another, and evaluate them.
1.

The number of buses currently operating is 900, and the total kms. operating is 855.68 lakhs.
Next year new routes can be operated by using 10 more buses. The number of kms. increases
to 875 lakhs as a result.

2.

In the current year the occupancy ratio is 60%. Next year it is likely to increase to 65%.

3.

The fare can be increased by 10%. As a result the demand may decrease by 2%.

4.

By using better driving practices the tyre cost can be brought down by 10%.

In analysing the above alternatives use the following assumptions:


Item
Revenues
Operating revenue
Non-operating revenue
Costs
Fuel
Lubricants
Tyres
Spares and Repairs
Personnel
M.V. Taxes
Staff Welfare
Others
Total Cost
Profit before depreciation and tax

Rs. In lakhs
3506.00
91.6
818.61
35.18
218.74
209.72
955.00
438.90
200.00
100.00
2976.15
621.45

The cost of fuel, lubricants, and tyres are proportional to kms. operated; the M.V. taxes, cost of spares
are proportional to number of buses. Personnel cost can be assumed as cost per person * staff per bus
* no. of buses. Other costs are fixed and increase by 10% each year.

12. Evaluation of A Product Mix Plan


A machine shop consists of four machine centres M1, M2, M3, and M4 and manufactures four
different products P1, P2, P3, and P4. The product mix is planned on a weekly basis. The shop works
on all seven days of a week; a day is broken into three shifts, a shift consisting of seven working
hours. Not all machine centres work during each shift.
The following table shows for each machine centre, the number of shifts of working each day and the
number of identical machines that it consists of.
Machine Centre
M1
M2
M3
M4

Shifts per day


2
2
*3
A1

No. of machines
6
7
4
7

The next table shows for each of the products how much processing time one unit of it takes at each
of the machine centres, and its per unit contribution.

Page 108 of 260

IIMA/CISG0104TEC

Product
P1
P2
P3
P4

Procesing time (hrs) per unit


M1
M2
M3
M4
2
1
0
0
3
8
10
5
1
2
1
8
1
2
0
1

Contribution
3
10
2
5

Three product mix plans A, B, C and have been proposed for the forthcoming week as shown below:
Product
P1
P2
P3
P4

No. of units to be produced


Plan A
Plan B
Plan C
100
50
50
50
100
100
100
50
50
50
75
50

Questions:
1

Evaluate each plan in terms of the total machine centre hours required, and the total
contribution. Are all plans feasible? Which plan is the best?

2.

In case a plan(s) is infeasible suggest which parameters need to be changed and by how much
to make the plan feasible?

3.

Suggest a plan better than the best of the above three.

13. Choice of A Maintenance Contract


XYZ Company owns around 150 personal computer systems, comprising of IBM compatible PC,
XT, and AT systems, some of which are already about five years old. These systems have been
procured from about four different vendors, vendors A and B being the two largest suppliers. Both A
and B are manufacturers-cum-vendors of national reputation and have a nationwide network of sales
and maintenance. When a system is bought it is under warranty for one year; after the warranty
period the maintenance is done on a per-call basis or on a contractual basis, the typical contract
period being one year. It is not necessary that a system be maintained by its vendor; there are many
small companies which specialise in maintaining a variety of systems. At the time of writing, all the
systems bought from A were either under warranty or were being maintained by A itself. The others,
that is those bought from B and others, have been under the maintenance by a local computer
company, D, for one year; this contract has just expired and XYZ has invited quotations for
maintenance of these systems in the next year.
A personal computer system typically consists of the following units: A system unit consisting of one
or two floppy disk drives (FDDs), one hard disk drive (HDD) with 20 or 40 MB capacity; a
monochrome or colour monitor; and optionally, a dot matrix printer (DMP) with 80column, or 132
column (low or high speed) width.
Quotations have been received from three parties: B, D and E, another nationally known computer
manufacturer.
B offered to maintain only their own systems, whereas D and E offered to maintain all the systems
mentioned. However, B was keen on getting this contract and hence offered three options, unlike the
other two. These options were: 1. Annual contract, 2. Three year contract with payment to be made at
the beginning of each year, and 3. Three year contract with the entire payment to be made at the very
beginning. If the amount to be paid under option 1 is Rs. 100, then the option 2, the annual payment
is specified as Rs. 97, and in option the one time payment is Rs. 239.

Page 109 of 260

IIMA/CISG0104TEC

After analysing B's quotation, XYZ asked D whether D could also offer a three year contract, for
which D was agreeable and offered the three options as above with the following amounts: If the
payment under option 1 is Rs. 100, then the annual payment under option 2 would be Rs. 93.33 and
under option 3 the one time payment would be Rs. 240.
A list of the different types of equipment, the number of units under each category which were being
considered for the present maintenance contract, and a break-up of these according to the supplier are
given below:
Type
PC
PC/XT
PC-AT/286
PC-AT/386
80 column SMP
132 column slow speed DMP
132 column high speed DMP

Total number
2
23
3
1
13
9
2

No. bought from B


1
18
2
1
13
5
2

No. bought from others


1
5
1
0
0
4
0

Notes:
1. Of the 18 XTs bought from B, four were bought with colour monitor, and the rest with
monochrome.
2. Each of the XTs and ATs had a 20 MB hard disk.
The maintenance charges under option one for one unit of each equipment are shown below.
Equipment
Standard PC (2-floppy drives)
Standard PC-XT
(20MB, HDD, IFDD, CGA, 640KB RAM)
Standard PC-AT (2MB RAM, 20MB
HDD, 1FDD, CGA Monitor)
80 column DMP
132 column DMP (slow)
132 column DMP (fast)

Maintenance Charges (Rs)


B
D
C
2500
1800
3000
3000
2700
3800
(3800 for colour monitor)
(4180 for 40MB HDD)
8500
7500
9000
800
1500
2000

900
1350
1650

1000
1600
2300

It may be noted that the charges quoted by D are the same as those charged by them last year. During
the past one year, D's performance was considered to be quite good by XYZ.
Using the above data find which of the above proposals should be accepted by XYZ.

14. A Materials Requirements Planning (MRP) Problem


Product P1 is made of components P2 and P3. P2 is made of components P3 and P4, P3 and P4 are
purchased from outside. One unit of P1 requires 3 units of P2 and 4 units of P3. One unit of P2
requires 2 units of P3 and 5 units of P4. The demand for P1 in January, February ......... December is
follow:
Jan
100

Feb
150

Mar
200

Apr
100

May
80

Jun
80

Jul
75

Aug
200

Sep
300

Oct
350

Nov
100

Dec
100

Find out the quantities of P1, P2, P3 and P4 that we need to produce (or purchase) to meet the above
demand. The inventory at the beginning of January of different products is as follows:

Page 110 of 260

IIMA/CISG0104TEC

Product
P1
P2
P3
P4

Inventory at beginning
of January
50
400
600
1000

Use the following equation: Inventory at the end of month = Inventory at the beginning + production
in the month - Consump- tion in the month. Assume that all lead times are zero.
Extension:
Suppose the lead times for production for P2 and P1, and the lead times for purchase for P3 and P4
are known. How do you modify your computation? Use the following data: For Product P1, the lead
time is one month, for P2, P3 and P4 two months each.

15. A Project Appraisal Problem


Suppose we are evaluating a project proposal with the following data:
1.

The project consists of setting up a plant to produce a product. The full capacity of the plant is
2,00,00,000 tonnes per year. However, it is estimated that the full capacity cannot be achieved
in the very first year. The rate of production at the end of the first year is expected to be
1,00,00,000 tonnes per year. Later this rate is expected to increase at the rate of 20,00,000
tonnes per year till the full capacity is achieved.

2.

The capital investment in the project would be Rs.100,00,000 and the entire investment has to
take place right at the beginning of the project. This is required to acquire buildings, plant and
machinery.

3.

The plant, machinery, and buildings are to be depreciated as per the straight line method. The
amount of depreciation per year is equal to 15% of the initial cost of the above assets.

4.

The unit variable cost of production is estimated to be Rs.0.15 and is expected to remain
constant throughout the project. The fixed cost per year is estimated to be Rs. 25,00,000 in the
first year, and is expected to increase by 3% each year.

5.

It is assumed that there is no dearth of demand and that the entire quantity produced can be
sold. The unit price (assumed constant) is assumed to be Rs. 0.45.

6.

The tax rate is 48% per year on the profit made.

7.

The life of the project is assumed to be 7 years; at the end of this period, all the assets can be
disposed off at their book value.

Question: Using Spread Sheet, find whether the above proposal is financially acceptable. Assume
that the discount rate is 18%.

Page 111 of 260

IIMA/CISG0104TEC

16. Problems In Materials Management (The following three problems, 16.1,16.2, and 16.3
were suggested by Prof. T.P. Rama Rao, IIM, Ahmedabad)
16.1. Lead Time Analysis: The performance of a purchase or production department is largely
governed by the lead times experienced by the various items. Lead time is generally defined as the
interval between the perception and the fulfillment of a need. Accordingly, if a purchase requisition
for an item is raised on January 1, 1987, and the item is received at the stores on January 25, 1988,
the total lead time experienced by this item is said to be twenty five days. The total lead time for a
purchased item is made up of several components: 1. the interval between the raising of the purchase
requisition and the dispatch of the corresponding purchase order, 2. the interval between the dispatch
of the purchase order and the receipt of material, and finally 3. the interval between the receipt of the
material and its acceptance by the inspection department. An analysis of these different components
can be of great help in deciding the areas to be improved in the purchasing and the receipt process.
Suppose the data on the Date of Requisition, Date of Receipt, and Date of Acceptance is available in
the form shown below. Design a spread sheet to find the mean and variance of these components and
the total.
RQ DATE
3/1/87
3/1/87
4/1/87
4/1/87
6/1/87

PO DATE
6/1/87
5/1/87
7/1/87
8/1/87
9/1/87

RC DATE
15/1/87
2/2/87
22/1/87
19/1/87
20/1/87

ACC DATE
17/1/87
5/2/87
26/1/87
25/1/87
24/1/87

16.2. Vendor Analysis: Even though selection of a supplier for any given item involves much
judgement, the modern tendency is to make this process as objective as possible. For this, all possible
suppliers are numerically rated on dimensions such as price, delivery, and quality. Then a combined
score for each supplier is arrived at by multiplying the individual scores by suitable weights, which
are subjective, and adding them up. Then the vendors are ranked using their combined score.
Suppose a company rates its vendors on three dimensions: price, delivery, and quality. The following
formulae are used to arrive at the respective scores:
1.

Price score = (Lowest price among all vendors)/(price of the current vendor)

2.

Delivery score = (Shortest delivery time)/ (delivery time of the vendor)

3.

Quality score = 1-(0.30* percent defective/ acceptable quality level)

The weights used for price, delivery, and quality in developing the combined score are 50, 25, and 25
respectively. Develop a spread sheet to find the vendor ratings for this company. Use the following
sample data:
Vendor Code
1001
1002
1003
1004

Unit Price
32.00
25.00
30.00
28.00

PO Date
3/1/87
4/1/87
6/1/87
10/1/87

Rec Date
25/1/87
10/1/87
21/1/87
1/2/87

% Defective
4
10
8
10

Assume that the acceptable quality level, that is acceptable percentage defective, is 5 for the item
under consideration.

Page 112 of 260

IIMA/CISG0104TEC

16.3. Consumption Budgeting: For the past year we know for each user the quantity of each item
consumed. Given this data, and the price table containing the unit price of each item, design a spread
sheet that gives us, in the form of a cross table, the value consumed by each user for each item. This
would be of help in setting consumption targets for the next year, if we know the percentage increase
in the price of an item or the percentage increase in the quantity of consumption of a user. Use the
following data:
USER
A100
A100
A100
B100
B100
C100
C100
D100

ITEM
1001
1002
1003
1002
1004
1002
1004
1005

QUANTITY
100
200
150
75
125
110
78
102

Price Table
ITEM
1001
1002
1003
1004
1005

UNIT PRICE
10
15
20
17
18

17. Analysis of Purchase Order Data Base


SNO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

PONO
6
7
2
1
5
4
9
3
10
8
15
16
17
11
18
12
19
13
20
14

SUPNO
S1
S4
S2
S3
S2
S1
S3
S5
S1
S6
S4
S6
S1
S4
S6
S2
S5
S4
S6
S5

VALUE
1000
500
2000
3000
700
800
200
10000
15000
500
1000
1100
900
1200
700
1300
500
1400
600
1500

LT
3
2
9
5
7
8
15
10
1
4
5
9
6
5
4
6
3
7
8
9

The above table shows the data on several purchase orders. For each order the data items given are:
1. Serial Number (SNO),
2. Purchase Order Number (PONO),
3. Supplier Number (SUPNO),
4. Value of the Order (VALUE), and
5. Lead time (LT).

Page 113 of 260

IIMA/CISG0104TEC

Using spread sheet answer the following questions:


1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.

How many orders were placed on supplier S1?


What is the total value of all orders placed on S1?
Of all orders placed on S1, what is the VALUE of the order with highest VALUE?
For each order placed on S1, show its LT and VALUE
Show all the details of purchase orders with value greater than 3000.
How many orders placed on S1 were supplied with lead time less than 4?
Show the details of all orders which had their LT in the range 5 and 8.
Which are the orders which had very low value ( VALUE <=500) or high value (VALUE
>=10000)
Show the row(s) related to highest value order(s) in the above table in green colour and lowest
value order(s) in red colour. The colours should change automatically if the data changes.
Show the details of purchase order(s) with highest VALUE.
Show the details of purchase orders whose LT is within 30% of the highest LT.
Develop a table that shows for each supplier the total value of orders placed on the supplier
If next year the prices of all items increase by 10%, and if the same orders are going to be placed
on the same supplier, what would be the total payment to S1 (next year).
From the given data produce three different data bases in the same spread sheet by rearranging
(and at the same time not disturbing) the given data in the following orders: (1) ascending order
of lead times, (2) descending order of value; (3) Ascending order of supplier codes.

18. A Macro for Exhibiting Range Name Table


You can get a table of range names and the corresponding range addresses exhibited in two
contiguous columns anywhere in the spreadsheet by choosing the sequence of menu options: InsertName-Paste; and, by clicking the button pastelist in the resulting dialog box. This is provided to help
you when you forget the range name details while working with a spreadsheet. The range name table
is pasted starting from the currently active cell. The table consists of two columns, the first column
showing the range names and the second the corresponding range addresses. The following
questions are related to automating the above task.
A. Name the range in which you want the range name table to be exhibited as XYZ. Develop a macro
to automate the procedure for making the table exhibited in the range XYZ.
B. Modify the macro in A such that the table range is not decided in advance but is fed by you during
the execution of the macro.
C. Extend the above macro to do the following additional task: after the display of the table, the
macro should pause indefinitely to allow the user to study the table, and after the ENTER key is
pressed by the user the macro should erase the range name table.
D. Is it possible to design the macro such that the macro can by itself find a vacant range in the
spreadsheet for exhibiting the table, without obtaining its address from the user?

19. A Capacity Planning Problem


A machine shop has five machine centres M1,M2,M3,M4, and M5. There are four different products
P1,P2,P3, and P4 to be manufactured on these machines during a planning horizon. You are given
the quantity required of each of these products at the end of the horizon. For each product the raw
material enters the centre M1, and then it is processed on M1,M2,M3,M4, and M5 in that sequence,
and finally comes out of M5 as finished product. It is possible to have some partly finished items
available before each machine centre (possibly left over for some reason in the previous horizon).
Such stock is called work-in-progress inventory (WIP). The items in WIP before a machine centre
are already processed on all prior machine centres, but need to be processed from that machine centre

Page 114 of 260

IIMA/CISG0104TEC

onwards. In planning horizon, in a machine centre we process only the quantity just enough to meet
the requirements at the end of the horizon.
Suppose for example that for product P1 the requirement in a planning horizon is 100 pieces. The
WIPs of P1 before M2,M3,M4, and M5 are 30,50,30,and 40 respectively. Then to meet the end-ofthe-horizon requirement we need to process on M5, 1000 pieces; on M4, 960 pieces; on M3, 940
pieces; on M2, 890 pieces; and on M1, 860 pieces.
As a second example, suppose, the requirement of P2 is 2000 pieces. The WIPs of P2 before
M2,M3,M4, and M5 are 100,200,750, and 1300 respectively. Then to meet the given requirement of
P2, we need to process on M2 5000 pieces of P2; on M4, 700 pieces; and on the other machine
centres none.
Given the end-of-horizon requirements and the WIPs before each machine centre for each of the
products, design a spread sheet to compute the number of pieces of each product to be processed on
each centre just to meet the given requirements. Further you are also given for each centre and for
each product, the production rate in number of pieces per hour. Find the number of hours needed for
each product on each centre, and for all products put together the total number of hours of load for
each machine centre.

Page 115 of 260

IIMA/CISG0104TEC

20. Sales Territory Allocation.


You are given a set of twenty sales zones, along with the potential sales of each of them. There are
four sales persons among whom these zones are to be allocated, five zones per person. Develop a
spread sheet that contains the data on sales zones and in addition contains four macros, one for sales
territory allocation for each sales person. A macro when evoked does the following: It obtains
interactively from you the names of each of the five zones to be allocated to the sales person under
consideration. These zone names along with their potential sales are copied to a suitable range and
the total sales allocated to the sales person is also automatically computed. Give the design of the
spread sheet along with the macros.

21. Macros for Range Formatting.


Record a set of macros, each of which when initiated after highlighting a desired range will format
the range in a pre-specified manner. A small list of such macros is given in the following table.
S.No.
1
2
3
4

What the macro does


To change the color of the font to red
To change of the color of the font to green
To change the style of the font to bold
To change the style of the font to italics

Short Cut Key to


invoke the macro
R
G
B
I

Name of the
macro
ColorRed
ColorGreen
StyleBold
StyleItalic

22. A Grpah Plotting Macro.


Excel offers a variety of options for graphical display of data contained in a worksheet. Once the data
to be displayed is in place, the menu options Insert Chart have to be chosen for graph plotting.
Then the chart wizard takes you through a four step process to help you specify the various options
for the graph.
Step 1 lets you specify the type of graph that you want to plot: line graph, bar graph, XY (Scatter)
plot, or pie graph. In fact, the number of graph types and sub-types keeps increasing with every new
version of the package.
Step 2 lets you specify the range in which the data to be plotted is contained.
Step 3 lets you specify a title for the chart, and titles for the x and y axes. The chart can be plotted in a
sheet separate from the sheet containing the data or it can be plotted within the sheet containing the
data.
The choice of chart location is to be specified in Step 4 of the wizard.
Furthermore, by using the Chart toolbar you can do the following: change the format of any of the
chart objects, change the type of the chart, plot the data table along with the chart, and change the
orientation of the text on the graph. Interestingly, once a chart is plotted, its link with the source data
is maintained, so that whenever the source data is changed, the graph gets re-plotted automatically.
Suppose you have the data to be plotted in two contiguous columns and the titles of the columns are
just above (ie in the first row of the data range) the respective columns of data. You want to choose
the first column for the x-axis values and the second for Y-axis and plot them as an XY (Scatter)
graph. Develop a macro with the short cut name cntrl+S such that when the macro is invoked after
highlighting the Y-axis data range, the XY plot with the desired options is generated.

Page 116 of 260

IIMA/CISG0104TEC

23. Journal Subscription Charges.


A quarterly journal published by a university has announced its journal subscription rates as below:

Indian (in Rs)


Regular
Student
Alumni
Foreign (in US$)
Air-mail
Surface Mail

One year
800

Two years
1500

Three years
2200

400
700

600
1300

1000
1900

90
60

150
100

200
140

Analyze the above scheme financially, and for each category of subscriber find which kind of
subscription would be the most desirable. Make suitable assumptions regarding parameters such as
discount rate.

24. A Prototype Library Fine Management


A library wants to experiment with data related to issues and returns related to five different
books, five different users; the sample data related to ten issues involving the above users and
books is being tested through a spreadsheet, which would serve as a prototype for a full scale
system, intended to be developed later. The transactions are entered in the rangeC6:J15. The
fields for each transaction are: Book Number (BOOKNO), User Number Issue Date, Due Date,
Return Date (if the book is already returned), Delay in days in returning the book (beyond the due
date), Fine for the delay (if any), whether the fine is cleared. The headingsof these fields are given
in the corresponding cells of the range C5:J5. The date setting for the spread sheet is
dd/mm/yyyy, and the dates data is entered accordingly. If a book is not returned, the entries in the
corresponding cells of fields ReturnDate, Delay, Fine and Cleared would be blank. The fine
charged is equal to Rs 0.75 per day of delay beyond the due date, subject to a ceiling on of 1.5
times the price of the book (ie the fine never exceeds 1.5 times the price of the book). As soon as
the fine is computed, the value in the Cleared field is entered as FALSE by the counter operator.
When the fine is paid, the value is changed by the operator to TRUE. The price of each book is
entered in the range K6:L10, the column K containing the Book Number, and L the price.
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

C
BookNo
.

D
UserNo.

BookNo
.

UserNo.

UserNo.

Tot.PendingFine

E
IssueDate

IssueDate

F
DueDate

DueDate

G
ReturnDate

ReturnDate

H
Dela
y
-------

I
Fine

Dela
y

Fine

J
Cleared

K
BookNo
.

L
Price

-----

Cleared

Question 1. Write a formula in cell H6, such that when copied to H7:H15, it computes the Delay
for each of the corresponding transactions, as per the rules given above.

Page 117 of 260

IIMA/CISG0104TEC

Answer: _________________________________________________________________________

Question 2. Write a formula in cell I6 such that when copied to I7:I15, it computes the fine for
each of the transactions as per the rules given above.
Answer: __________________________________________________________________________
_________________________________________________________________________________

Question 3. In the range C24:C28, the User Numbers of each of the five users are entered. In the
corresponding cells of D24: D28, you need to obtain the total pending fine of the corresponding
users, with the help of the data table feature, along with the criterion range given in C18:J19. The
field headings in the criteria range are already given as shown in the figure.
3.a. Give below the values to be filled in, if any in the second row of the criteria range.
Answer:_________________________________________________________________
18
19

C
BookNo.

D
UserNo.

E
IssueDate

F
DueDate

G
ReturnDate

H
Delay

I
Fine

J
Cleared

3.b. What is the formula in cell D23? _____________________________________________


3.c. What is the column input cell in the data table operation?

_______________________

25. Number of Retirements


In XYZ company the retirement age of an employee is sixty years. However, as it is inconvenient
to retire an employee during the middle of a month, the company has decided that a retirement
date would be the last day of the month in which the employee completes sixty years. For
example, if the date of birth of an employee is January 2, 1955, she/he completes sixty years on
January 2, 2015, and her/his retirement date would be January 31, 2015. The employee codes and
their respective dates of birth are given in the adjacent columns of a range in a spreadsheet.
Incorporate the features necessary to find how many employees of the above list will retire during
a given year and month. Further, tabulate the number of retirements for a given list of years for
each month. Solve the problem in two different ways: (1) using the function EOMONTH, (2)
without using the function EOMONTH. You can use the following sample data for your work.
EmpCode
ABC
CDE
VFR
HUU
EFG
FGH
GGG
HRS
GFD

DateBirth
03-Jan-49
19-Jul-51
18-Jun-55
05-May-54
09-Feb-40
10-May-41
02-Feb-44
03-May-40
04-Oct-49

Page 118 of 260

IIMA/CISG0104TEC

26. Multiplex Movies


Mr. Jolly Good wants to take his wife and two children to a movie in one of the multiplexes in the
evening. His requirement is that the movie should start between 6 PM (ie 18 hrs) and 7 PM (ie 19
hrs). He wants to know, therefore, all the movies that satisfy the above requirement, their theatres,
and the total ticket charge.
Suppose information related to the current starting time of each show for each movie in each
multiplex is given in range B3:H34 of a spreadsheet, as shown in the accompanying figure. The
different columns contain the following items:
Column B: Name of the multiplex in an abbreviated form.
Column C: Title of the movie. For long movie titles, abbreviations are used, as per the prevailing
fashion.
Column D: Language of the movie: E for English, empty cell for Hindi. Other language movies
are not shown in the multiplexes under consideration.
Columns E through H: Starting time, in 24 hour format, of the four shows respectively. A show
never starts before 11.30 AM, nor after 11.30 PM in the night. An empty cell indicates that the
movie is not scheduled for the corresponding show.
A.

From the above data you need to extract the list of movie-multiplex combinations (along
with other relevant information) that satisfy Mr. Jolly Good's requirement. Mr. Jolly Good
may want to experiment with the spreadsheet by changing the desirable starting timewindow (for example, between 5.00 PM and 6.00 PM, between 6.30 PM and 7.30 PM etc).
The output should be written starting from cell P4, and using as many rows below it as
needed, one row for each feasible multiplex-movie combination.

B.

Additionally, for each theatre and movie combination produced above, you need to compute
the ticket charge for four tickets for the silver and gold classes, and write them in adjoining
cells after each row of output produced above. For English movies some theatres offer
concession; the concessional charge is obtained by applying a given percentage of
concession on the normal charge. Hindi movies are charged at the normal rates. The normal
charges for both the classes, and the percentage concession for English movies are given in
the spreadsheet itself.

C.

Compute in one cell the minimum charge among all the feasible options.

Show neatly a layout of the additional cells used by you in answering the above questions, and
explain in detail all the formulae and other contents.

Page 119 of 260


A
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

Multiplex
FR
FR
FR
FR
FR
FR
FR
FR
FR
FR
WA
WA
WA
WA
WA
WA
WA
CG
CG
CG
CG
CG
CG
CG
RW
RW
RW
RW
RW
RW
RW

IIMA/CISG0104TEC
C

Movie
Terminator3
ChoriChori
DMH
Hungama
Jaai
Jhankar Beats
MPKDH
Oops
Qayamat
Deewarein
Hungama
ChoriChori
Oops
MPKDH
Qayamat
Terminator3
DMH
Hungama
ChoriChori
Oops
Qayamat
DMH
MPKDH
Terminator3
Hungama
ChoriChori
Oops
Deewarein
DMH
Qayamat
Terminator3

Lang Show1 Show2 Show3 Show4


E
12.00
19.45
22.15
12.30 15.40
18.45
21.30
12.15 14.45
17.15
22.00
12.15 15.20
18.30
21.45
12.15
14.15
15.15
18.35
12.45
18.45
22.00
15.45
17.00
19.30
22.15
12.15 15.15
18.30
22.00
12.00 14.30
19.30
22.15
12.30 17.00
22.15
15.15
18.30
E
11.30 15.45
20.00
13.30 17.45
22.15
12.00 15.15
18.30
21.45
12.30 15.30
18.30
22.00
12.15 15.15
22.00
18.15
12.30 15.30
18.30
22.00
11.45 15.00
22.00
18.00
20.00
12.30 16.15
19.15
22.15
15.00 18.00
20.15
22.30
16.00 18.00
14.00
12.00
22.30
12.00
E
14.30

Multplxcode
FR
WA
CG
RW

Mltplxame
FunRepublic
WideAngle
CityGold
Rworld

Moviecode
MPKDH
DMH

Expansion
MainPremKiDiwaniHoon
DarnaManaHai

RsSilver RsGold Econcession


90
100
25
90
100
25
90
100
0
80
100
50

Page 120 of 260

IIMA/CISG0104TEC

27. Checkdigit Validation


A part-code originally consists of nine digits. A digit called a 'check digit' is obtained by applying
a given arithmetical method on the nine digits. By appending the check digit to the right end of
the nine-digit original code, the ten digit full code is obtained. It is the full code that is entered
into the computer system.
Possible data entry mistakes in entering the full part code are captured by the computer system as
follows:
1. First separate the tenth digit (to be referred to as the entered check digit) from the entered
code.
2. Re-apply the arithmetical procedure used to generate the check digit originally, on the nine
digits obtained in step one. The result is referred to as the computed check digit.
3. Compare the computed check digit with the entered check digit. If the two do not tally
indicate an error message; otherwise, accept the full code as correct.
The above process is illustrated by the following example:
1. Let the code entered be 1211323218. Therefore the entered check digit is 8.
2. The original computational process for computing the check digit is as follows:
Obtain nine different products by multiplying the right most digit of the original code by 1, the
one to its left by 2, and so on, and finally the left most one by 9. Add up the nine products so
obtained, and find the remainder of the sum when divided by 11. The remainder is the check digit.
If the remainder is 10, then the check digit is taken as X.
Let us use the above method on the nine digited number, 121132321. After removing the entered
check digit, we get the nine products as
9, 16, 7, 6, 15, 8, 9, 4, 1. The sum of these products is 75. The remainder obtained after dividing
75 by 11 is 9.
Therefore, the computed check digit is 9.
3. The entered check digit is 8, which is different from the computed check digit, 9. Hence the
computer concludes that there is a mistake in entering the above code
In a spreadsheet, a VBA function named VALID with a ten-digit string as argument is written.
The function returns a value "OK" or "Not OK" depending on whether the ten-digit number
passes the checkdigit test or not. You should be able to use the function in any cell of the
spreadsheet as =VALID(cell reference or string constant). The argument of the function should be
a cell address such as A10 which contains a ten-digit string, or the string itself enclosed in quotes.
For example =VALID(A10) takes the contents of cell A10 and tells whether the contents satisfy
the checkdigit test; =VALID("1211323218") applies the check digit on the number 1211323218
and tells whether the number satisfies the checkdigit test.

Page 121 of 260

IIMA/CISG0104TEC

The function is given below with a few blank lines. Fill in the blanks.
Function valid(strg As String) As String
'To validate a ten-digit string using check digit method
'Input argument is a ten-digit string
'Output is "OK" or "NotOK"
'Modulo 11 method for check digit
'Multipliers are 1,2,...,9
'Important functions and operators used:
'Mid(s,p,n):
Returns from string s the substring
'
starting from position p and of length n
'Right (s,n):
Returns from string s the substring
'
at the right end of length n
'Val(s):
Converts the string s composed of only digits
'
into its corresponding number
'Len(s)
Length of string s
'Mod Operator:
A Mod B, where A and B are integers, gives the remainder
'
when A is divided by B

Dim sum As Integer, j As Integer, remainder As Integer


valid = "OK"
___________________________________
__________________________________
__________________________________
___________________________________
remainder = sum Mod 11
If remainder <> 10 Then
If ________________________________ Then
valid = "NotOK"
End If
Else
If _________________________________ Then
valid = "NotOK"
End If
End If
End Function

Page 122 of 260

IIMA/CISG0104TEC

28. Bin Packing Problem.


Suppose there is a given set of N objects, each with a given weight, and these are to be put in
containers each of which can be loaded up to a given maximum weight, known as its capacity,
with each container having the same capacity. The capacity of a container is at least as high as the
weight of the heaviest of the above N objects. While a container can be loaded with more than
one object, an object has to be loaded only in one container, i.e. it cannot be split between
containers. The objects are indexed as 1, 2, N and the containers are also indexed as 1, 2, etc. The
problem is to decide the number of containers needed for loading the objects and the scheme of
allocation of objects to containers.
VBA-based solution for the Bin Packing Problem. Suppose N=11, and the weights of the
eleven objects are given as input in the corresponding cells of range C6:C16, named as Weights.
The capacity of a container is given in cell E2. A VBA SUB named binmain( ) has been
writtensuch that when it is executed by pressing a button, the objects are allocated to the
containers, using the following logic:
Consider the containers in the order 1,2, etc. When a container is considered, load as many
unloaded objects as possible into it (i.e. without exceeding its capacity limit), considering the
objects in their index order.
The Sub produces two types of output:
1. the index of the container into which an object is loaded is written in the corresponding cell of
the range D6:D16, named as allocation, and
2. the number of bins used is written in cell G2, which is named as Noofbins.
A. Fill in the blank lines in the VBA code of the above SUB, shown on the next page. The
blanks lines are given within rectangular boxes. Assume that each blank line contains one VBA
statement
Sub binmain( )
'----------------------------------------------------------------------------------------'wc...... Capacity of a container, ie maximum weight that it can be filled with
'N....... Total number of objects to be assigned to containers
'NR ..... Number of objects still to be assigned
'w(j).... Weight of jth Object
'C(j).... Cotainer number to which jth object is assigned
'CC ...... Container number under consideration
'CCR ..... Unfilled capacity of CC
'Range Names:
'NoofObjs..F2.. No. of objects
'Capacity..E2. Maximum load that can be taken by a container
'Weights... C6:C16... Contains weights of each object
'Allocation..D6:D16... Contains the container-index to which the corresponding
' object is allocated
'Noofbins....G2......... No. of bins finally obtained as solution
'-----------------------------------------------------------------------------------------' Initialization
Dim n As Integer, nr As Integer, wc As Integer
Dim cc As Integer, ccr As Integer, jobj As Integer, j As Integer
cc = 1
' read N,wc from spreadsheet
n = Range("NoofObjs").Value
wc = Range("Capacity").Value

Page 123 of 260

ccr = wc
nr = n
Dim w(1 To 20) As Integer, c(1 To 20) As Integer
'Read weights of objects from C6:C16 (range "weights")
Range("weights").Select
For j = 1 To n
w(j) = ActiveCell.Offset(j - 1, 0).Value
c(j) = 0
Next j
Do While nr <> 0 ' Still some objects are to be assigned
' Is there a J such that C(j) = 0 and w(j).LE.CCR
jobj = 0
j=1
_________________________________
_________________________________
____________________
____________
__________
_________

If jobj > 0 Then


' Assign jobj to current container
c(jobj) = cc
ccr = ccr - w(jobj)
nr = nr - 1
Else
' Open a new container
_____________________________
_____________________________

End If
Loop
' Write C(j)'s in range "allocation"
Range("allocation").Select
_________________________________
_________________________________
_________________

Range("Noofbins").Value = cc
End Sub

IIMA/CISG0104TEC

Page 124 of 260

IIMA/CISG0104TEC

Formula-based spread-sheet solution for the Bin Packing Problem.


Suppose, once again, that you are given 11 objects to be loaded into containers as per the rules of
the bin packing problem described above. Additionally, the objects are indexed in the nonincreasing order of their weights; that is for j > i , weight of object-j is less than or equal to weight
of object-i. The weights are available in a spreadsheet, different from the one mentioned under
VBA-based solution, in the corresponding cells of the range C6:C16, with C6 containing the
weight of object-1, and C16 the weight of object-11. The capacity of a bin is given in cell D2.
The object allocation to bins has been accomplished with spread sheet formulae (without using
any VBA coding nor macros), which follow the allocation logic outlined below:
Initially keep all bins open, and obviously each is empty. The very first bin to be considered for
loading is bin-1. Call the bin under consideration as the current bin. Consider the objects in their
index order, starting with the object having index 1. Call the object under consideration as current
object. If the current object can be allocated to the current bin without violating its capacity limit,
allocate it accordingly. Otherwise, close the current bin and make the next open bin in sequence
as the current bin and allocate the current object to it. Make sure that a bin, once closed, is not
loaded further. Once an object is allocated, consider the next object in sequence, and so on till all
the objects are allocated.
The indices of the bins into which each of the objects is to be loaded are the output of the above
process and this output is written in E6:E16. For example, into E6 is written the index of the
container into which object-1 is loaded, and E16 the index of the container into which object-11 is
loaded. The number of bins needed is output in cell E2. As the objects are assigned to the bins one
after the other, the cumulatve weight of a bin increases as soon as an object is assigned to it.
These cumulative weights are computed in range D6:D16. Cells D5 and E5 are also used.
B. What are the formulae in D6: D16. Design the scheme of computations such that you enter
only a few necessary formulae and generate the others by copying. What is the content of D5?
C. What are the formulae in E6:E16, and what is the content of E5? Follow the same suggestion
as above.
D. What is the formula in E2?
E. Once, the allocation is found, then for each of the bins used, the total weight loaded is obtained
in column I, beginning with cell I19. For this, data table feature is used. Assume, if necessary
that some additional cells need to be used for this. Explain the additional cells needed, if any, and
their contents.

29. Medal Tally in Atlanta Olympics


Given below is a range of a spread sheet ( Data Source: Article on 1996 Summer Olympics
Medal Table, Wikipedia, http://en.wikipedia.org.wiki/1996_Summer_Olympics_Medals_Table)
showing the number of gold, silver and bronze medals won by each of the countries which
participated in Atlanta Olympics. The table is arranged in alphabetical order of country names.
Incorporate the necessary formulae and design the necessary operations in the spreadsheet to
answer the following questions or perform the tasks stated:
1. Re-organize the data in the table according to descending order of number of golds; if there is
a tie, use the number of silver medals for tie-breaking; if there is a further tie, use number of
bronze medals; then finally, total number of medals. If the tie still remains unbroken, break it
randomly.
2. Suppose the rank of a country is determined using the above rule. Countries with the same
number of medals in each category should be ranked the same. Create a separate field for the

Page 125 of 260

IIMA/CISG0104TEC

rank of each country and determine the ranks. Is it possible to determine the ranks without
actually sorting the data as mentioned above? Suppose the ranks are generated by treating
one gold medal as equal to 4 silver medals, or 10 bronze medals. Using the same rule, one
silver medal becomes equal to 2.5 bronze medals. What would be the new ranking as per this
rule?
3. In a cell(s) of your choice, show the name of the country or countries with the maximum
number of golds. Similarly, show in separate cells the names of countries with the maximum
nmber of silvers and bronzes.
4. Classify the countries according to the continent to which they belong: Asia, Australia,
Europe, Africa, North America, and South America. Generate the medal tally for each
continent.
5. How many countries have won all three categories of medals?
6. List the names of countries each of which has won at least 5 golds and at least a total of 20
medals. Develop a two way table by varying the above two values (that is at least 6 golds and
at least 21 total number etc)
7. According to a hypothesis, the countries with top position in gold medals, do not rank high in
bronze medals. Does the above data support this hypothesis?
8. Build a feature in the spreadsheet such that the colour of the font for the country names
changes as follows: A. red, if the country has a single digit total, B. blue, if the country has no
gold nor silver and has single digited number of bronze medals, and C. green, if the country
has a rank of less than or equal to ten.
Table: Medals Tally in Atlanta Olympics
(Source: http://en.wikipedia.org.wiki/1996_Summer_Olympics_Medals_Table)
S.No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

Country
Algeria[ALG]
Argentina[ARG]
Armenia[ARM]
Australia[AUS]
Austria[AUT]
Azerbaijan[AZE]
Bahamas[BAH]
Belarus[BLR]
Belgium[BEL]
Brazil[BRA]
Bulgaria[BUL]
Burundi[BDI]
Canada[CAN]
Chinese Taipei[TPE]
Costa Rica[CRC]
Croatia[CRO]
Cuba[CUB]
Czech Republic[CZE]
Democratic People's Republic of Korea[PRK]
Denmark[DEN]
Ecuador[ECU]
Ethiopia[ETH]
Finland[FIN]
France[FRA]
Georgia[GEO]

Gold
2
0
1
9
0
0
0
1
2
3
3
1
3
0
1
1
9
4
2
4
1
2
1
15
0

Silver
0
2
1
9
1
1
1
6
2
3
7
0
11
1
0
1
8
3
1
1
0
0
2
7
0

Bronze
1
1
0
23
2
0
0
8
2
9
5
0
8
0
0
0
8
4
2
1
0
1
1
15
2

Total
3
3
2
41
3
1
1
15
6
15
15
1
22
1
1
2
25
11
5
6
1
3
4
37
2

Page 126 of 260


S.No.
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

IIMA/CISG0104TEC
Country
Germany[GER]
Great Britain[GBR]
Greece[GRE]
Hong Kong[HKG]
Hungary[HUN]
India[IND]
Indonesia[INA]
Ireland[IRL]
Islamic Republic of Iran[IRI]
Israel[ISR]
Italy[ITA]
Jamaica[JAM]
Japan[JPN]
Kazakhstan[KAZ]
Kenya[KEN]
Korea[KOR]
Latvia[LAT]
Lithuania[LTU]
Malaysia[MAS]
Mexico[MEX]
Mongolia[MGL]
Morocco[MAR]
Mozambique[MOZ]
Namibia[NAM]
Netherlands[NED]
New Zealand[NZL]
Nigeria[NGR]
Norway[NOR]
People's Republic of China[CHN]
Phillippines[PHI]
Poland[POL]
Portugal[POR]
Puerto Rico[PUR]
Republic of Moldova[MDA]
Romania[ROM]
Russian Federation[RUS]
Slovakia[SVK]
Slovenia[SLO]
South Africa[RSA]
Spain[ESP]
Sweden[SWE]
Switzerland[SUI]
Syrian Arab Republic[SYR]
Thailand[THA]
Trinidad and Tobago[TRI]
Tunisia[TUN]
Turkey[TUR]
Uganda[UGA]
Ukraine[UKR]
United States of America[USA]
Unknown
Uzbekistan[UZB]
Yugoslavia[YUG]
Zambia[ZAM]

Gold
20
1
4
1
7
0
1
3
1
0
13
1
3
3
1
7
0
0
0
0
0
0
0
0
4
3
2
2
16
0
7
1
0
0
4
26
1
0
3
5
2
4
1
1
0
0
4
0
9
44
0
0
1
0

Silver
18
8
4
0
4
0
1
0
1
0
10
3
6
4
4
15
1
0
1
0
0
0
0
2
5
2
1
2
22
1
5
0
0
1
7
21
1
2
1
6
4
3
0
0
0
0
1
0
2
32
1
1
1
1

Bronze
27
6
0
0
10
1
2
1
1
1
12
2
5
4
3
5
0
1
1
1
1
2
1
0
10
1
3
3
12
0
5
1
1
1
9
16
1
0
1
6
2
0
0
1
2
1
1
1
12
25
0
1
2
0

Total
65
15
8
1
21
1
4
4
3
1
35
6
14
11
8
27
1
1
2
1
1
2
1
2
19
6
6
7
50
1
17
2
1
2
20
63
3
2
5
17
8
7
1
2
2
1
6
1
23
101
1
2
4
1

Page 127 of 260

IIMA/CISG0104TEC

Page 128 of 260

IIMA/CISG0104TEC

30. Weather Statistics.


The highest temperature in degrees Celsius recorded in five cities in April, May, June of a certain
year are given in range A2:D7 of the following spreadsheet. The contents shown in range A9:D11
are self explanatory. Note that in B10, C10, and D10, the first city having highest max
temperature of the corresponding month is shown, if there is a tie. The formula in cell F8 is:
This formula is copied to cells G8 and H8. The formula in cell B10 is copied to C10 and D10; and
the formula in cell B11 is copied to C11 and D11.
A
1
CITY
2
A
3
B
4
C
5
D
6
E
7
8
9 Higest Max Temp
10 A Hottest City
11 No.of Hottest Cities

APRIL
38
35
32
38
33

MAY
41
42
40
43
40

JUNE
40
44
39
44
40

38
A
2

43
D
1

44
B
2

X
Y
Z
TRUE FALSE FALSE

What is the formula in B10? ________________________________________________


What is the formula in B11?________________________________________________

31. A Pass-Fail Problem.


The marks obtained by five students in three subjects, English, Math, and Science are shown in
range A1:D6 of the following spreadsheet. The pass marks for the three subjects are 50, 60, and
60 respectively. The average marks obtained by the students who passed in the entire exam, in
English, in Math, and in Science are obtained respectively in cells A12,B12,C12, and D12. What
are the formulae in cell A12, and B12? Assume that the formula in B12 is copied to C12 and D12.
Do not make any entries except those shown in the spreadsheet.
A
B
C
StCode English
Math
1
S1
50
80
2
S2
40
85
3
S3
70
70
4
S4
60
75
5
S5
55
90
6
7
English
Math
8 Pass Marks:
>=50
>=60
9
Average of pass students
10
All Subs English
Math
11
58.333333
58.75
80
12

D
Science
75
65
90
59
80
Science
>=60
Science
77.5

Formula in A12:____________________________________________________
Formula in B12: ____________________________________________________

Page 129 of 260

IIMA/CISG0104TEC

32. Sugar Beet Production


Data on production of sugar beet during the ten year period from 1945-1954, along with mean
July temperature and mean rain fall during these years is given below (Data source: Problem 5-2,
Page 170 of Johnston, J, Econometric Methods, Second Edition, McGraw-Hill Book Company,
New York, 1972).
Assuming that sugar beet production ( S ) is dependent on mean July temperature ( T ) and mean
rain fall ( R ), estimate a regression between production of sugar beet and the other two variables.
That is, using the Linest function, estimate the values of the constant term C, the coefficient a of
temperature, and the coefficient b of rainfall in the following equation:
S= C+ aT+bR
For each of the years during 1945-1954, , estimate the production of sugar beet using the above
results , and find the difference actual and estimated values. Plot the errors ( error= actual value
estimated value) of the estimated values in the form of a scatter plot. Do the errors seem to be
distributed randomly?
If the errors do not seem to be distributed randomly, re-estimate the regression by changing one or
both the independent variables, that is T, R, or both, to their logs.
Suppose during a certain year, the mean rain fall is expected to be 50 inches, and the mean July
temperature was recorded as 65 degrees F, what would be the expected production of Sugar beet
according to your regression?

Year

Production of
Sugar beet
(1,000 tons)

Mean July
Temperature
( Degrees F)

Mean
Rainfall
(inches)

1945
1946
1947
1948
1949
1950
1951
1952
1953
1954

470
520
560
510
500
550
630
640
650
620

62
62
63
61
64
61
62
63
61
58

33
42
32
38
31
40
44
36
30
43

33. Accessibility Matrix.


In the following matrix A, each of the entries is a zero or one. If a( i , j ) = 1 then it means city j
can be reached from city i in a single hop through air journey, for i = 1,2, , 6 and j = 1,2, , 6.
If a(i,j) = 0, then it means that j cannot be reached from i in a single hop. Using the matrix
multiplication function, find A2, A3, A4,A5, and A6, where A2= A*A, A3= A2*A, and A6 =
A5*A. What is your interpretation of the entries in these matrices?
1
1
2
3
4
5

1
1
1

2
1

3
1

4
1

6
1

1
1
1

Page 130 of 260

IIMA/CISG0104TEC
1

34. A Dieting Problem.


A manager, Mr.X, wanted to analyze his actual intake of various nutrients before undertaking the
GM Diet program, increasingly becoming popular in his company.
One day's sample showed that there were 15 items eaten by him in all the three meals put
together. Call them as A,B,C,,O. The consumption in number of grams of these items (actual
figures are slightly distorted for reasons of confidentiality) respectively is given by the vector:
(100, 200, 150, 75, 200, 50, 25, 100, 75, 175, 120, 200, 200, 50, 50)
The protein, fat, and carbo-hydrate contents (expressed as percentages) of these items are given in
the following table:
A
Protein 0.1
Fat
0.05
Carbo- 9
hydrate

B
3
2
20

C
2
0.5
15

D
1
1
11

E
0.5
1
18

F
4
5
25

G
5
4
20

H
1
0.8
30

I
0.8
2.5
10

J
0.9
1.5
8

K
2.5
2.8
4

L
1.5
0.85
30

M
2.8
0.15
7

N
0.85
3
10

O
0.15
2
18

Using matrix multiplication, compute the daily in-take of proteins, fat and carbo-hydrates in
grams by Mr.X.

35. Armstrong Numbers.


A positive integer expressed in decimal notation (that is, representation using base 10) with n
digits is called an Armstrong number if the number itself is equal to the sum of the n-th powers of
each of its digits. For example, 153 is an Armstrong number, because 153 is equal to the sum of
the cubes of 1, 5, and 3; that is, 13 + 53 + 33 = 1+125 + 27 = 153. Similarly, the fourdigit integer 1634 is an Armstrong number because 1634 = 14 + 64+ 34 + 44. Although there are
several such numbers, they are not infinite in number. Armstrong numbers are also called
narcissistic numbers or Pluperfect digital invariants (PPDI), and are studied in recreational
mathematics.
Through spreadsheet find all the Armstrong numbers between 0 and 9999.

36. Pythagorean Triplets.


Three positive integers a,b,c with the property that the sum of squares of a and b is equal to the
square of c are called Pythagoras Triplets, because a triangle with a,b, and c as the lengths of its
three sides turns out to be a right angled triangle. The number of such triplets is infinite. Some of
the Pythagoras triplets are: (3,4,5); (5,12,13); (6,8,10);and (7,24,25). Several rules exist for
generating these triplets. Two of these rules are: (1) Let a be any odd integer. Then b = a2 1, and
c = b+1; (2). Let a be an even integer. Then b = ((a/2)2 ) 1, and c = b + 2. Using each of the
above rules, generate as many Pythagorean Triplets as you can.

37. Birthday Paradox.


What is the probability that in a group consisting of n people, at least two have the same birth day
(that is, their birthdays coincide in month and day)? In other words, what is the probability that
not all of them have different birth days? Assume that the number of days in an year is 365, and
that the days of birth are uniformly distributed among the population in question, and, further, and
that the group is formed by randomly chosen people.

Page 131 of 260

IIMA/CISG0104TEC

The paradox here lies in the fact that the required probability, P(n), turns out to be larger than
what one would normally guess. The answer is
P(n) = 1 {(365 * 364 * (365-(n-1))/365 n } for n>=2.
Using spreadsheet compute the above probability for a given value of n, say for n = 10,
15,20,25,30,35,40,45, 50.
Alternative formulae. If the above formula is directly applied in numerical computation, you
might not only find that the expression is quite inconvenient to apply, but it would have to handle
large numbers like 365n . It might even lead to numerical inaccuracy. You would find it more
convenient to use the following recursion than the direct formula.
Denoting the answer to the above problem with the number of people equal to n as P(n), a
recursive relation for P(n) is:
P(n) = P(n-1) + ((n-1)/365)*(1-P(n-1)) , n >=3
P(2) = 1/365
Use the above formulae to answer the question posed above.
Some approximations are found to yield easily computable, reasonably accurate, formulae for the
above probabilty. One such approach involves using the approximation ex 1 x. Re-writing
the formula for P(n) as
P(n) = 1 {1. (1 1/365).( 1 2/365).( 1 (n-1)/365)},
and substituting 1 1/365 by e 1/365, 1 2/365 by e1 2/365,, and 1 (n-1)/365 by
e (n-1)/365 , we get
P(n) = 1 e (n) (n-1) / (2x365) . In the above formula e is the base of natural logarithms, and its
numerical value can be taken as 2.71828
Re-compute P(n) using the above approximation.
For each of the above schemes:

Show the results in the form of a data table between n and P(n),

Plot n versus P(n) as a graph

Find the smallest value of n for which P(n) is greater than or equal to 0.5.

38. Scheduling on a Single Facility.


There are fifteen jobs, each of which is to be processed on a single facility one after the other. The
processing time, and the time at which the job is required to be complete (also called its due time)
are given for each job in the range B3:P5 of the accompanying spreadsheet.
All the jobs are available for processing at the facility at time zero. As the facility cannot process
more than one job at a time, the jobs are processed according to a specified sequence, one after
the other, without keeping the facility idle, till the last job in the sequence is over. A job once
started cannot be interrupted.

Page 132 of 260

IIMA/CISG0104TEC

If a job is finished after its due time, it is said to incur tardiness, which is equal to (finish time
due time) in the case of a delayed job. If the job finishes not later than its due time, its tardiness is
zero. There is a penalty for incurring tardiness on a job; this penalty is imposed based on a slab
system: if the tardiness is between 1 and 25 units of time (both 1 and 25 included), there is a flat
penalty of Rs P1; if the tardiness is between 26 and 50 units of time (both 26 and 50 included)
there is a flat penalty of Rs P2; if the tardiness exceeds 50, the penalty is Rs P3. The values
P1,P2, and P3 vary from job to job, and these are given in range S4:AG6. The range S3:AG3
consists of the corresponding job numbers, R4:R6 consists of the lower bounds of the penalty
slabs. For example, the values of P1,P2, and P3 for job 9 are Rs. 3, 6, and 11 respectively. For
example, if job-9 experiences a tardiness of 32, then it would incur a penalty of Rs 6.
Obviously, the tardiness experienced by each job, and the penalty incurred depends on the
sequence in which the jobs are processed. The user decides the sequence and enters it in range
B10:P10. For the sample data shown in the accompanying spreadsheet, the given sequence is job10 first, followed by job-9 next, and so on and the last job is job-11.As per the sequence given in
range B10:P10, and given that the processing of the first job in the sequence has to begin at time
zero, the starting time, finish time, tardiness, and penalty that would be incurred, are computed,
along with some other values needed, in the range B11:P16; and certain other statistics in
C17:C19.
Write down the formulae behind the cells given below:
Cell Address

Formula

Coopied to

B11

C11:P11

C12

D12:P12

B13

C13:P13

B14

C14:P14

B15

C15:P15

B16

C16:P16

C17
(Number of
tardy jobs)
C18
(Average
tardiness)
C19
(Maximum
tardiness)

Page 133 of 260

IIMA/CISG0104TEC

U V

AA AB AC AD AE AF AG

Job Sequencing on a
single facility

Penalty
Table

2
3

JobNo

4
5

TaskTime

10

15

DueTime

20

30

11

12

14

40 120 110 100

90

50

10

11

12

13

14

15

10

12

60

70

80 120

85

75

65

51

10

6
7
8
9

Position No

10

JobNo

11

10

11

12

13

14

15

10

14

13

12

12

11

TaskTime

14

12

10

15

12

12

11

10

12

Start Time

20

32

42

57

62

69

75

80

92 104 115 123

13

Finish Time

92 104 115 123 133

14

Duetime

15

20

32

42

57

62

69

75

80

70

60

50

90

20

30

40 120

75

85 120 120 110 100

Tardiness

22

27

22

23

53

16

Penalty

14

17

No.of Tardy Jobs

18

AvgTardiness

10

19

MaxTardiness

53

80

2 3

10

11

12

13

14

15

2 4

26

12

15

10

11

14

11

13

14

17

11

11

10

1
0
1
10
8
4

Page 134 of 260

IIMA/CISG0104TEC

39. Flight Schedules in Ahmedabad.


The schedules of flights into and out of Ahmedabad during a certain quarter in 2004 are shown in the
accompanying spreadsheet, in the range A5:E52. The contents of the four columns of this range are all
strings. Their explanation is as below:
Column B: CITY. Name of the city from which the flight comes or to which the flight goes .
Column C: FltNo. Flight number
ColumnD: Time. Time is given in 24 hour format, hhmm, preceded by A or D; A means the flight arrives at
Ahmedabad at the given time from the city whose name is given under CITY; D means the flight departs
from Ahmedabad at the given time to the city whose name is given under column CITY.
Column E: Days. On which of the weekdays the flight operates. This is given as a seven character string,
each character being zero or one, zero means the flight does not operate on the corresponding day, and one
means the flight operates on the corresponding day; considering the first character as corresponding to
Sunday, the second for Monday, and so on.
Further, in case a flight bearing the same number arrives into Ahmedabad from one city (X) and departs to
another city (Y), two separate lines are devoted to the flight; in one, the city is given as X, and the time is
preceded by A; in the other, the city is given as Y, and the time is preceded by D; and in both, the flight
number is given as the same.
For clarification of the above field descriptions, consider the flight listed in row-26 of the spreadsheet. The
data for this flight in columns B through E is to be interpreted as follows: The filght number is IC885, and
its time is given as A1825, meaning that the flight arrives into Ahmedabad at 1825 hrs, from Delhi. The
string in column E contains ones in positions 3,5, and 7, and zeroes in other positions, meaning that the
flight operates only on third (Tuesday), fifth (Thursday), and seventh (Saturday) days of each week.
Advanced
You are required to devise a criterion range in, G3:I4, to be used as a part of a Data Filter
Filter, such that when you fill in the desired date of travel in dd/mm/yy format for a flight FROM or TO
AHMEDABAD, TO or FROM another city, in the range G7:I7, all the flights that satisfy the above
requirement are listed in the output range, whose field names row is G10:J10 as shown. The range of the
data list is A5:E52.
For each cell in your criteria range, give its address if necessary, its contents and explain. In addition to the
various cells already filled in the spreadsheet, and the cells that you are going to use for your criteria range,
you can use at most two additional cells for doing intermediate work, if any.
Assume that invalid data is never given in the range G7:I7.

134

Page 135 of 260

IIMA/CISG0104TEC

Your answers
Cell address

Formula or heading

Explanation

G3

G4

H3

H4

I3

I4

Any other
Cell (give its address)

Any other cell


(give its address)

Flight
Schedules
From and To
Ahmedabad

2
3
4
5
6
7
8
9
10

CITY
Mumbai
Mumbai
Mumbai
Mumbai
Mumbai

FltNo
IC613
IC614
IC603
IC609
IC610

Time
A0630
D0710
A1800
D1850
A2015

Days
1111111
1111111
1111111
1111111
1111111

FROM
DELHI

TO
AHMEDABAD

CITY

FltNo

DATE
27/07/04

Time

Days

135

Page 136 of 260


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

Mumbai
Mumbai
Mumbai
Mumbai
Mumbai
Mumbai
Mumbai
Mumbai
Mumbai
Mumbai
Mumbai
Delhi
Delhi
Delhi
Delhi
Delhi
Delhi
Delhi
Delhi
Delhi
Kolkatta
Kolkatta
kolkatta
Kolkatta
Goa
Goa
Jaipur
Jaipur
Bangalore
Bangalore
Chennai
Chennai
Hyderabad
Hyderabad
Hyderabad
Hyderabad
Kuwait
Kuwait
Muscat
Muscat
Sharjah
Sharjah

IIMA/CISG0104TEC
IC604
9W321
9W322
9W324
9W325
9W326
9W480
9W473
9W701
9W705
S26228
IC817
IC818
IC861
IC862
IC885
IC886
S26130
9W702
9W706
IC7267
IC7267
IC7269
IC7269
9W480
9W473
IC7269
CE7267
IC610
IC609
9W325
9W322
IC563
IC564
IC981
IC982
IC982
IC981
IC886
IC885
IC564
IC563

D2055
A0640
D0720
D2030
A1755
D1835
A1050
D1230
A0735
A1910
D0900
A0725
D0810
A1935
D2015
A1825
D0130
D2055
D0815
D1945
A1825
D1855
A1950
D2020
A1050
D12309
A1950
D1855
A2015
D1850
A1755
D0720
A2010
D0500
A1850
D0750
A0705
D1955
A0035
D1905
A0400
D2105

1111111
1111111
1111111
1111111
0111111
1101111
0111111
0111111
1111111
1111111
1111111
1111111
1111111
1111111
1111111
0010101
1001010
1111111
1111111
1111111
0010100
0010100
0100010
0100010
0111111
0111111
0100010
0010100
1111111
1111111
1111111
1111111
0101010
0010101
1000100
0100010
0100010
1000100
1001010
0010101
0010101
0101010

Delhi
Delhi

IC817
IC861

A0725
A1935

1111111
1111111

(Source for the above table: schedule publicly available on the web)
40. Gender Based Income Tax
In a certain country, where the monetary unit is Rupee, a citizen is to pay income tax as per the following
rule:
Subtract standard deduction (SD) from gross income to obtain the net income. If SD is greater than gross
income the net income is taken as zero. The amount of income tax is obtained by multiplying the net
income with the tax rate.

136

Page 137 of 260

IIMA/CISG0104TEC

Both the standard deduction and the tax rate are dependent on the sex of the tax payer. The standard
deduction also depends on the status of the tax payer, all tax payers being divided into the following four
status categories: R, NR, N, and D. The following table gives the standard deduction in Rupees thousands
for each of the four status categories.
Status
R
NR
N
D

Normal
(N)
100
0
0
50

Male (M)
Minority
Senior
(M)
Citizen(S)
150
200
0
0
0
0
70
150

Normal
(N)
120
50
50
60

Female (F)
Minority
Senior
(M)
Citizen (S)
170
200
70
100
70
100
80
120

The percentage tax rate depends not only on the sex of the tax payer but also on the slab to which the net
income belongs, as per the following table:
Net Income
Slab
50,000
>50,000&1,00,000
>1,00,000&5,00,000
> 5,00,000

Normal
(N)
0
5
25
30

Male (M)
Minority
Senior
(M)
Citizen (S)
0
0
0
0
10
5
20
8

Normal
(N)
0
0
10
20

Female (F)
Minority
Senior
(M)
Citizen (S)
0
0
0
0
5
2
10
5

The status, sex and the gross income of a sample of 10 tax payers is given in the following table:
IdCode Status Sex Gross(Rs)
C001
R
MN
100000
C002
R
MS
200000
C003
NR M M
60000
C004
D
FS
75000
C005
D
FN
600000
C006
R
MN
900500
C007
R
F M 1100000
C008
NR
MM
545000
C009
D
MN
456000
C010
D
FN
347000

Using spread sheet, compute the tax in rupees for each of the above 10 tax payers.
Develop suitable coding for different categories of tax payers. Find also for the above sample, who has to
pay the maximum tax, and his or her IdCode.

137

Page 138 of 260

IIMA/CISG0104TEC

41. Customer Service at Pizza Kutir


The proprietor of Pizza Kutir has realized that a certain segment of his customers consists of low budget
customers, who before placing an order, state the maximum amount (budget) they want to spend, and want
to know which Pizza is feasible within that amount. The proprietor was wondering whether he could
answer such questions using a spread sheet. He would like to experiment with the idea by first developing a
spreadsheet, considering only a subset of the options that are offered by his menu card, and using some
assumptions about his customer.
Pizza Kutir offers four different types of Pizza (Veg-I, Veg-II, NV-I, NV-II), each in three different sizes,
regular, medium, or large. On any of the above types, the customer can choose to have extra cheese, the
cost of which depends on the size of the Pizza. Further more, for an extra cost of Rs. 30, any of the above
types can be ordered in what is called its feast-version (the non-feast version is called the normal version).
The prices for the various type-size combinations, and the extra costs for extra cheese and feast-version are
given in the following table. For example, one unit of the NV-II Pizza in medium size, feast-version with
extra cheese, costs Rs 240+45+30 = Rs.315. Similarly, one unit of large size, Veg-I with extra cheese,
normal (non-feast) version costs Rs. 260 + 65 + 0 = Rs. 325.
1. Veg - I
2. Veg - II
3. NV - I
4. NV - II
Extra Cheese

1 Regular
75
130
95
140
35

2 Medium
150
230
200
240
45

3 Large
260
310
310
340
65

Each of the above types is available in its feast version for Rs. 30 extra.

A number of other options such as toppings are usually offered, but can be ignored for the task at hand. To
further simplify the analysis, the proprietor assumes that the low budget customers want the proprietor to
suggest them only alternatives each of which consists of one unit of a Pizza; and that the budget of a
customer never exceeds the price of the costliest combination. In case the budget permits several
alternatives, the proprietor wants to rank the alternatives in descending order of price, and indicate to the
customer only those with rank not greater than 3.
For example, when a customers budget is Rs.110, then the following four combinations are feasible:
Alternative
number
1
2
3
4

Combination
Veg-I, Regular, feast, no extra cheese
Veg-I, Regular, non-feast, extra cheese
Veg-I, Regular, non-feast, no extra cheese
NV-I, Regular, non-feast, no extra cheese

Price(Rs)
105
110
75
95

The proprietor, however, suggests to the customer only three alternatives, that is alternative-1, alternative-2,
and alternative-4.
Given below is a design of a spread sheet which has as input the codes of all the 48 combinations possible
(four based on type, three based on size, two based on extra cheese wanted or not, two based on feastversion wanted or not). For each combination the total price of one unit is calculated and listed. When a
customer calls, the proprietor enters in a cell the maximum amount that the customer is willing to pay, and
138

Page 139 of 260

IIMA/CISG0104TEC

when he performs certain operations, the system outputs in a range, the feasible combinations that he could
suggest to the customer, as per the rules described above.
In the spread sheet (see next page) the following are the values in their respective ranges:
Range

Contents
The codes of the 48 combinations. This is given as input. Each code consists of
four characters. Left most character (First Character) indicates the type (1, 2, 3 or
D41:D88 4) : second character indicates the size (1, 2, 3) ; third character indicates whether
the version is feast or normal (1 or 0) the last character indicates whether extra
cheese needed (1) or not (0)
E41:E88 P1: First component of the price of each combination, due to type and size.
P2: The second component of the price of each combination, due to price of extra
F41:F88
cheese if applicable.
P3: The third component of the price of each combination, due to extra price of
G41:G88
feast version, if applicable.
P: Total price of one unit of the corresponding combination, if feasible; otherwise H41:H88
999999.
I41:I88 Is the combination feasible (True or False) for the given budget in cell I38
J41:J88 Rank of the corresponding cells in column H, in the descending order of P.
In addition to the ranges described above, the following entries are input in the range H27:K32
HHI
I
JJ
KK
1
2
3
27
1
75 150 260
28
2
130 230 310
29
3
95 200 310
30
4
140 240 340
31
5
35
45
65
32
Into cell I39 is entered the extra cost of a feast version, which is 30 currently.

139

Page 140 of 260

IIMA/CISG0104TEC

D
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

Combination code
1111
1110
1101
1100
1211
1210
1201
1200
1311
1310
1301
1300
2111
2110
2101
2100
2211
2210
2201
2200
2311
2310
2301
2300
3111
3110
3101
3100
3211
3210
3201
3200
3311
3310
3301
3300
4111
4110
4101
4100
4211
4210
4201
4200
4311
4310
4301
4300

P1

P2

P3

Budget:
Feast:
P

30
Feasible?

Rank

140

Page 141 of 260

IIMA/CISG0104TEC

Answer the following questions related to the above spread sheet (you are not allowed to use cells or
ranges other than those mentioned)
Questions:
41.1 In each of the following ranges, a formula is given in the first cell, and it is copied to the other cells of
the range. Write the formula in the first cell.
Range

Formula in the first cell of the range

E41:E88

F41:F88

G41:G88

H41:H88

I41:I88

J41:J88

41.2. The desired output (the code of each combination which is within the budget, and satisfies the other
rules described above) is to be written in the range the first cell of which is L40, which consists of the string
FEASIBLE COMBINATIONS. Design a criteria range with a maximum of two columns and two rows,
including the headings row, in the cells L37:M38, such that when used along with an appropriate data list in
advanced data filter, it will produce the output in the range mentioned above.
a. Draw a grid of cells below indicating your criteria range and fill them with their headings, and formulae
or other contents. On the top of the grid write the column labels and on the left, write the respective row
numbers.
Your answer:

141

Page 142 of 260

IIMA/CISG0104TEC

b. What is the address of your data list range for the above filter?
Your answer:

142

Page 143 of 260

IIMA/CISG0104TEC

42. Fibonacci Series.


]
The following VBA function to compute the Nth Fibonacci number has self explanatory comments. Fill in
the blanks.
Function FIB(N As Integer) As Integer
' To find Nth number of the series
' 0,1,1,2,3,5,8,...
' For example: FIB(1) is 0
' FIB(2) is 1
' FIB(3) is 1
' FIB (4) Is 2
' The rule is: Each number is the sum of the previous two numbers,
' and the first two numbers are given.

Dim F As Integer, FP As Integer, j As Integer


F=1
FP = 0
If N = 1 Then
FIB = ____________
Else
If N = 2 Then
FIB = ___________
Else
For __________________________
F = ______________
FP = ______________
Next j
____________________
End If
End If
End Function

143

Page 144 of 260

IIMA/CISG0104TEC

43. Matrix Search


The following array function has self-explanatory comments. Fill in the blanks.
Function Msearch(X As Integer, M As Range)
' This is an array function that returns the row number
' and column number of X in Matrix M
Dim result(1 To 1, 1 To 2) As Integer
Dim I As Integer, J As Integer, NR As Integer, NC As Integer
result(1, 1) = 0
result(1, 2) = 0
NR = ________________
NC = ________________
For I = ________
For J = ________
If ___________________________= X Then
_______________
_______________
Exit For
End If
Next J
If _________ > 0 Then
Exit For
End If
Next I
_______________
End Function

44. The Graph Colouring Problem:


A graph G consists of several nodes, some of which are designated to be adjacent to each other. A graph is
usually represented as a network diagram, with each node of the graph being represented by a circle on the
network, and with each adjacent pair of nodes being joined by a line, called an arc. Thus, if there are n nodes
in the graph, then there are n circles on the network, and if nodes i and j of the graph are adjacent, then
circles i and j on the network are joined by a line. In computations related to an n-node graph, the graph is
also represented by an adjacency matrix, which is an n x n square matrix, having a 1 in cells (i,j) and (j,i)
if nodes i and j are adjacent to each other, and zero in those cells otherwise.
Given a graph, the graph colouring problem requires you to assign a colour to each node, without using too
many colours, such that no two adjacent nodes are assigned the same colour. While in general it is quite
difficult to devise a procedure that would find and assign the minimum number of colours to a graph,
144

Page 145 of 260

IIMA/CISG0104TEC

especially if the graph is quite large, several sub-optimal procedures can be devised. One such procedure,
called a greedy heuristic is described below:
Step-1. Start with colour-1 as your current colour. None of the nodes is assigned any colour.
Step-2. (Node scan.) Consider the nodes in their index order, that is in the order node-1, node-2,, node-n.
When a node is considered, assign the current colour to it if it has not yet been assigned a colour,
and if none of its adjacent nodes is assigned the current colour.
Step-3. If at the end of step-2, there are still some nodes without being assigned a colour, increase the index
of the current colour by one, and go to step-2 (ie go through a node scan). Else, Stop.
Illustration:
On the next page is shown a ten node graph, on each of which are shown the node index and the colour
assigned to it by the above greedy heuristic. You can see that nodes 1,3,5,7 and 8 are assigned colour-1,
nodes 2,4,6, and 9 are assigned colour-2, and node-10 is assigned colour-3. You can easily verify that no
two adjacent nodes are assigned the same colour. For example, nodes 2 and 7 are adjacent and their colours
are 2 and 1 respectively; similarly, nodes 9 and 10 are adjacent and their colours are 2 and 3 respectively.
The adjacency matrix for the graph is also shown below the graph for clarification.
Question.
Suppose an n-node graph is represented by its adjacency matrix and the adjacency matrix is entered in the
cells of a range of an excel sheet. The range has n rows and n columns and is named grph. Initially, the
entries in this range correspond to the entries in the adjacent matrix. A sub called graphcolour, written in
VBA, when invoked through a command button, applies the greedy heuristic to the graph represented by
grph and fills in the diagonal cells of the above range with the colours assigned by the heuristic to the
corresponding nodes; that is, the entry in the jth row and jth column of the range, as a result of the execution
of the above sub, would be the index of the colour assigned to node-j. In the listing of the sub given at the
end of this question, fill in the blanks. Do not use any ranges, cells, or variables of your own other than those
already mentioned in the listing.

145

Page 146 of 260

IIMA/CISG0104TEC

Node-2
Colour-2

Node-3
Colour-1

Node-1
Colour-1

Node-7
Colour-1

Node-6
Colour-2

Node-4
Colour-2

Node-9
Colour-2

Node-10
Colour-3

Node-8
Colour-1

Node-5
Colour-1

A 10-node graph with node-index and colour-index shown for each node
Node
No.

1
2
3
4
5
6
7
8
9
10

1
1

10

1
1

1
1
1

1
1

1
1
1
1

1
1

1
1
1
1

1
1

Adjacency matrix for the above graph

146

Page 147 of 260

IIMA/CISG0104TEC

Sub graphcolour()
'The range named "grph" has equal number of
'rows and columns and contains initially 1's and zeroes
'corresponding to the entries in the corresponding cells of the
'adjacency matrix of the graph to be coloured
' n is the number of nodes
'(i,j)cell of grph is 1 if j is adjacent to i, i = 1,2,.,n; j = 1,2,,n
'(j,j)cell of grph is zero initially, j=1,2,..., n
'(j,j)cell contains the index of the colour assigned to node-j, j=1,2,,n

' nc is the index of the current colour


' nu is the number of uncoloured nodes
Dim nc As Integer, nu As Integer, n As Integer
Dim i As Integer, j As Integer, OK As Boolean
Set g = Range("grph")
' initially...
' index of current colour is 1
' No. of uncoloured nodes is n
nc = 1
n = __________________________________
nu = n
' Iterate as long as there are some uncloured node(s)
Do While _____________________________________
For i = 1 To n
If g.Cells(i, i).Value = 0 Then
OK = True
For j = 1 To n
If j <> i And ___________________________ Then
If ___________________________________Then
OK = False
End If
End If
Next j
If OK Then
_____________________________________
_____________________________________
End If
End If
Next i
___________________________________________
Loop
End Sub
147

Page 148 of 260

IIMA/CISG0104TEC

45. Euler Graph


VBA to tell whether a multi-graph is an Euler Graph: A multi-graph G consists of a finite number of
nodes, and one or more lines, called un-directed arcs, connecting some pairs of the nodes. Each arc has two
end-nodes and an arc is said to be incident on each of its end nodes. The degree of a node is the number of
arcs incident on it. In the accompanying figure is shown a 4-node multi-graph. It can be seen that in this
graph, node-1 is connected to node-2 and node-4. As there are two arcs directly between node-1 and node-2,
and there is one arc directly between 1 and 4, the total number of arcs incident on node-1 is three, and hence
the degree of node-1 is three.
If a multi-graph is such that starting from any node, you can visit each other node and return to the starting
node, by traversing on each of the arcs once and only once, then the graph is called an Euler Graph. A
graph is Euler graph only if the degree of each of its nodes is even.
Degree=3

3
1

Degree=5

3
2

Degree=3

3
Degree=3

Figure: A 4-node multi-graph. The number within a node is its node-index.

Nodeindex
1
2
3
4

0
2
0
1

2
0
2
1

0
2
0
1

1
1
1
0

Matrix showing number of arcs between each pair of nodes for the multi-graph of the above figure.

148

Page 149 of 260

IIMA/CISG0104TEC

For computations, an n-node multi-graph is represented by an nxn matrix A called its adjacency matrix,
whose elements A(i, j) denote the number of arcs directly connecting i and j, for i = 1 to n and j = 1 to n; A(
i,j) = A(j,i).
Suppose the adjacency matrix of a multi-graph G with n-nodes is given in range named EULER in an Excel
spreadsheet. The listing of a VBA function named IsEuler with some blanks is given below. This function
returns the value TRUE or FALSE depending on whether the graph represented by the adjacency matrix in
EULER is an Euler Graph. Fill in the blanks without using any extra variables or ranges already referred to
in the listing.
Function IsEuler(E As Range) As Boolean
' E is a range consisting of number of arcs
' between various nodes of a multi-graph
' Range("E").Cells(i,j).value denotes the number of arcs between nodes
' i and j in the graph represented by E
' The function returns TRUE if the graph is an Euler graph; otherwise False
Dim n As Integer, i As Integer, j As Integer
Dim Sum As Integer
n = __________________________
' Compute the degree of each node
' If the degree is odd then the graph is not an Euler Graph
____________________ = True
For j = 1 To n
Sum = ______________
For i = _____________ To n
Sum = ______________________________________
Next i
' Is Sum Odd?
If ______________________________Then
___________________ = False
Exit For
End If

Next j
End Function

149

Page 150 of 260

IIMA/CISG0104TEC

46. Number of minima.


Given below is the VBA Function minnmin, for which the argument is a range consisting of integers; the
function returns an array of two values: the first consists of the value of the minimum of the integers in the
given range; and the second consists of how many values in the given range are equal to the above
minimum. Fill in the blanks ( ____ ) in the function code. Do not introduce any variables other than those
given as the argument of the function or declared through the DIM statements. Assume that each line
consists of one complete VBA statement.
Function minnmin(given As Range)
' minnmin is an array function to output two values
' Given consists of integers
' The two values returned are: value of minimum in Given, and the
' number of minima
Dim r As Integer, c As Integer, i As Integer, j As Integer
Dim result(1 To 2)
r = given.Rows.Count
c = given.Columns.Count

________________ = given.Cells(1, 1).Value


For i = 1 To r
For j = 1 To c
If given.Cells(i, j).Value < result(1) Then
result(1) = ____________________________________
End If
Next j
Next i
__________________________________________
For i = 1 To r
For j = 1 To c
If given.Cells(i, j).Value = __________________ Then
________________ = result(2) + 1
End If
Next j
Next i
minnmin = result
End Function

150

Page 151 of 260

IIMA/CISG0104TEC

47. Conversion of Primal LP to Dual LP


Given a linear program -- call it the primal,
formulated using the following table.

a corresponding linear program, called the dual, can be

Relationship between Constraints and Variables of Primal and Dual Problems


Primal
Objective Type:
Constraints

Variables
Objective Type:
Constraints
Variables

Max
(LE)
(GE)
= (EQ)
0 (GE)
0 (LE)
Unrestricted in sign (UR)
Min
(LE)
(GE)
= (EQ)
0 (GE)
0 (LE)
Unrestricted in sign (UR)

Dual
Objective type:
Variables

Constraints
Objective Type:
Variables

Constraints

Min
0 (GE)
0 (LE)
Unrestricted in sign (UR)

(GE)

(LE)
=
(EQ)
Max

(LE)

(GE)
Unrestricted in sign (UR)

(LE)

(GE)
=
(EQ)

In particular, note the following relationships:


1. The number of constraints and number of variables of the primal will be equal to the number of variables
and number of constraints respectively of the dual.
2. There is a one to one correspondence between the variables of the primal and the constraints of the dual,
and between the constraints of the primal and variables of the dual.
3. The right hand side value of a constraint of the primal is equal to the cost coefficient in the objective
function of the corresponding dual variable; and vice versa.
4. If the primal is of minimization type then the dual is of maximization type and vice versa.
5. The coefficient matrix of the constraints of the primal is the transpose of the coefficient matrix of
constraints of the dual
6. The restriction on the sign of a dual variable is related to the type of the corresponding primal constraint,
and the type of a dual constraint is related to the restriction on the sign of its corresponding primal variable
as shown in the above table.

151

Page 152 of 260

IIMA/CISG0104TEC

Suppose a spreadsheet consists of the input defining the primal problem in a few ranges as given below:
S.No.
1
2
3

Range Name
NCONSTR
NVAR
PRIMAL

Description
Number of constraints (m)
Number of variables (n)
Starting cell for the primal matrix.
If you count the (row,column) of this cell as (1,1) then:
Rows 1,2,3,m starting with the above cell contain coefficients of respective constraints
Row m+1 contains the coefficients of objective function
Row m+2 the type of each variable
Columns 1,2,, n correspond to the respective primal variables
Column (n+1) corresponds to the right hand side values (b)
Column (n+2) contains the type of each constraint.

You need to write a SUB in VBA that formulates the dual of the above primal and writes it in the same way
as the input for the Primal. The output is to be written beginning with the cell named as DUAL.
In formulating the dual, you can use the conversion rules coded in the form of the following four ranges:
RangeName

Contents

Explanation

MaxCtoV

GE
LE
EQ

LE
GE
UR

Correspondence between types of primal constraints and dual variables,


when primal objective is Max

MaxVtoC

GE
LE
UR

GE
LE
EQ

Correspondence between types of primal variables and dual constraints,


when primal objective is Max

MinCtoV

GE
LE
EQ

GE
LE
UR

Correspondence between types of primal constraints and dual variables,


when primal objective is Min

MinVtoC

GE
LE
UR

LE
GE
EQ

Correspondence between types of primal variables and dual constraints,


when primal objective is Min

152

Page 153 of 260

IIMA/CISG0104TEC

To clarify the above problem description, we have shown below a part of a spreadsheet that consists of
1.

the input for a 3-constraint, 4-variable primal (Range B6:G10), and

2.

the dual (Range B14:F19) of the above primal, given as output by a SUB that is written to perform the
task described above.
A
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

-2
2
0
-2
LE

1
0
2
3
GE

3
1
1
5
GE

1
0
1
0
UR

5
4
6

GE
LE
EQ
Max

-2
1
3
1
5
LE

2
0
1
0
4
GE

0
2
1
1
6
UR

-2
3
5
0

LE
GE
GE
EQ
Min

Important range names (not all of which are shown) in the above sheet:
RangeName
Primal
Dual
Nconstr
Nvar
MaxCtoV
MaxVtoC
MinCtoV
MinVtoC

Range address
B6:B6
B14:B14
B3:B3
C3:C3
J6:K8
M6:N8
P6:Q8
S6:T8

153

Page 154 of 260

IIMA/CISG0104TEC

48. Assembly Line Planning.


In setting up an assembly line, you need to arrange several work stations in sequence, and assign a few tasks
to each work station. After the first workstation performs its tasks, the job moves on to the second work
station ; after the second performs its tasks, then the job moves on to the third work station, and so on.
Therefore, in planning such a line, a standard practice is to divide the whole assembly operation into several
tasks, and to list the dependency relations between the tasks; that is, to enumerate which tasks are to be
complete before a task is undertaken. Such dependencies are called precedence relations. The precedence
relations between the tasks are represented pictorially in a diagram called the precedence diagram (See the
following figure below for an illustration). A precedence diagram consists of nodes and arcs, one node per
each task. Arcs are drawn connecting the nodes such that if an arc connects node-J and node-I, starting at
node-J and ending at node-I, it implies that task-I on a job cannot start until task-J is over. In such a case,
task-J is said to be an immediate predecessor of task-I , and task-I an immediate successor of task-J. For
example, in the following figure, task-4 and task-5 are the immediate predecessors of task-6, and task-6 is
the immediate successor of task-4 and task-5.

Figure: A precedence diagram for an assembly job with six tasks


Task
Number
1
2
3
4
5
6

Number of
immediate
predecessors
0
1
1
1
1
2

Number of
immediate
successors
2
1
1
1
1
0

List of immediate
predessors

1
1
2
3
4,5

Table: Information on immediate successors and predecessors of each task, derived from the above figure.

In a computer program dealing with assembly line planning, the precedence information is represented in
the form of an (n by n) zero-one matrix where n is the number of tasks. If the element in row-I and columnJ of this matrix is 1, then it implies that task-J is an immediate predecessor of task-I; and if the element is
zero, it implies that task-J is not an immediate predecessor of task-I. Such a matrix is called a precedence
matrix. The precedence matrix corresponding to the precedence diagram of the figure mentioned above is
given below:
0
1
1
0
0
0

0
0
0
1
0
0

0
0
0
0
1
0

0
0
0
0
0
1

0
0
0
0
0
1

0
0
0
0
0
0
154

Page 155 of 260

IIMA/CISG0104TEC

Suppose the precedence matrix of an assembly job is given on a spreadsheet in a range starting from the cell
named as PREDMAT.The number of tasks is given in the cell named NTASKS. Assuming that the number
of tasks does not exceed 50, develop the following VBA functions are developed:
Function
Ispred(I,J)
Npred(I)
Nsuc(I)
Predlist(I)

Explanation
The function returns TRUE or FALSE depending on whether task-J is
an immediate predecessor of task-I
Number of immediate predecessors for task-I
Number of immediate successors for task-I
An array function, that returns the list of immediate predecessors of I

49. Attendance Records.


The time spent by each employee in an office is kept track of by recording, through an attendance recording
machine, the date and time when she/he enters (E) or leaves (L) office each time. The entry and departure
times of a sample of five employees over a period of two days as recorded by the machine are shown in the
following table. The data is sorted by employee and by date and time. Enter the data into a spreadsheet and
compute the following:
1. The total time spent by each employee inside the office on each of the days
2. An employee is expected to spend eight hours everyday in the office. Indicate for each employee on each
day whether the time spent is normal, more or less than the normal by appropriate symbols.

EmpCode
E001
E001
E001
E001
E001
E001
E001
E001
E001
E001
E002
E002
E002
E002
E002
E002
E003
E003
E003
E003
E003
E003
E004
E004
E004
E004
E005
E005
E005
E005

DateTime(dd/mm/yyyy
hh:mm:ss AM/PM)
01/01/2005 09:30:00 AM
01/01/2005 01:30:00 PM
01/01/2005 02:30:00 PM
01/01/2005 06:30:00 PM
02/01/2005 08:30:00 AM
02/01/2005 01:15:00 PM
02/01/2005 01:45:00 PM
02/01/2005 03:20:00 PM
02/01/2005 03:30:00 PM
02/01/2005 07:00:00 PM
01/01/2005 07:30:00 AM
01/01/2005 04:45:00 PM
02/01/2005 08:00:00 AM
02/01/2005 12:45:00 PM
02/01/2005 01:35:00 PM
02/01/2005 05:38:00 PM
01/01/2005 07:50:00 AM
01/01/2005 01:10:00 PM
01/01/2005 01:55:00 PM
01/01/2005 05:45:00 PM
02/01/2005 07:30:00 AM
02/01/2005 05:00:00 PM
01/01/2005 10:05:00 AM
01/01/2005 04:30:00 PM
02/01/2005 09:00:00 AM
02/01/2005 05:00:00 PM
01/01/2005 08:00:00 AM
01/01/2005 05:00:00 PM
02/01/2005 09:00:00 AM
02/01/2005 03:30:00 PM

Enter (E) or
Leave (L)
E
L
E
L
E
L
E
L
E
L
E
L
E
L
E
L
E
L
E
L
E
L
E
L
E
L
E
L
E
L

155

Page 156 of 260

IIMA/CISG0104TEC

50. Conference Budget.


Mr. Eradico, a manager of an NGO, proposes to conduct a two-day workshop on eradication of illiteracy. He
has negotiated with a local educational institution for a conference hall in which the sessions of the
conference could be held, and for hostel rooms in which the delegates could be accommodated. The
educational institute agreed to provide a conference hall for two days, and accommodation for one night for
a maximum of fifty people. A caterer was to to supply breakfast, lunch, on both days, conference dinner in
the evening on the first day, special tea following the inaugural function, normal tea once in the afternoon on
both days, and normal tea once in the morning on the second day. The information relevant for working out
the conference budget is given below:
1. The number of delegates will be between twenty and forty. Delegates are required to register in advance,
along with submission of registration fee.
2. The number of people in the organizing team will be ten, including all volunteers.
3. There will be four invited speakers from different parts of the country.

4. The costs of different items are:


Inaugural tea and snacks: Rs 100 per person. The inauguration is expected to be attended by the delegates,
the organizing team, invited speakers, and about twenty other invitees.
Lunch: Rs 200 per plate. Lunch is given to all delegates, speakers, and organizers, on both the days.
Normal tea: Rs 50 per person. This is given in the afternoon on the first day, and in the morning and
afternoon on the second day. For this item, speakers, delegates, and organizers are included.
Breakfast: Rs 100 per person. Breakfast is given to delegates, speakers, and organizers on both the days.
Conference dinner: Rs 250 per person. This happens in the evening on the first day. In addition to the
delegates, speakers, organizers, fifteen guests would attend the conference dinner. Dinner is not needed on
the second day.
Rental charge for the conference hall along with audio visual equipment: Rs 10,000 per day.
Accommodation charges are Rs 1500 per person per night; it is estimated that all delegates and speakers will
arrive in the morning on the inaugural day, and leave by 7.00 PM on the second day. Hence the delegates
and speakers need to be provided accommodation for only one night.
Conference kit: Rs 500 per kit. The kit includes a bag, conference material, and some stationery. The kit is
to be provided to the delegates, speakers, and organizers.
Pickup and drop. Airport/railway station pickup and drop are to be provided to each delegate and speaker.
The estimated charge for pickup is Rs 200 per person, and for drop also Rs 200 per person.
Return airfare: Each speaker is to be reimbursed return airfare, which is estimated to be Rs 10,000 per each
speaker.
Honorarium: Each speaker is to be given an honorarium of Rs 4,000.
156

Page 157 of 260

IIMA/CISG0104TEC

For administrative expenses like telephone, courier and clerical work, a sum of Rs 40,000 is to be set apart.
Questions:

If the entire expenditure of the conference is to be met by the registration fee alone, then what should be
the registration fee per participant?

If a maximum amount of Rs two lakh could be raised through sponsorships, what should be the
registration fee per participant?

To answer the above questions, experiment with various possible values of parameters like number of
delegates and sponsorship amount.

Can you conclude from your experiments that, in general, the more the participants, the less the
registration fee per participant, for break-even?

51. Top 100 of Forbes 2000.


Given below is the list of top 100 companies of the Forbes 2000 list, March 2004 ( Source for the data is the
website: http://www.forbes.com/2004/03/24/04f2000land.html), arranged in ascending order of rank. The ranks
are obtained by developing a composite index using the following attributes of each company: 1. sales, 2.
profits, 3. assets, and 4. market value.
A.

Enter the list into a spreadsheet. Reorganize the list by sorting it on each of the dimensions mentioned
above; additionally, sort it by country and category.

B.

Develop a table showing for each country and category combination, the number of companies in the
list that come under the combination.

C.

Using a suitable set of features to list all companies whose sales were more than $80 billion and market
value greater than or equal to $200 billion.

D.

How many companies in the list are close to the maximum value in each attribute; that is, find the
number of companies whose sales is close to the highest sales in the list; find the number of companies
whose profit is close to the highest profit in the list, and so on. A company is considered close to
another company on a given dimension, if its value in that dimension is greater than a certain given
percentage (for example 95%) of the highest value in that dimension. Provide the percentage for
defining the closeness as a parameter.

E.

Consider the idea of closeness to the top company as discussed in D above. Some companies are close
to the topmost company on one dimension, some on two dimensions, some on three, and some on all
four. Thus, depending on how many dimensions a company is close to the corresponding top most
company, you can classify companies into four classes. Count and display the companies belonging to
each class.

F.

Prepare a table of total sales category-wise, and find the category with maximum sales.

G.

Show all companies with profits greater than or equal to 20% of sales, or profits greater than or equal to
10% of assets.

157

Page 158 of 260

Forbes
2000
Rank

1
2
3

Name

IIMA/CISG0104TEC

Country

4
5

Citigroup
General Electric
American Intl
Group
ExxonMobil
BP

6
7

Bank of America
HSBC Group

8
9

Toyota Motor
Fannie Mae

United States
United
Kingdom
United States
United
Kingdom
Japan
United States

10
11

Wal-Mart Stores
UBS

United States
Switzerland

12

ING Group

Netherlands

13

Royal Dutch/Shell
Group

14
15
16

Berkshire Hathaway
JP Morgan Chase
IBM

Netherlands/
United
Kingdom
United States
United States
United States

17
18
19
20

Total
BNP Paribas
Royal Bank of
Scotland
Freddie Mac

France
France
United
Kingdom
United States

21
22

DaimlerChrysler
Altria Group

Germany
United States

23
24

ChevronTexaco
Pfizer

United States
United States

25
26

Wells Fargo
Verizon Commun

United States
United States

27

Barclays

28

Morgan Stanley

United
Kingdom
United States

29
30

General Motors
Nippon Tel & Tel

United States
Japan

31
32

Microsoft
Nestl

United States
Switzerland

Category

Sales
($bil)

Profits
($bil)

Assets
($bil)

Market
Value
($bil)

United States
United States
United States

Banking
Conglomerates
Insurance

94.71
134.19
76.66

17.85
15.59
6.46

1,264.03
626.93
647.66

255.30
328.54
194.87

Oil & gas operations


Oil & gas operations

222.88
232.57

20.96
10.27

166.99
177.57

277.02
173.54

49.01
44.33

10.81
6.66

736.45
757.60

117.55
177.96

135.82
53.13

7.99
6.48

171.71
1,019.17

115.40
76.84

256.33
48.95

9.05
5.15

104.91
853.23

243.74
85.07

94.72

4.73

752.49

54.59

133.50

8.40

100.72

163.45

56.22
44.39
89.13

6.95
4.47
7.58

172.24
792.70
104.46

141.14
81.94
171.54

131.64
47.74
35.65

8.84
4.73
4.95

87.84
745.09
663.45

116.64
59.29
90.21

46.26

10.09

752.25

44.25

157.13
60.70

5.12
9.20

195.58
96.18

47.43
111.02

112.94
40.36

7.43
6.20

82.36
120.06

92.49
285.27

31.80
67.75

6.20
2.57

387.80
165.97

97.53
103.97

33.69

4.90

791.54

61.33

33.00

3.64

580.63

64.81

185.52
92.41

3.82
2.17

450.00
150.87

27.47
73.00

34.27
64.56

8.88
5.48

85.94
62.15

287.02
106.55

Banking
Banking
Consumer durables
Diversified
financials
Retailing
Diversified
financials
Diversified
financials
Oil & gas operations

Insurance
Banking
Technology
hardware &
equipment
Oil & gas operations
Banking
Banking
Diversified
financials
Consumer durables
Food, drink &
tobacco
Oil & gas operations
Drugs &
biotechnology
Banking
Telecommunications
services
Banking
Diversified
financials
Consumer durables
Telecommunications
services
Software & services
Food, drink &
tobacco

158

Page 159 of 260


Forbes
2000
Rank

33
34
35
36
37
38
39

Name

SBC
Communications
Deutsche Bank
Group
Siemens Group
HBOS

IIMA/CISG0104TEC

Country

United States
Germany
Germany
United
Kingdom
Italy
United States
Spain

40

ENI
ConocoPhillips
Banco Santander
Central
Merrill Lynch

41
42
43

Wachovia
Time Warner
Hewlett-Packard

United States
United States
United States

44

Procter & Gamble

United States

45

South Korea

46

Samsung
Electronics
Johnson & Johnson

47

Lloyds TSB Group

48

ABN-Amro
Holding
Honda Motor
American Express

49
50
51
52
53
54

United States

United States
United
Kingdom
Netherlands
Japan
United States
Japan
United States
France
France

58
59
60
61
62
63

Nissan Motor
Bank One
AXA Group
Socit Gnrale
Group
PetroChina
Goldman Sachs
Group
BBVA-Banco
Bilbao Vizcaya
Intel
MetLife
Home Depot
Viacom
Allstate
Merck & Co

64

Novartis Group

Switzerland

65

ENEL

Italy

55
56
57

China
United States
Spain
United States
United States
United States
United States
United States
United States

Category

Sales
($bil)

Profits
($bil)

Assets
($bil)

Market
Value
($bil)

Telecommunications
services
Diversified
financials
Conglomerates
Banking

39.16

5.97

100.17

82.93

58.85

1.53

792.49

50.23

86.62
32.68

2.81
3.09

85.47
571.76

75.77
52.87

Oil & gas operations


Oil & gas operations
Banking

53.29
90.49
28.70

4.82
4.83
3.28

67.91
81.95
442.24

76.13
46.72
56.78

Diversified
financials
Banking
Media
Technology
hardware &
equipment
Household &
personal products
Semiconductors

26.64

3.47

485.77

57.52

24.47
38.08
73.06

4.25
2.65
2.54

400.87
121.78
74.71

62.35
77.95
70.20

46.99

5.81

53.86

131.89

50.22

5.95

54.58

72.72

Drugs &
biotechnology
Banking

40.01

6.74

46.66

160.96

24.48

2.87

406.99

48.11

Banking

23.64

3.98

704.95

39.29

Consumer durables
Diversified
financials
Consumer durables
Banking
Insurance
Banking

67.44
24.17

3.61
3.00

63.09
175.00

40.61
68.89

57.77
21.04
90.10
35.52

4.19
3.40
1.00
1.61

60.56
290.01
456.13
526.54

41.71
58.38
41.39
40.61

Oil & gas operations


Diversified
financials
Banking

29.53
22.84

5.67
2.54

58.36
394.14

90.49
50.12

24.10

2.81

288.80

44.67

Semiconductors
Insurance
Retailing
Media
Insurance
Drugs &
biotechnology
Drugs &
biotechnology
Utilities

30.14
35.79
62.90
25.85
32.15
30.78

5.64
2.24
4.04
2.47
2.73
7.33

47.14
326.84
35.37
90.94
134.14
42.59

196.87
26.34
82.29
68.66
32.90
108.76

26.77

5.40

46.92

116.43

38.99

2.11

71.36

46.84

159

Page 160 of 260


Forbes
2000
Rank

Name

66

Unilever

67
68
69
70
71
72

Washington Mutual
Crdit Agricole
Deutsche Post
Comcast
Volkswagen Group
Tokyo Electric
Power
Munich Re
BMW-Bayerische
Motor
Ford Motor
Tyco International
US Bancorp
Roche Group

73
74
75
76
77
78
79
80
81

Royal Bank of
Canada
GlaxoSmithKline

IIMA/CISG0104TEC

Country

Category

Sales
($bil)

Profits
($bil)

Assets
($bil)

Market
Value
($bil)

Netherlands/
United
Kingdom
United States
France
Germany
United States
Germany
Japan

Food, drink &


tobacco

50.70

2.24

45.49

72.19

Banking
Banking
Transportation
Media
Consumer durables
Utilities

18.01
31.77
41.23
18.35
91.33
41.62

3.88
1.12
1.64
3.24
2.71
1.40

275.18
531.01
169.33
109.16
112.87
116.68

39.69
38.80
26.83
67.30
17.42
30.63

Germany
Germany

Insurance
Consumer durables

45.85
52.23

1.14
2.12

191.33
58.11

26.63
29.03

United States
Bermuda
United States
Switzerland

164.20
37.57
14.57
25.18

0.76
1.19
3.73
2.48

312.56
62.80
189.29
45.77

26.29
58.41
52.88
95.38

Canada

Consumer durables
Conglomerates
Banking
Drugs &
biotechnology
Banking

18.82

2.28

305.01

31.82

United
Kingdom
China

Drugs &
biotechnology
Oil & gas operations

34.16

6.34

29.19

124.79

39.16

1.94

45.32

50.09

Japan
Finland

63.23
37.05

0.98
4.52

68.04
29.15

38.00
104.30

22.58

3.59

49.62

54.08

28.44
15.34
19.21
96.94
19.82

1.92
2.69
3.81
1.45
4.35

51.52
269.94
77.15
40.11
36.59

55.06
36.51
36.28
37.19
166.09

14.22
45.68
16.53
29.58

2.13
1.10
1.89
4.24

196.40
97.35
223.60
44.42

47.19
23.76
33.53
28.73

32.81

3.54

28.37

79.62

82
83

China Petroleum &


Chemical
Sony
Nokia

84

BellSouth

United States

85
86
87
88
89

Walt Disney
Natl Australia Bank
Gazprom
Carrefour Group
Cisco Systems

United States
Australia
Russia
France
United States

90
91
92
93

FleetBoston Finl
RWE Group
UniCredito Italiano
BT Group

94

United Parcel
Service
United
Technologies
Fortis

United States
Germany
Italy
United
Kingdom
United States

Consumer durables
Technology
hardware &
equipment
Telecommunications
services
Media
Banking
Oil & gas operations
Food markets
Technology
hardware &
equipment
Banking
Utilities
Banking
Telecommunications
services
Transportation

United States

Conglomerates

31.03

2.36

34.65

48.77

Netherlands

52.51

0.56

507.98

30.19

United States
Netherlands

Diversified
financials
Chemicals
Insurance

32.63
17.75

1.74
1.63

41.89
266.59

39.85
23.49

Belgium
France

Banking
Consumer durables

19.62
38.17

1.36
2.05

368.37
54.04

21.64
19.64

95
96
97
98
99
100

Dow Chemical
Aegon Insurance
Group
Dexia
Renault Group

160

Page 161 of 260

IIMA/CISG0104TEC

52. Optimal Machine Operation. ( Based on problem-8, Chapter 18, page 498, in Thuesen,
H.G.,Fabrycky, W.J., Thuesen G.J., Engineering Economy, Fifth Edition, Prentice Hall, 1977)
ABC Machine shop has just purchased eighteen identical automatic machines, each at a cost of 10,000
monetary units(MUs) . It employs six operators, one per three machines. Each operator is paid wages at the
rate of 5 monetary units (MUs) per hour and the shop operates 2000 hours per year. According to some of
the neighboring machine shops, each of the machines should be operated at 360 revolutions per minute
(rpm). At this speed, the expected life of a machine would be 5 years, and its annual maintenance cost 1500
MUs. The rate of production of a machine would be 180 units of the product per year. The annual power
cost would be 360 MUs. Assuming that the above are the only major costs, the proprietor wanted to know
the break-even price that he should charge per unit of the product at the above speed of operation.
On further inquiry, the proprietor came to know that the speed at which a machine is operated determines its
cost of operation; both the power consumption and maintenance charges increase with the speed of
operation, while the life of the machine remains more or less the same. The cost of power can be assumed to
be proportional to the speed of operation, while the maintenance cost changes non-linearly with increase in
speed. However, low speeds are not desirable, because the quantity of production increases with speed, the
quantity being directly proportional to the speed in rpm of the machine. To decide the speed at which the
machines have to be operated, the proprietor had the following data collected on the maintenance costs
likely to be incurred at different possible speeds:
Speed (rpm)
225
250
300
330
360
380
400

Maintenance cost
(MUs per year per machine)
600
700
800
950
1500
2200
3200

Using the above data, find the most desirable speed of operation of the machines from the financial view
point, assuming that the quantity of production is directly proportional to the speed of operation of a
machine, and that the quality of the product and the per-unit price that could be charged are independent of
the speed. Use the discount rate of 12% per year in your analysis. Furthermore, the salvage value at the end
of the life of a machine can be taken to be zero.

53. Distances between villages.


Consider a set of 10 villages, each of whose X and Y coordinates are given in columns B and C of range
A20:C29 respectively, while column A of the range consists of their serial numbers, 1,2,, 10. In range
B31:K40 the types of distance, S or R, between each pair of villages are to be obtained; row 31 consisting of
types of distance from village 1 to each of the other villages, and row 32 from village 2, and so on. Cells
A31:K31 consist of the serial numbers of the villages and so do the cells B30:K30.
The type of distance between a pair of villages is defined as follows:
The distance between two villages each of which is 'close' to the only highway that passes through the
region is equal to the length of the straight line segment joining them, and its type, in this case, is defined as
S. Otherwise, the distance between them is computed using the rectilinear distance formula, and its type is
defined as R.
161

Page 162 of 260

IIMA/CISG0104TEC

Each village is connected to the highway by two paths, one parallel to the X-axis and the other parallel to the
Y-axis. If the distance along either of them is less than a given 'tolerance', then the village is considered to
be 'close' to the highway. The parameters a,b, and c of the equation ax + by + c = 0 that represents the
highway are given in cells A1,B1, and C1 respectively and the tolerance in D1.
A. Use the range D20:D29 for formulae to tell us whether the corresponding village is 'close' to the
highway. Assume that the range A20:D29 is named as LTAB. What is the formula in D20?
B. Develop a spreadsheet formula such that when it is entered into cell B31 and then copied into the other
cells of the range B31:K40 , you get the types of distance between all the village pairs. For this purpose
you can use if necessary, the range LTAB mentioned above. What is the formula in B31?
C. In the B32:K51 compute the distances between each pair of the villages, as per the distance-types
obtained in B31:K40.
Use the following sample data:
Village Number
1
2
3
4
5
6
7
8
9
10

X-Coordinate
10
15
20
25
30
35
40
45
50
55

Y-Coordinate
20.08
30.1
40.09
50.5
61
72
80.01
90.02
100.5
113

Take the equation describing the highway as 2x-y = 0, and the tolerance as 0.05.
54. Pre-Paid Taxi Service.
The Gandhi-Nehru International Airport at Navi Dilli runs a pre-paid taxi service, with the help of local
traffic police, for the benefit of the arriving passengers. There are both AC and Non-AC taxis available, and
the charges for these are different. No advance bookings are possible. All bookings are made by the arriving
passengers at the prepaid taxi counter, located just near the exit of the arrival lounge.
The different components of the fare are:
1. Normal fare, depending on the distance of the zone in which the destination of passenger(s) is located.
This fare is subject to a minimum charge. For this purpose, the whole of Navi Dilli is divided into 20
zones, and each zone is considered to be at a certain distance from the airport. A map of Navi Dilli,
showing the different zones, is pasted both inside and outside the prepaid taxi counter for easy reference.
2. Night charge: if the time at which the booking is made falls between 11 PM and 5 AM in the night, 20%
of normal charge is charged extra.
3. Rush hour charge: Between 8:30AM and 11:30 AM, and further between 5:00 PM and 8:30 PM, 30% of
the normal charge is charged extra.
4. Luggage charges are Rs 10 per piece of luggage; however, the first three pieces are not charged.
5. A service charge of Rs 30 per AC taxi, and Rs 20 per non-AC taxi.
162

Page 163 of 260

IIMA/CISG0104TEC

An Excel spread sheet is designed, as shown in the next figure, to assist the pre-paid taxi counter operator in
computing the fare for each taxi. Whenever a request for booking a single taxi is made the following details
are entered in range C4:C10 by the operator. The entries, as can be seen from the headings in the
corresponding cells of the figure, are: Time at which the booking is made (this is the basis on which night
time and rush hour charges are decided), The type of taxi being booked (AC or NONAC), The name of the
passenger in whose name the booking is being made ( this is just for record, and is not needed in
computations), number of passengers ( needed only for records; ; actually, the maximum number of
passengers per taxi is three; if the number is such that more than one taxi is needed, then for each taxi, the
data is separately entered), total number of pieces of luggage, address of the destination ( max of 200
characters, not really needed for computations), and zone number in which the destination falls. Based on
the above inputs, the various components of the fare are computed and output in the range C11:C17. All
time data is entered and shown in hh:mm:ss AM/PM format; and the same is the setting at the windows
level.
In making the above computations, several parameters are to be used. These are given in the following
tables (in the computations, the parameters are obtained through appropriate cell referencing, and not
through hard coding):
1. The minimum fare, per KM normal fare, and service charge per taxi for AC and NONAC taxis: range
H5:J8
2. Distance in KM from the airport to each zone: range H11:I31
3. Night time interval: L11:M11; additionally, two time constants are provided in cells L12:M12 to
facilitate computations.
4. Extra charge for night time is 20%of normal charge ( M9)
5. Rush hour intervals: L16:M16 and L17:M17
6. Extra charge for rush hour is 30% ( given in M14) of normal charge
7. Number of luggage pieces for which there is no luggage charge is 3 (given in J33)
8. Luggage charge for each piece of luggage over and above the number of free pieces allowed: Rs 10 per
each extra piece (given in J34)

163

Page 164 of 260

IIMA/CISG0104TEC

1
2
3
4
5
6
7
8

Time
AC/NONAC
Name
NoofPassengers
Total Luggage

Address

10
11

Zone Number
Fare Normal

8
500

Distance

12
13

Night charge
Rush hour
Charge
Luggage charge

100
0

Night?
RushHr?

15
16

Service Charge

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

Total Charge

14

34

E
F G
Pre-Paid Taxi
Service

1:35 AM
AC
XYZ
2
2

Minimum
PerKm
Service
Charge

AC
100
25
30

NONAC
50
18
20
Extra
Night
Charge

20%

20
Night
time

1
2

Distance
in KM
5
8

12

Extra
Rush
Hour
Charge

30

4
5

6
9

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

15
18
20
14
18
11
8
17
20
16
9
12
8
15
20

630

Zone No
TRUE
FALSE

No of
FreeBags
Charge/
bag

Rush
Hour

11:00:00 PM

5:00:00 AM

11:59:59 PM

12:00:00 AM

30%

From
8:30 AM

To
11:30 AM

5:00 PM

8:30 PM

3
10

35

164

Page 165 of 260

IIMA/CISG0104TEC

Question: Give the formula in each of the following cells of the above spreadsheet
Cell address

Explanation of contents

E10

Distance in KM of the zone


entered in C10

C11

Normal Fare (Rs)

E12

Is the time given in C4 falling


in the night time category?
(TRUE or FALSE)

C12

Night charge

E13

Is the time given in C4 falling


in the rush hour category?
(TRUE or FALSE)

C13

Rush hour charge

C14

Charge for the number of


luggage pieces, in excess of
free allowance

C15

Service charge

C17

Total charge

Formula in the cell

165

Page 166 of 260

IIMA/CISG0104TEC

55. Fruit Prices


A certain type of fruit is available in different colors and weight. The fruit coming into a market for sale are
sorted based on their color and each carton is filled with 100 units of the same color. Then each box is
weighed and both the color of the fruit contained by it and the total weight are written on the top of the box.
The weight is written as an integer between 15 and 25 corresponding to the weight in kgs, whereas the color
is written as per the following code:
Color
Red
Orange
Yellow
Greenish Yellow

Color code
R
O
Y
GY

In writing the weight and color code no fixed sequence is followed. For example, a 25 kg box with greenish
yellow fruit is sometimes coded as GY25, and sometimes as 25GY. Call the combination of weight and
color code written on a box as its box code. The price (in Rs.) of each box depends on both the color of the
fruit contained by it and its total weight as given in the following table, each row of which corresponds to a
color and each column to a weight range as indicated.
R
O
Y
GY

15 kg-18kg
200
210
220
230

19 kg - 21 kg
210
225
240
260

22 kg - 23 kg
225
260
290
320

24 kg - 25 kg
250
280
320
350

The next figure shows a spread sheet designed to compute and analyze the prices related to a set of the
above boxes. Data related to a sample of 10 boxes is provided in the figure. The column headings are selfexplanatory. The basic input consists of the serial number of each box (A6:A15) and the code indicating the
color and the weight as mentioned above (B6:B15). The price matrix is given in the range J6:M9.
Question 1.
In the range C6:C15, the weight of the box is extracted from the box code contained in the corresponding
cells of the range B6:B15. What is the formula in cell C6 (this formula is copied to C7:C15), considering
that your formula can be confined only to the four color codes given above and need not be very general.
Answer:______________________________________________________________
_______________________________________________________________
Question 2.
In the range D6:D15, the color code is extracted from the box code contained in the corresponding cells of
B6:B15. What is the formula in cell D6 (this formula is copied to D7:D15).
Answer:______________________________________________________________
_______________________________________________________________

166

Page 167 of 260

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

IIMA/CISG0104TEC

Sl.No
1
2
3
4
5
6
7
8
9
10

BoxCode
25R
O20
22Y
GY21
Y18
19GY
24O
19Y
GY16
15R

Kg
25
20
22
21
18
19
24
19
16
15

Color
R
O
Y
GY
Y
GY
O
Y
GY
R

WtType
4
2
3
2
1
2
4
2
1
1

Price
250
225
290
260
220
260
280
240
230
200

Sl.No

BoxCode

Kg

Color
GY

WtType

Price

Avg Price
250
225
252.5
250
250

NoofBoxes
3
2
2
3
3

252.5
O

3
Y

R
O
Y
GY

E
F
FRUIT PRICES

R
O
Y
GY

15
1
200
210
220
230

19
2
210
225
240
260

22
3
225
260
290
320

24
4
250
280
320
350

Question 3.
The weight ranges are divided into four types, type 1 corresponding to the range 15 kgs to 18 kgs, type 2 to
19 kgs to 21 kgs, type 3 to 22 kgs to 23 kgs, and type 4 to 24 kgs to 25 kgs. Assume that weight is
expressed as integral number of kgs and it is never less than 15 nor greater than 25. In range E6:E15, the
weight types are obtained, using the information in C6:C15 and the categorization given in J4:M5. What is
the formula in E6 (this formula is copied from E7:E15).
Answer:_______________________________________________________________________
Question 4.
The price of each box is obtained in the range F6:F15 from the information contained in the ranges and cells
mentioned above. What is the formula in F6 (this formula is copied to F7:F15).
Answer:_______________________________________________________________________
Question 5.
In the sample data mentioned above, the average price of boxes corresponding to each color, and the number
of boxes corresponding to each color are to be tabulated respectively in the range D22:E25 as shown in the
figure. The codes of the colors of each of the rows in the above table are given in C22:C25. Data table
167

Page 168 of 260

IIMA/CISG0104TEC

option is chosen from the Excel menu system by highlighting the table range C21:E25 for the above
purpose (you can use A17:F18 as criteria range if you wish in answering the following questions).
5A

What is the formula in cell D21? ____________________________________________

5B

What is the formula in cell E21? _____________________________________________

5C

What is the column input cell given as a part of the above data table

operation?

Answer_______________________________________________________________
Question 6
From the data table obtained above, the maximum average price and the maximum number
of boxes by comparing the different color categories are obtained in cells D27 and E27 respectively. The
corresponding color codes ( in case of a tie, the first one eligible in the corresponding column is taken) are
obtained in cells D28 and E28 respectively.
6A

What is the formula in cell D28?______________________________________________

6B

What is the formula in cell E28?_____________________________________________

56. Cheapest Neighbor Heuristic for TSP.


Suppose there are n cities, 1,2,3,,n, and the cost of travel from each city to each other city is given.
Starting with city-1, a salesperson is required to visit each of the above cities once and only once, and finally
return to city-1, such that the total cost of travel is a minimum. Specifically, the sequence of the cities in the
tour should be of the form 1, J2,J3,,Jk,Jn,1, such that :
Jk # 1, for 2 k n
Jr # Js if r # s, 2 r,s n
The above problem, popularly known as the travelling salsperson problem (TSP) is very difficult to solve
optimally, especially when the number of cities n is large. Therefore a number of different techniques called
heuristics are used to obtain a feasible and hopefully a low cost solution. One such heuristic is the cheapest
neighbor heuristic. The steps of this heuristic are:
1. Current city is 1. Goto next step.
2. Consider the cities other than 1, which are not yet visited. From among them choose the next city to be
visited as that which has the minimum cost of travel from current city. Goto next step
3. Make the next city as the current city. Goto next step.
4. If all cities are not visited, go to step 2; Otherwise goto next step.
5. Return to city 1 from the nth city chosen above and stop.
For example, for the six city problem shown in the range B5:G10 in the spreadsheet below, the above
heuristic yields the sequence 1,6,5,2,3,4,1 with a total cost of travel equal to 128 monetary units. Note that
the values in the cells are the cost of travel from each city to each other city. For example the cost of travel
168

Page 169 of 260

IIMA/CISG0104TEC

from city-2 to city-4 is given in cell E6 as 61. The cost of travelling from a city to itself is infinity and is
given as 9999.

A
4
5
6
7
8
9
10
11
12
13

9999
9
20
15
29
43
6
128

20
9999
21
28
8
55
5

15
51
9999
9
17
62
2

26
61
23
9999
16
24
3

24
37
19
22
9999
21
4

10
2
5
10
34
9999
1

Suppose the cost matrix of a travelling salesperson problem is given in a range named tsprange. A sub
called tsp is developed in VBA such that for the TSP given in tsprange, it finds a solution by applying the
cheapest neighbor heuristic, and displays the sequence of the cities to be visited in the row immediately
below tsprange, starting with the column immediately preceding the first column of tsprange; the total cost
of the solution is displayed in the cell immediately below the second cell of the above solution. Assume that
tsprange is so located that at least one column to its immediate left and two rows below it immediately are
available for the above output. Fill in the blanks in the sub tsp.
Sub tsp()
'--------------------------------------------------------------------'... To solve travelling salesperson Problem
'... using the cheapest neighbor heuristic
'
'... The distance matrix is given in the range named tsprange
'
'... n... ...........Number of cities
'... costmat(i,j)... cost of going to city-j from city-i
'... mincol(j)...... index of minimum cost column in row j
'... minval(j)...... minimum value of cost in row j
'... tcost.......... total cost of a solution
'... row ........... index of the row currently being examined
'... i and j ....... control variables in FOR NEXT Loops
'... 9999 .......... used for infinity
'-------------------------------------------------------------------Dim mincol() As Integer, minval() As Single, n As Integer
Dim costmat() As Single
Set tspmat = Range("tsprange")
n = tspmat.Rows.Count
ReDim mincol( _______), minval( __________ )
ReDim costmat( ________________ )
Dim tcost As Single
Dim i As Integer, j As Integer, row As Integer
'initialize
169

Page 170 of 260

IIMA/CISG0104TEC

For i = 1 To n
mincol(i) = 0
minval(i) = 9999
costmat(i, 1) = 9999
For j = 2 To n
costmat(i, j) = _______________________
Next j
Next i
tcost = 0
tspmat.Cells(n + 1, 0).Value = 1 display the city in position-1
tspmat.Cells(n + 1, n).Value = 1 display the city in position n+1
'... Start with city-1 as the current city
'... Find in the row of the current city, min val, and mincol
'....to decide the next city to be visited
'... update cost matrix to ensure that the next city is not visited from anywhere else
'... update tcost
'... next city becomes current city
row = 1
For i = 1 To n - 1
For j = 2 To n
If ____________________________ < minval(row) Then
____________________________
___________________________
End If
Next j
tcost =_________________________________

'update total cost

'update mincol(row) column


For k = 1 To n
_____________________________= 9999
Next k
tspmat.______________ =___________________ 'display the next city to be visted
row = ______________________
Next i
tcost = ______________________________
____________________________________= tcost

End Sub

57. Formatting the tsprange in Cheapest Neighbor Heuristic for TSP.


In the problem above, suppose the sub tsp is run and the sequence of cities to be visited is obtained along
with total cost as described in the question. There is another sub called formattsp that uses the output
written by tsp on the spreadsheet and boldfaces the costs in those cells of the tsprange that correspond to
each step in the route of the travelling salespersons route. In the sample data shown in Problem IV, the steps
in the route are: city-1 to city-6, city-6 to city-5, city-5 to city-2, city-2 to city-3, city-3 to city-4, and city-4
170

Page 171 of 260

IIMA/CISG0104TEC

to city-1 Therefore the above sub when run with the above sample data changes the format of the following
cells to bold face: G5,D6,E7,B8,C9,F10. Write the sub formattsp.
Hint: In VBA the statement to be used to change the font of a cell to boldface is :
Cell reference. Font.Bold = True
For example if you want to format the cell in the second row and third column of range named xyz to bold
face the VBA statement should be:
Range(xyz).cells(2,3).font.bold =True
Your Answer

171

Page 172 of 260


Sub

IIMA/CISG0104TEC

formattsp()

End sub

172

Page 173 of 260

IIMA/CISG0104TEC

58. Hello Zindagi.


In one of the Door Darshan programs called Hello Zindagi, which used to be telecast every week some
time in 1990s, the following prize question was once posed: One of the Indian metro-cities and two other
Asian capitals have the same latitude. Name this Indian metro city and the two Asian capitals with the same
latitude. Two latitudes, for this purpose, can be considered to be the same when the difference between
them is less than one degree.
Propose a spread sheet design to solve this problem.
Your design depends very much in the format in which the input is available. Even with the same input
format, different solution strategies are possible.
Assume that the input is given to you in a spread sheet with the following layout: In column A are given the
names of Indian metros (assume they are four in number) and the names of Asian capitals (assume that they
are 51 in number) in a random order. In column B are given identification codes of the corresponding cities.
An identification code I indicates that the city is an Indian metro; the code F stands for a city which is
not Indian, but an Asian Capital (i.e. New Delhi is given the code I, whereas Tokyo, F). In column C
are given the corresponding latitudes in degrees (the values falling in Southern hemisphere are indicated
with minus sign, to distinguish them from those in the northern hemisphere). You can perform any
operations on this data, or generate further data from this. Write all the steps, and formulae involved, such
that when you follow the given instructions the answer (i.e. the names of the three cities) is automatically
produced in three specified contiguous cells.
Given below are two tables, the first containing the latitudes of the four Indian metro cities, and the second
containing the list of fifty one Asian countries, their capitals, and latitudes ( Souce: Wikipedia, URL:
http://en.wikipedia.org/wiki/category:capitals_in_asia) This list might change from time to time, for
example, when a new country gets formed.
List of Indian metro cities and their latitudes
S.No.
1
2
3
4

Name of the city


Chennai
Kolkata
Mumbai
Delhi

Latitude
13.05N
22.32N
18.56N
28.38N

List of Asian capitals and their latitudes


Country
Afghanistan
Armenia
Azerbaijan
Bahrain
Bangladesh
Belarus
Bhutan
Brunei Darussalam
Cambodia
China
Cyprus
Democratic People's Republic of Korea (North)
Georgia
India

Capital
Kabul
Yerevan
Baku
Manama
Dhaka
Minsk
Thimphu
Bandar Seri Begawan
Phnom Penh
Beijing
Nicosia
P'yongyang
T'bilisi
New Delhi

Latitude (Degrees.Minutes)
34.28N
40.10N
40.29N
26.10N
23.43N
53.52N
27.31N
04.52N
11.33N
39.55N
35.10N
39.09N
41.43N
28.37N
173

Page 174 of 260

IIMA/CISG0104TEC

Country
Indonesia
Iran (Islamic Republic of)
Iraq
Israel
Japan
Jordan
Kazakhstan
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Lebanon
Malaysia
Maldives
Moldova, Republic of
Mongolia
Myanmar
Nepal
Oman
Pakistan
Philippines
Qatar
Russian Federation
Saudi Arabia
Singapore
South Korea
SriLanka
Syrian Arab Republic
Taiwan
Tajikistan
Thailand
Turkey
Turkmenistan
Ukraine
United Arab Emirates
Uzbekistan
Viet Nam
Yemen

Capital
Jakarta
Tehran
Baghdad
Jerusalem
Tokyo
Amman
Astana
Kuwait
Bishkek
Vientiane
Beirut
Kuala Lumpur
Male
Chisinau
Ulan Bator
Yangon
Kathmandu
Masqat
Islamabad
Manila
Doha
Moskva
Riyadh
Singapore
Seoul
Colombo
Damascus
Taipei
Dushanbe
Bangkok
Ankara
Ashgabat
Kiev (Rus)
Abu Dhabi
Tashkent
Hanoi
Sanaa

Latitude (Degrees.Minutes)
06.09S
35.44N
33.20N
31.71N
35.41N
31.57N
51.10N
29.30N
42.54N
17.58N
33.53N
03.09N
04.00N
47.02N
47.51N
16.45N
27.45N
23.37N
33.40N
14.40N
25.15N
55.45N
24.41N
01.22N
37.35N
6.55N
33.30N
25.02N
38.33N
13.45N
39.57N
38.00N
50.30N
24.28N
41.20N
21.05N
15.24N

59. Flaming Pickles Company, Andhra Pradesh.


Flaming Red Pickles (FRP) Company, Andhra manufactures and sells three types of mango pickles, L,M,S.
Pickle L requires large size mangoes, M medium size, and small size mangoes. FRP buys its mangoes from
two different sources. The two sources differ in the proportion of mangoes that they contain for each of the
above three products and in the wastage. The following table shows the proportion of mangoes suitable for
each product in each of the above two sources.

L
M
S

Source-1
0.25
0.3
0.3

Source-2
0.35
0.15
0.5

174

Page 175 of 260

IIMA/CISG0104TEC

According to the above table, 25% of the mangoes from source-1 (as measured by weight) are large, 30%
medium, and 30% small, and the remaining unsuitable for pickles. Similarly, among the mangoes from
source-2, 35% are large, 15% medium, and 50% small.
The size of the market is such that FPC does not want to make more than 1.8 units of L, 1.2 0f M, and 2.4 of
S.
The per unit sales price of L,M, and S are 22.81, 11.89, and 11 monetary units respectively.
The raw material is bought over several different weeks in each season at different prices. The detailed data
on these prices is not available. The data is available only on the total quantity of each type of mango
purchased in each season over the past several seasons, and the total purchase cost for each season( see the
following table). The total purchase cost involves not only the cost of the mangoes, but a few other
miscellaneous unspecified costs, which can be considered fixed.

Season No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Purchase quantity
Source-1
Source-2
4.5
5
4
3.5
5
2.5
3.5
5
4
3.5
3
3.8
2
2
4
3
2
3
2
2.5
3.5
4
3
4.5
5
3
4
1.5
2
3

Total Cost
46
32
32
37
31.5
31.2
18
26
34
21.1
33.8
37
35.5
20
25

Assume that the above values for pickle and fruit quantities (ex: thousands of Kgs) and revenue and cost
(ex: 000s of Rs) are in compatible and consistent units.
From the above table, estimate the unit purchase cost of each type of mango, using regression . Then,
through an LP formulation, find the quantities of L,M, and S to be produced by FRP to maximize its profits.
Assume that the costs not mentioned above are negligible.
Structure the data on your spreadsheet such that whenever you change any data that is fed to the regression,
the data that is going to be fed to solver would automatically change.

175

Page 176 of 260

IIMA/CISG0104TEC

60. Telephone Bills Analysis


Mr. XYZ receives a telephone bill at the end of each month from the telephone department of his
organization for all the calls made from the telephone extension at his home. The bill shows, for each call
made, the phone number called, the date and time at which the call began, the duration of the call, and the
bill amount. The following table shows the bills for the months of August 2006, November 2006, and April
2007. By entering the data on a spreadsheet, answer the following questions:
1. Tabulate for each called number, the total duration of the calls, and the total amount.
2. Tabulate for each station, the same information as above.
3. For each station and month combination tabulate the same information as above.
4. Identify the top five numbers most frequently called
5. Identify the top five numbers in terms of the bill amount
6. On an average, what is the cost of a call per minute?
7. For each station compute the average cost per minute and arrange the stations in decreasing order of cost
per minute
8. Which is the time slot of the day ( divide the day into one hour intervals) during which Mr.XYZ tends to
telephone most?
9. Which is the day on which Mr. XYZ uses the phone most?
10. Mr. XYZ feels that he is calling Guntur most often and wants to cutown the length of time spent on
Guntur calls by 30 percent. What will be the percent reduction in the overall bill if he implements the
above idea.
11. Suppose he wants to reduce the overall telephone bill by 50% by reducing the call duration to Guntur by
X%, to Hyderabad by Y% and to Gudicvada by z%. Suggest a combination of X,Y,Z which would yield
the desired reduction.
12. Suppose the telephone companies are going to increase the charges for calls between 8.00 PM and 11:00
PM by 50%. By what percentage would XYZs telephone bill increase because of the above change
assuming that there would not be any change in his calling pattern.
DATE
(dd/mm/yyyy)

TIME
(hh:mm)

CALLED NO.

STATION

DURATION
(hh:mm:ss)

CALLS

AMOUNT
(Rs)

01/08/2006
01/08/2006
03/08/2006
03/08/2006
04/08/2006
09/08/2006
09/08/2006
12/08/2006
12/08/2006

18:46
18:48
21:14
22:15
20:57
20:04
20:41
8:15
21:15

9898119763
9898119763
8674241361
8632357112
8632357112
9833570091
9849367352
8632357112
4055164856

Mobile STD
Mobile STD
Gudivada
Guntur
Guntur
Mobile STD
Mobile STD
Guntur
Hyderabad

00:00:12
00:00:54
00:08:18
00:21:48
00:04:12
00:02:30
00:07:54
00:05:54
00:05:54

1
2
17
44
9
5
16
12
12

1.32
2.64
22.48
58.18
11.9
6.61
21.15
15.86
15.86

176

Page 177 of 260

IIMA/CISG0104TEC

DATE
(dd/mm/yyyy)

TIME
(hh:mm)

CALLED NO.

STATION

DURATION
(hh:mm:ss)

CALLS

AMOUNT
(Rs)

12/08/2006
12/08/2006
12/08/2006
12/08/2006
12/08/2006
12/08/2006
12/08/2006
12/08/2006
13/08/2006
13/08/2006
13/08/2006
13/08/2006
14/08/2006
14/08/2006
15/08/2006
15/08/2006
15/08/2006
16/08/2006
17/08/2006
17/08/2006
18/08/2006
19/08/2006
19/08/2006
20/08/2006
21/08/2006
22/08/2006
23/08/2006
23/08/2006
23/08/2006
23/08/2006
24/08/2006
24/08/2006
25/08/2006
26/08/2006
26/08/2006
29/08/2006
29/08/2006
31/08/2006
01/11/2006
01/11/2006
01/11/2006
01/11/2006
02/11/2006
02/11/2006
03/11/2006
03/11/2006
03/11/2006
03/11/2006

21:24
21:28
21:30
21:35
21:57
22:37
22:59
23:02
10:35
20:52
21:21
21:27
20:20
20:37
11:00
11:12
13:08
8:11
12:04
16:34
16:42
13:40
20:09
22:51
11:17
11:29
9:54
10:44
11:52
17:46
10:54
22:36
12:31
11:45
11:52
12:35
12:37
10:55
9.35
10.07
14.13
14.16
12.28
12.53
9.28
9.43
10.04
11.26

9849367352
9849367352
9825578057
9868304604
9935426294
8632357112
8674241361
8632357112
8632357112
2228540014
2228540014
2227820605
4023733334
9441321990
4023733334
9945698685
9440542629
9450137885
8632357112
8632357112
4027135841
8632357112
4023733334
8674241361
8632357112
8632357112
8632357112
8632357112
8632357112
4027135841
8632357112
9825309049
8674241361
8632357112
8632357112
8632357112
8632357112
8632357112
8572246251
8632357112
1124682101
1124682101
8674241361
8632357112
5122598794
8632357112
9440261752
8674241361

Mobile STD
Mobile STD
Mobile STD
Mobile STD
ISD
Guntur
Gudivada
Guntur
Guntur
Bombay
Bombay
Bombay
Hyderabad
BSNL Mobile STD
Hyderabad
ISD
BSNL Mobile STD
BSNL Mobile STD
Guntur
Guntur
Hyderabad
Guntur
Hyderabad
Gudivada
Guntur
Guntur
Guntur
Guntur
Guntur
Hyderabad
Guntur
Mobile STD
Gudivada
Guntur
Guntur
Guntur
Guntur
Guntur
Chithoor
Guntur
Delhi
Delhi
Gudivada
Guntur
Kanpur
Guntur
BSNL Mobile STD
Gudivada

00:05:42
00:08:42
00:02:54
00:00:42
00:04:24
00:19:18
00:31:06
00:20:24
00:02:00
00:09:24
00:09:24
00:08:48
00:04:18
00:08:06
00:01:00
00:01:54
00:08:42
00:03:18
00:08:00
00:10:24
00:06:48
00:11:42
00:07:30
00:04:00
00:10:42
00:20:24
00:09:06
00:01:24
00:16:24
00:02:24
00:09:42
00:07:48
00:01:24
00:05:06
00:00:36
00:06:12
00:01:00
00:08:18
00:01:12
00:14:18
00:01:54
00:01:12
00:24:18
00:11:30
00:08:42
00:13:36
00:06:36
00:10:06

18
6
2
9
39
63
41
4
19
19
18
9
17
2
4
18
7
16
21
14
24
15
8
22
41
19
3
33
5
20
16
3
11
2
13
2
4
17
3
29
2
3
49
23
18
28
14
21

23.8
7.93
2.64
11.9
51.57
83.31
54.21
5.28
25.12
25.12
23.8
11.9
22.48
2.64
5.28
23.8
9.25
21.15
27.77
18.51
31.73
19.83
10.57
29.09
54.21
25.12
3.96
43.63
6.61
26.44
21.15
3.96
14.54
2.64
17.19
2.64
5.28
22.48
3.96
38.34
2.64
3.96
64.79
30.41
23.8
37.02
18.51
27.77

177

Page 178 of 260

IIMA/CISG0104TEC

DATE
(dd/mm/yyyy)

TIME
(hh:mm)

CALLED NO.

STATION

DURATION
(hh:mm:ss)

CALLS

AMOUNT
(Rs)

03/11/2006
03/11/2006
03/11/2006
05/11/2006
05/11/2006
05/11/2006
05/11/2006
05/11/2006
06/11/2006
06/11/2006
06/11/2006
07/11/2006
07/11/2006
07/11/2006
07/11/2006
07/11/2006
07/11/2006
08/11/2006
08/11/2006
08/11/2006
09/11/2006
09/11/2006
09/11/2006
09/11/2006
09/11/2006
10/11/2006
10/11/2006
11/11/2006
11/11/2006
11/11/2006
12/11/2006
12/11/2006
13/11/2006
13/11/2006
14/11/2006
14/11/2006
14/11/2006
15/11/2006
15/11/2006
15/11/2006
15/11/2006
16/11/2006
16/11/2006
16/11/2006
17/11/2006
17/11/2006
17/11/2006
18/11/2006

16.27
20.4
21.21
10.46
16.04
16.13
16.4
21
7.45
11.03
11.28
10.03
16
16.22
17.19
21.1
21.19
10.51
19.34
21.19
10.55
11.04
11.13
17.5
18.15
9.27
9.32
7.49
9.55
11.23
16.46
19.35
11.2
21.24
10.12
10.22
16.27
10.31
10.45
18.08
22.25
11.46
16.58
21
11.57
21.22
22.25
7.41

8632357112
8572246251
8632357112
8644222612
8632357112
8632357112
5122598794
9849908545
9440261172
8632357112
8632357112
8632357112
8632357112
9392520541
8632357112
8644226142
8674241361
8632357112
5122598794
8674241361
8632357112
8674241361
8674241361
8674241361
8632357112
8674241361
8674241361
8674241361
8632357112
8674241361
8632357112
8632357112
8632357112
8632357112
8632357112
8632357112
8632357112
8632357112
8632357112
8632357112
2692261285
8632357112
8674241361
9849908545
8632357112
9849908545
8632357112
8632357112

Guntur
Chithoor
Guntur
Tenali
Guntur
Guntur
Kanpur
Mobile STD
BSNL Mobile STD
Guntur
Guntur
Guntur
Guntur
STD
Guntur
Tenali
Gudivada
Guntur
Kanpur
Gudivada
Guntur
Gudivada
Gudivada
Gudivada
Guntur
Gudivada
Gudivada
Gudivada
Guntur
Gudivada
Guntur
Guntur
Guntur
Guntur
Guntur
Guntur
Guntur
Guntur
Guntur
Guntur
Anand
Guntur
Gudivada
Mobile STD
Guntur
Mobile STD
Guntur
Guntur

00:10:00
00:03:24
00:00:48
00:00:36
00:00:30
00:06:48
00:05:00
00:01:12
00:05:06
00:06:24
00:21:54
00:23:36
00:16:42
00:21:06
00:06:42
00:13:48
00:06:48
00:19:06
00:00:18
00:05:18
00:06:48
00:05:48
00:04:12
00:01:54
00:15:06
00:00:12
00:03:54
00:06:54
00:13:48
00:11:54
00:15:18
00:07:30
00:21:54
00:11:36
00:03:24
00:03:30
00:08:18
00:13:12
00:02:06
00:10:36
00:16:12
00:16:18
00:00:42
00:02:00
00:10:42
00:02:06
00:12:36
00:10:18

20
7
2
2
1
14
10
3
11
13
44
48
34
43
14
28
14
39
1
11
14
12
9
4
31
1
8
14
28
24
31
15
44
24
7
7
17
27
5
22
17
33
2
4
22
5
26
21

26.44
9.25
2.64
2.64
1.32
18.51
13.22
3.96
14.54
17.19
58.18
63.47
44.96
56.86
18.51
37.02
18.51
51.57
1.32
14.54
18.51
15.86
11.9
5.28
40.99
1.32
10.57
18.51
37.02
31.73
40.99
19.83
58.18
31.73
9.25
9.25
22.48
35.7
6.61
29.09
22.48
43.63
2.64
5.28
29.09
6.61
34.38
27.77

178

Page 179 of 260

IIMA/CISG0104TEC

DATE
(dd/mm/yyyy)

TIME
(hh:mm)

CALLED NO.

STATION

DURATION
(hh:mm:ss)

CALLS

AMOUNT
(Rs)

18/11/2006
18/11/2006
19/11/2006
20/11/2006
20/11/2006
20/11/2006
20/11/2006
20/11/2006
20/11/2006
20/11/2006
21/11/2006
21/11/2006
22/11/2006
23/11/2006
24/11/2006
24/11/2006
26/11/2006
26/11/2006
26/11/2006
26/11/2006
26/11/2006
27/11/2006
27/11/2006
28/11/2006
28/11/2006
29/11/2006
29/11/2006
29/11/2006
30/11/2006
01/04/2007
01/04/2007
02/04/2007
05/04/2007
05/04/2007
06/04/2007
06/04/2007
06/04/2007
06/04/2007
07/04/2007
07/04/2007
08/04/2007
08/04/2007
08/04/2007
08/04/2007
08/04/2007
10/04/2007
11/04/2007
12/04/2007

10.27
17.3
20.16
7.42
7.45
8.22
11.48
19.58
20
20.39
11.16
11.48
10.3
10.22
9.28
13.09
11.44
19.25
21.05
22.18
22.57
10.05
12.31
10.47
21.18
7.54
9
9.04
19.02
20.35
21.29
21.15
20.56
22.15
9.03
10.23
22.31
22.52
22.13
22.15
9.15
9.23
9.33
10.06
10.24
8.06
21.52
16.2

8632357112
8632357112
4027502346
8632357112
9326881784
4065164856
8632357112
9326881784
9326881784
8632357112
8632357112
8632357112
8632357112
8632357112
9326881784
8632357112
4027502346
4027502346
9849908545
4027502346
8632357112
8632357112
5122598794
8632357112
9392520541
8632357112
8632357112
9302520541
4065164856
8632357112
8674241361
8632357112
8674241361
4023548488
8632357112
8632357112
4023548488
4023548488
4023548488
4023548488
4023548488
4023548488
4023548488
4023548488
4023548488
8632357112
4023548488
1128524458

Guntur
Guntur
Hyderabad
Guntur
STD
Hyderabad
Guntur
STD
STD
Guntur
Guntur
Guntur
Guntur
Guntur
STD
Guntur
Hyderabad
Hyderabad
00:00:18
Hyderabad
Guntur
Guntur
Kanpur
Guntur
STD
Guntur
Guntur
STD
Hyderabad
Guntur
Gudivada
Guntur
Gudivada
Hyderabad
Guntur
Guntur
Hyderabad
Hyderabad
Hyderabad
Hyderabad
Hyderabad
Hyderabad
Hyderabad
Hyderabad
Hyderabad
Guntur
Hyderabad
Delhi

00:03:36
00:23:54
00:02:06
00:05:00
00:02:24
00:02:12
00:12:00
00:02:36
00:00:42
00:13:48
00:08:30
00:15:00
00:07:12
00:24:36
00:01:36
00:07:42
00:00:18
00:00:36
00:00:12
00:07:42
00:11:36
00:18:42
00:02:36
00:10:42
00:04:24
00:22:36
00:01:54
00:02:24
00:10:06
00:01:06
00:11:06
00:08:30
00:09:12
00:10:00
00:15:36
00:02:42
00:00:54
00:01:00
00:01:00
00:00:48
00:00:30
00:02:48
00:00:48
00:00:30
00:00:42
00:04:42
00:01:54
00:01:30

8
48
5
10
5
5
24
6
2
28
17
30
15
50
4
16
1
2
1
16
24
38
6
22
9
46
4
5
21
3
23
17
19
20
32
6
2
2
2
2
1
6
2
1
2
10
4
3

10.57
63.47
6.61
13.22
6.61
6.61
31.73
7.93
2.64
37.02
22.48
39.67
19.83
66.12
5.28
21.15
1.32
2.64
1.32
21.15
31.73
50.25
7.93
29.09
11.9
60.83
5.28
6.61
27.77
3.96
30.41
22.48
25.12
26.44
42.31
7.93
2.64
2.64
2.64
2.64
1.32
7.93
2.64
1.32
2.64
13.22
5.28
3.96

179

Page 180 of 260

IIMA/CISG0104TEC

DATE
(dd/mm/yyyy)

TIME
(hh:mm)

CALLED NO.

STATION

DURATION
(hh:mm:ss)

CALLS

AMOUNT
(Rs)

12/04/2007
12/04/2007
12/04/2007
13/04/2007
14/04/2007
14/04/2007
17/04/2007
18/04/2007
18/04/2007
18/04/2007
19/04/2007
19/04/2007
20/04/2007
20/04/2007
20/04/2007
20/04/2007
21/04/2007
21/04/2007
21/04/2007
22/04/2007
24/04/2007
26/04/2007
26/04/2007
26/04/2007
27/04/2007

16.22
22.15
23.12
22.3
9.09
20.29
20.12
9.44
22.01
23.03
18.4
22.46
20.15
22.01
22.34
23.03
21.09
22.07
22.48
19.32
21.07
21.12
21.55
22.04
12.07

9871264343
4023548488
4023548488
4023548488
8632357112
8632357112
8632357112
8632357112
4023548488
4023548488
8632357112
4023548488
8632357112
4023548488
4023548488
4023548488
5122598794
4023548488
4023548488
8632357112
8632357112
8632357112
9849908545
4065164856
4422313732

Mobile STD
Hyderabad
Hyderabad
Hyderabad
Guntur
Guntur
Guntur
Guntur
Hyderabad
Hyderabad
Guntur
Hyderabad
Guntur
Hyderabad
Hyderabad
Hyderabad
Kanpur
Hyderabad
Hyderabad
Guntur
Guntur
Guntur
Mobile STD
Hyderabad
Madras

00:01:06
00:01:00
00:02:48
00:08:30
00:38:30
00:10:12
00:10:00
00:17:24
00:01:48
00:05:12
00:11:36
00:08:42
00:15:30
00:00:54
00:00:54
00:05:12
00:15:00
00:00:30
00:00:30
00:06:30
00:06:54
00:15:36
00:01:54
00:03:00
00:04:54

3
2
6
17
77
21
20
35
4
11
24
18
31
2
2
11
30
1
1
13
14
32
4
6
10

3.96
2.64
7.93
22.48
101.82
27.77
26.44
46.28
5.28
14.54
31.73
23.8
40.99
2.64
2.64
14.54
39.67
1.32
1.32
17.19
18.51
42.31
5.28
7.93
13.22

180

Page 181 of 260

IIMA/CISG0104TEC

61. Crop Water Requirements in a Command Area:


Consider a commonly encountered in irrigation management: how to allocate the area commanded by an
irrigation-outlet to different possible crops. The spread sheet can help in this problem by showing the
impact of a given area-allocation on the water requirement in cubic meters in each fortnight of an year.
Suppose a farmer considers cultivating in his land some or all of the following ten crops: Paddy-1, Paddy-2,
Bajra-K, Vegetable-K, Wheat, Cotton, Oil Seed, Sugarcane, Tobacco, and Fruit Crop. Let the total area
irrigated by the outlet be A hectares ( one hectare = 2.471 acres = 10,000 square meters). Let the fraction of
area allocated to crop(i) be equal to f(i).
The following standard procedure is followed by irrigation planners to compute the water requirement of
each crop in each fortnight:
Divide each month into two fortnights, or equivalently an year into twenty-four fortnights. Let the water
requirement in milli-meters of a standard crop, which is Alpha-alpha in this case, for fortnight j of the year
be MM (J). Then, the water requirement in mm for ith crop in jth fortnight is D(i,j) = KC(i,j) * MM (j)
where KC(i,j) is a standard multiplier called the KC value. The total volume of water in cubic metres,
V(i,j), required by the ith crop; in jth fortnight is equal to
10 * {KC(i,j)*MM(j) * f(i) * A}.
By summing the V(i,j) values over all i , we obtain the total water requirement in fortnight j, and by
summing them over j we obtain the total water requirement for crop I for all seasons. From these
summations, we can obtain the total yearly requirement of water for the outlet for the entire year. By
changing the values of f(i) we can study the effect of different area allocations on the water requirement.
Design a spreadsheet to estimate the irrigation requirements of a given plot as per the above scheme. The
sheet should enable the user experiment with different ways of allocating the area to the crops under
consideration and for each allocation pattern find the water requirement. You can intially assume that the
area is equally divided between all the ten crops, that is f(i) = 0.1 for I = 1,2,, 10.
You can use the following sample data ( This data was shared with the author by the officials of the
irrigation department of Gujarat during a programme offered to them) :
Total area A = 40 hectares
Water requirement in mm for each fortnight for Alpha-Alpha:
Fortnight No ( j)
1
2
3
4
5
6
7
8
9
10
11
12

Month
Jan
Jan
Feb
Feb
Mar
Mar
Apr
Apr
May
May
Jun
Jun

MM ( j )
52.5
56
65.61
56.86
85.62
91.33
107.58
107.58
127.64
136.15
105.79
105.8

Fortnight No ( j)
13
14
15
16
17
18
19
20
21
22
23
24

Month
Jul
Jul
Aug
Aug
Sep
Sep
Oct
Oct
Nov
Nov
Dec
Dec

MM ( j )
64.81
69.14
63.49
67.73
71.4
71.4
72
76.8
56.47
56.48
47.8
50.99

181

Page 182 of 260

IIMA/CISG0104TEC

KC (i,j) values for each crop (i) and for each fortnight ( j)
Crop No.
1
2
3
4
5
6
7
8
9
10

Crop Name
Paddy-1
Paddy-2
Bajra-K
Vegetable-K
Wheat
Hy.Cotton
Oilseed
Sugarcane
Tobacco
Fruitcrop

Fortnight No.
6
7

1.04

1.14

1.14

1.1
0.4

1.01
0.4

0.51
0.75

0.75

0.95

1.1

1.1

1.1

1.25

0.75

0.75

0.75

0.75

0.7

0.7

0.7

0.7

0.78

10

11

12
1.1
1.1

0.17

0.17

1.25

1.05

1.05

0.7

0.7

0.65

0.65

20
0.95

21
0.95

22

23

24

1.23

1.22

1.15
0.27
1.15
1.1
0.7

1.15
0.34
0.95
1.1
0.7

1.14
0.38
1.02
0.69
0.95
1.1
0.7

0.97
0.44
0.88
1.05
0.7
1.03
0.7

0.65
0.75
0.73
1.1
0.7
0.87
0.7

0.38

KC (i,j) values for each crop (i) and for each fortnight ( j) (continued)
CropNo.
1
2
3
4
5
6
7
8
9
10

CropName
Paddy-1
Paddy-2
Bajra-K
Vegetable-K
Wheat
Hy.Cotton
Oilseed
Sugarcane
Tobacco
Fruitcrop

Fortnight No.
18
19
1.05
1.05
0.95
0.95
0.97
0.45
1.16
1.23

13
1.1
1.1
0.29
0.17

14
1.1
1.1
0.5
0.21

15
1.1
1.05
0.93
0.31

16
1.05
1.05
1
0.61

17
1.05
1.05
1
0.96

0.3

0.56

0.83

1.08

1.15

1.15

1.15

1.05
0.25
0.65

1.05
0.25
0.65

1.05
0.28
0.65

1.05
0.54
0.65

1.05
0.77
0.65

1.05
1.05
0.65

1.15
1.1
0.7

182

Page 183 of 260

IIMA/CISG0104TEC

62. To Compute the Retirement Benefits at XYZ Co.


A private company, XYZ Co, wants to estimate the amount of money that it has to pay as retirement benefits
to its employees each year. You are required to develop a spreadsheet for XYZ such that it can give the
above information. Assume the following in computing the retirement benefits:
1.

The retirement age of an employee is 60 years. If the date of completing 60 years falls in
between a month, the retirement date is rounded off to the end of the month. That is, if the date
of birth is 10 December 1930, the employee would complete 60 years on 10 December 1990,
but he / she would retire on 31st December 1990.

2.

Each employee gets a consolidated salary at the end of each month. On the day of retirement,
an employee gets paid a lump sum amount as retirement benefit. This retirement benefit is
equal to 30 times the monthly salary at the time of retirement.

3.

The exact salary at the time of retirement depends on several factors such as the promotions etc.
However, to simplify the problem, assume that, on the average, the salary of an employee
increases every year by 15% of previous years salary. Assume for this purpose, that the
increment is given always at the beginning of an year, i.e. from 1st January onwards. For
example, if the salary in the year 87 was 100, that in 88 would be 1.15 * 100, in 89 it would be
1.15 * 1.15* 100 and so on.

Your spread sheet should consist of the following data on each employee:
1.
2.
3.

Employee number
Date of birth
Present salary

The spread sheet should be able to do the following:


1.

2.
3.
4.
5.

For any given year, it should display the total retirement benefits that the company would have
to pay. You can specify in which cell the year has to be entered, and in which cell the output
would be displayed.
For any given month in a given year, it should display the total retirement benefits that should
be paid by the company.
For each year, from 2000 to 2010, it should display in the form of a table how many employees
are due to retire.
The above spread sheet is intended to be a general one. Test your data on a sample data of 50
employees. Create your own data.
The spread sheet should be capable of being used according to Indian date system or American
date system. However, it is tedious to keep re-entering the dates in the sample data to test it
under both conditions. Write a macro through which you can do the following: Initially, the
global default international date is dd/mm/yy, and all date strings are entered accordingly. For
testing it with the global data format mm/dd/yy, you must invoke your macro; the date strings
should automatically get re-written according to the new format. That is, if the previous string
were: 13/11/85, the new string should be 11/13/85. Another macro should be able to bring the
global date format back to its original, and similarly, the date strings should also revert to their
original form.

183

Page 184 of 260

IIMA/CISG0104TEC

63. Voluntary Retirement Scheme


XYZ Corporation has introduced a voluntary retirement scheme which is applicable on a certain given date.
Any employee can enquire with the personnel department the total benefits that he or she will obtain if he or
she chooses to retire voluntarily on that date. For the given date the following data is available on a
spreadsheet on each of the employees:
1.
2.
3.
4.

Employee number
Basic salary (in Rs. per month) as on the given date
Date of Birth
Date of joining the organization

The following rules are to be used in computing the retirement benefits:


1.

2.

3.

4.

The scheme is applicable only for employees who have completed 10 years of service with the
organization on the date given. For this purpose the number of years of service is computed as
equal to the year number of the given date minus the year number of the date of joining the
organization.
The compensation amount consists of two components: (a) A fixed component which is
independent of the basic salary and is dependent on the number of years of service completed
till the given date. (b) The second component depends on the basic salary as on the given date
and the number of years of service remaining till retirement.
The fixed component of emoluments is equal to Rs. 1,00,000 if the number of years of service
completed is greater than 10 and less than or equal to 15 years. It is equal to Rs. 2,00,000 for
number of years of service completed is greater than 15 and less than or equal to 20. For
number of years of service completed is greater than 20 the component is equal to Rs. 4,00,000.
The number of years of service completed till the given date is computed in the same way as in
point 1 above.
The second component of the compensation is equal to the basic salary per month multiplied by
2 multiplied by remaining years of service. Remaining years of service is computed as equal to
the year of retirement minus the year of the given date. The year of retirement in turn is
computed as 60 plus the year of birth.

Design a spreadsheet to contain the inputs mentioned above and the date on which the scheme is applicable.
In addition the spreadsheet should accept the employee number of any employee who wants to know the
benefits that he/she would get if he/she chooses to retire on the given date and exhibit the compensation that
he is eligible for. If he is not eligible to retire on the given date then the spreadsheet should give a
corresponding message. You can write a macro to display the desired output.

184

Page 185 of 260

IIMA/CISG0104TEC

64. Fitness Centre Management.


A well-known institute of management in western Inida (WIMWI) has been running a gym with four
identical tread-mills (TM1,TM2,TM3, and TM4) for the last one year(on all days, 6AM to 6 PM). A
treadmill is an exercise machine that has a moving surface that you can walk or run on while remaining in
the same place. With the intention of analyzing the usage pattern of these machines and reviewing their
method of operation, the CAO had data collected on each user on a typical day on the following dimensions:
the code of the member (UserCode), the code of the tread-mill used by the user (MillCode), the time at
which the user started on the mill(StartTime), the time at which the user finished on the mill (EndTime), and
the distance for which the user walked or ran on the machince (Distance) in Kilo-meters. This data was
entered in the range B5:F25 of a spreadsheet as shown below. All the time data is shown in HH:MM
AM/PM format.
A

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

MillCode
TM1
TM1
TM1
TM1
TM1
TM1
TM2
TM2
TM2
TM2
TM2
TM3
TM3
TM3
TM3
TM4
TM4
TM4
TM4
TM4

MemberCode
ABC
DEF
XYZ
PPP
BBB
AAA
CCC
DDD
MMM
NNN
ACC
CCD
BBC
CDE
GGF
FFH
HHF
TTF
TTR
VVT

11:00 AM

12:00 PM

StartTime
6:25 AM
7:05 AM
8:00 AM
11:55 AM
1:30 PM
4:15 PM
7:30 AM
9:32 AM
10:25 AM
11:48 AM
5:38 PM
7:35 AM
9:32 AM
10:27 AM
11:40 AM
7:40 AM
9:32 AM
10:25 AM
11:48 AM
5:38 PM

EndTime
6:50 AM
7:15 AM
8:40 AM
12:30 PM
2:00 PM
4:30 PM
8:02 AM
10:04 AM
11:01 AM
12:43 PM
5:51 PM
8:02 AM
10:06 AM
11:01 AM
12:43 PM
8:02 AM
10:04 AM
11:01 AM
12:43 PM
5:51 PM

Distance(KM)
3
1
3.25
4
4.2
1.5
4
5
4.8
7
1.8
3.5
5
5.6
7
2.5
4
3.8
6
1.1

Duration
(min)
25.00
10.00
40.00
35.00
30.00
15.00
32.00
32.00
36.00
55.00
13.00
27.00
34.00
34.00
63.00
22.00
32.00
36.00
55.00
13.00

Speed
(Km/hr)
7.20
6.00
4.88
6.86
8.40
6.00
7.50
9.37
8.00
7.64
8.31
7.78
8.82
9.88
6.67
6.82
7.50
6.33
6.55
5.08

I. For each of the above data records, the duration of usage in minutes and the average speed in Km/hour are
computed in the corresponding cells of columns G and H.
I.1. What is the formula in G6, if it is copied to the other relevant cells in the same column?
Answer: _____________________________________________________________________
I.2. What is the formula H6, if it is copied to the other relevant cells in the same column?
Answer: _____________________________________________________________________
185

Page 186 of 260

IIMA/CISG0104TEC

II. In M10:Q13, the following are tabulated as shown in the following figure,from the data of part-I:
MillCode, Total duration of usage in minutes (TdurnMin), total duration of usage in hours (TdurnHrs),
Percentage utilization (Utlzn) assuming that each machine is available for usage for a total of eleven hours,
and the average speed at which the machine was run in its usage (AvgSpd) in Km/hour, ignoring the periods
during which it was not used. For this purpose, the data table feature was used, in conjunction with the
criterion range M5:M6 (not shown in the following figure). Further, in the row following the data table (that
is row number 14)the same statistics as above are obtained for all machines considered together.

8
9
10
11
12
13
14

M
MillCode
TM1
TM2
TM3
TM4
Overall

N
TDurnMin
155
155
168
158
158
639

O
TDurnHrs
2.58
2.58
2.80
2.63
2.63
10.65

P
Utlzn
23.48
23.48
25.45
23.94
23.94
24.2

Q
AvgSpd
6.56
6.56
8.07
8.01
6.61
7.33

Fill in the contents of the two cells of the criterion range and the formulae in the data table area as asked
below:
Cell
Address

Entry in the cell

M5
N9
O9
P9
Q9
N14
P14
Q14

III. CAO is not satisfied with the current way the one hour maintenance slot is allocated everyday for the
machines. He would like to choose the slot which is least used by the regular users. The slot should be one
of the twelve from among the following: 6:00 AM to 7:00 AM, 7:00AM to 8:00 AM, 8:00 AM to 9:00
AM,, 5:00 PM to 6:00 PM. For the data currently collected he would like to find which of the above
twelve slots has least usage in terms of duration of use falling within the slot, considering all machines
together (the total usage can even be more than one hour because we are considering the sum of duration of
each machine within the concerned interval). For this purpose, additional values are computed in I6:J25 (
see the figure below). In D2:E2, not shown in the figure, the starting and ending times of an one-hour
maintenance-interval in question are obtained. In column I, for each record of the original data collected (
see part-I), whether the users usage-interval falls within the interval of D2:E2 is found through a
186

Page 187 of 260

IIMA/CISG0104TEC

TRUE/FALSE answer. If the answer is TRUE, the duration of overlap is found in the corresponding cells of
J; if there is no overlap, the duration of overlap is zero. The total of all overlap values is found in J26. The
starting value of each of the twelve possible maintenance intervals are entered in D32:D43. The total overlap
values for each of the twelve intervals are obtained in E32:E43, using the data table feature, and using D2 as
the column input cell. The minimum of these tabulated values is found in E45. Finally, the starting and
ending values of the interval which gave rise to the above minimum are obtained in G31:H31. In case of
multiple minima, the first one is taken.
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

I
Overlap?
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
TRUE
TRUE
FALSE
FALSE
FALSE
TRUE
TRUE
FALSE
FALSE
TRUE
TRUE
FALSE

J
ExtentofOverlap
0.00
0.00
0.00
5.00
0.00
0.00
0.00
0.00
1.00
12.00
0.00
0.00
0.00
1.00
20.00
0.00
0.00
1.00
12.00
0.00
52.00

MntintvlS

Totverlp
52.00
25
85
46
84
117
52
159
30
0
0
15
26

6:00 AM
7:00 AM
8:00 AM
9:00 AM
10:00 AM
11:00 AM
12:00 PM
1:00 PM
2:00 PM
3:00 PM
4:00 PM
5:00 PM

MaintS
2:00 PM

MaintE
3:00 PM

187

Page 188 of 260

IIMA/CISG0104TEC

What are the formulae in the cells indicated below?


Cell

Entry in the cell

E2
I6 (Copied to other
relevant cells in the
column)
J6 (Copied to other
relevant cells of the
column)
E31

E45

G31

H31

IV. The CAO wants to charge the users based on their actual usage in minutes (recording actual usage is
possible). For this the charge in Rs/minute should be chosen such that the total charge will break even with
the maintenance and electricity charges. The maintenance per year ( an year is assumed to be 365 days) per
mill is Rs 20,000, and each mill consumes 3units of electricity per one hour of usage; and the electricity
charge can be assumed to be Rs 6 per unit. If the data collected on the day in question can be assumed to be
truly representative, and if the gym operates on each day of the year, what is the formula to compute the
charge in Rs per minute ( the corresponding formula can be entered in any empty cell)
Answer:_____________________________________________________________________

V. In M18:O21 are found for each mill the total number of users who began before the noon (ie at or before
12:00 PM), and the total number who began in the afternoon
( ie after 12:00 PM), as shown below.

16
17
18
19
20
21

M
MillCode
TM1
TM2
TM3
TM4

N
NoinAM
4
4
4
4
4

O
NoinPM
2
2
1
0
1

For this purpose, the data table feature is used in conjunction with two criteria ranges, the first one being
N5:N6, and the second one being O5:O6, with the column input cell specified as M6. Fill the formulae in
the cells given below:
188

Page 189 of 260

IIMA/CISG0104TEC

Cell

Entry in the cell

N5

N6
O5

O6
N17
O17

65. Exam Results in VBA.


A
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

PassMark
StdCode
S1
S2
S3
S4
S5
S6
S7
S8
S9
S10

40
English
35
30
60
30
70
50
60
70
49
48

50
Science
30
70
50
40
80
55
65
65
51
48

50
Maths
50
80
70
70
70
50
70
30
51
90

S1

English
Science
English
English
Science
Maths
Science

5
20
10
10
10
20
2

S2
S4
S8
S10

FailList

Range Names
B5:E14
B18:B18

SM
OTPT

In the spread sheet shown above, the range SM ( currently B5:E14) consists of the marks obtained by a set
of students in English, Science, and Maths. In the row immediately above SM are shown the field headings
StdCode, English, Science, Maths in the corresponding columns; and in the row immediately preceding the
field headings, are given the pass marks for each of the three subjects in the corresponding columns. A sub
in VBA is written such that it outputs the information related to failed students in SM. The name of the sub
189

Page 190 of 260

IIMA/CISG0104TEC

is FailList and it can be invoked by pressing the button with the same label. The output starts in the cell
named OTPT ( which in the example is cell B18). Each output line consists of the student code, subject in
which the student failed, and the deficiency in marks which led to the failure. In case a student has failed in
more than one subject, the student code is not repeated for the second (and third, if any) lines for the student,
but the subject and deficiency are displayed. The row of OTPT and the rows below it are ensured to be
empty before the sub is invoked. The listing of the sub is given below with some blanks. Fill in the blanks.

Sub FailList()
' To Output a list of Failed students
' The input is given in the format:
' Student code , marks in English, Scence and Math
' The Output consists of Student code, subject of failure, deficiency in marks
' If a student has failed in more than one subject her/his code is given only in the first
' line of output for the student
' Range Names: SM..... Range consisting of data on each student (B5:B14 in the example)
' The field headings are given in the row above the row of first student
' Pass marks are given for eachsubject, in the cell above the subject name
' OTPT.... The name of the first cell (B18 in the example) in the first student who has failed
'
Assume that the row containing OTPT and all rows below are
'
ensured to be empty before the sub is called
' n ... number of students in in the input
' def... deficiency of marks as compared to the pass mark
' Line... Line number being output
' CSCode... Current student code in the output
Dim CSCode As String, i As Integer, line As Integer, def As Integer, n As Integer
Dim j As Integer
line = 0
n = Range("SM").Rows.Count
CSCode = ""
For i = 1 To n
For j = 2 to 4
If ------------------------------------------------------------------------------------------------------------- Then
def = ---------------------------------------------------------------------------------------------------------line = line + 1
Range("OTPT").Cells(line, 2).Value = ------------------------------------------------------------Range("OTPT").Cells(line, 3).Value = --------------------------------------------------------------

If Range("SM").Cells(i, 1).Value <> ------------------------------------- Then


CSCode = Range("SM").Cells(i, 1).Value
-------------------------------------------------------------------------------------------End If
190

Page 191 of 260

IIMA/CISG0104TEC

End If

Next j
Next I
End Sub

191

Page 192 of 260

IIMA/CISG0104TEC

66. Sudoku Support System. Consider a 9x9 grid as shown in figure-1. This grid is further divided into
nine 3x3 boxes ( or sub-squares), each marked with double-line boundaries in the figure.
A Sudoku puzzle consists of starting with such a grid, with some of the cells already filled in with the digits
1,2,,9, a cell not containing more than one digit, and requires the puzzle-solver to fill in the remaining
cells with digits according to the following rules:
(1) each cell of the grid contains only one digit,
(2) each of the digits 1,2,3,, 9 is contained in each row once and only once
(3) each of the digits 1,2,,9 is contained in each column once and only once, and
(4) similarly, each of the digits 1,2,3,, 9 is contained in each sub-square once and only once.
Every puzzle has a unique solution.
Given below is a VBA SUB called Sudoku, that takes as input a Sudoku puzzle given in a 9x9 range called
Pzl in the spreadsheet, and then fills each empty cell of the puzzle with a string of digits, called its
possibility-string, such that one of the digits in the string should be the digit that should occupy the cell in
the final solution. Finding the possibility strings should serve as an intermediate step in the solution of the
puzzle, and the strings should be of help to a puzzle-solver.
The procedure for producing the possibility-strings is as follows:
1. Assign to each empty cell the possibilty-string 123456789
2. Consider each of the cells (of the original puzzle) whose digit is not yet found. From the cell( i , j) under
consideration, eliminate from its possibility-string all the digits already filled-in in the cells of its row ( that
is row-i ), its column ( that is column-j), and its sub-square. What remains is (i,j)s possibility-string to be
output by the sub.
It is possible, in the above process of elimination, for a cell to be filled-in to get a possibility-string which
has only one digit; in that case, the only digit remaining in the possibility-string is the digit that the cell
would have in the final solution of the puzzle. Hence, in the consideration of further cells for reduction of
possibility-strings, such one-digit possibilty-strings are taken as though they are the filled-in values.
The output of the sub for the puzzle of Figure-1 is shown in Figure-3. To illustrate the above method of
generating the possibilty-strings, let us consider cell (5,7), that is the cell corresponding to row-5 and
column-7 of the given puzzle. Initially, the possibilty string in this cell would be 123456789. In row-5 the
puzzle already has the digits 3 and 4 filled in. Therefore the possibility string of cell (5,7) is reduced by
eliminating from 123456789 the digits 3 and 4, to obtain 1256789. Column-7 has only one filled-in
cell, and that cell is filled with 5. Hence the above possibility-string is further reduced by eliminating from it
the digit 5, to obtain 126789 . Cell (5,7) belongs to the sub-square bounded by fourth and sixth rows of
the grid, and seventh and ninth columns. This sub-square is already filled with the digits 1 and 8. Therefore,
by eliminating 1 and 8 from the above possibility-string we get the final possibility-string 2679 for cell
(5,7).
Fill in the blanks in the given VBA listing.

192

Page 193 of 260

IIMA/CISG0104TEC

Figure-1. A Sudoku Puzzle


8

2
6

8
2

3
8

7
4
5

7
2

3
1
4

8
2

Figure-2: Solution to the puzzle of figure-1.


5
8
1
2
6
7
3
9
4

6
4
3
8
9
5
1
7
2

7
2
9
4
1
3
5
6
8

8
3
2
5
4
9
6
1
7

9
5
7
1
8
6
2
4
3

4
1
6
7
3
2
9
8
5

1
7
5
9
2
4
8
3
6

2
6
8
3
7
1
4
5
9

3
9
4
6
5
8
7
2
1

Figure-3. Output of the VBA Sub. Possibility-Strings, shown in italic-bold-underline format, in each empty cell of the
Puzzle, along with filled-in cells as already given, for the Puzzle of Figure-1.
14567

1456

1467

14

1347

1347

145

1247

1235

145

124

1347

14

1249

12

14

134679

1579

156

179

34679

3579

34567

1567

1569

1679

1568

2679

579

567

34567

4569

34679

2579

56

279

234679

13

789

3789

37

3468

48

48

368

35

46

468

79

16789

79

167

193

Page 194 of 260

IIMA/CISG0104TEC

You may find the following VBA functions useful in understanding the listing and filling in the blanks :

1.

InStr(string1, string2). Searches for the position at which string1 occurs in string2, which is assumed to be
longer than string1. If the first string occurs within the second, the starting position of its first occurrence is
returned; otherwise zero is returned.
2. Str(integer). Returns the string form of integer, with a leading space
3. Trim(String). Removes all spaces from string, leading as well as trailing.
4. Repace (string1,string2,string3). Replaces the first occurrence of string2 within string1, by string3. If
string2 is not a substring of string1, then no replacement occurs.
5. Int(number). Greatest integer less than or equal to number ( also called floor function)
VBA Listing.
Sub Sudoku()
'-------------------------------------------------------------' Pzl.......a 9x9 range containing the puzzle
' Soln......a 9x9 range in which the solution to puzzle is obtained

as output
' P ........Reference for Range("Pzl")
' S ........Reference for Range"Soln")
' A ........9x9 array working space for holding the puzzle and

intermediate results
' Digit ....A digit in a cell
' i,,j ......Counters for FOR--Next Loops
'-------------------------------------------------------------Dim P As Range, S As Range
Set P = Range("Pzl")
Set S = Range("Soln")
Dim Digit As Integer
Dim A(1 To 9, 1 To 9) As String
Dim i As Integer, j As Integer
Pzl contains numeric digis in some cells
' copy range Pzl into Array A after converting
' the given digits into characters in the filled-in cells
' and filling each empty cell with the string "123456789"
For i = 1 To 9
For j = 1 To 9
Digit = _______________________________________
If Digit > 0 Then
A(i, j) = __________________'Convert Digit to string and remove
leading spaces if any
Else
A(i, j) = ___________________
End If
Next j
Next i

194

Page 195 of 260

'
'
'

IIMA/CISG0104TEC

Reduce the Possibility-string of each empty cell


by scanning its corresponding row, column and sub-square,
and eliminating from it the digits contained in the filled-in
squares of the above row, column and sub-square

For i = 1 To 9
For j = 1 To 9
If ______________________ Then
' Attempt to reduce the possiblity-string of (i,j)th element

Call _______________

'

Call _________________ '

Call __________________'

Eliminate from the string in i,j all


digits given in row i
Eliminate from string i,j all digits
given in column j
Eliminate from string i,j all digits
given in subsqaue of i,j

End If

Next j
Next i

' write A into range "Soln"


For i = 1 To 9
For j = 1 To 9
S.Cells(i, j).Value = A(i, j)
Next j
Next i

End Sub

195

Page 196 of 260

IIMA/CISG0104TEC

-------------------------------------------Sub ChkRow(row As Integer, col As Integer, A)


'--------------------------------------------' Given a possibility-string in A(row,col)
' to remove from A(row,col) all the digits
' that are already existing in the
' filled-in cells of the above row in A
'
' row... index of the row containing the possibility-string under
consideration
' col... index of the column containing the possibility-string
under consideration
' A..... 9x9 array showing the filled-in digits and possibility
strings in various cells
' i,j... counters for FOR--NEXT Loops
'
'---------------------------------------------Dim i As Integer, j As Integer
For j = 1 To 9
If Len(A(row, col)) = 1 Then Exit For
If _____________________________________Then
If (InStr(A(row, col), A(row, j)) > 0) Then
'The digit contained in A(row,j) is repeating in the
possibility-string of A(row,col)
'Eliminate it from A(row,col) by replacing it with null
A(row, col) = ______________________________________
End If
End If
Next j

End Sub

196

Page 197 of 260

IIMA/CISG0104TEC

Sub ChkCol(row As Integer, col As Integer, A)


'-----------------------------------------------------------------'
'
'
'

Given a possibility-string in A(row,col)


to remove from A(row,col) all the digits
that are already existing in the
filled-in cells of the above column (col) in A

' row... index of the row containing the possibility-string under


consideration
' col... index of the column containing the possibility-string
under consideration
' A..... 9x9 array showing the filled-in digits and possibility
strings in various cells
' i,j... counters for FOR--NEXT Loops
'-----------------------------------------------------------------

Dim i As Integer, j As Integer


For i = 1 To 9
If Len(A(row, col)) = 1 Then Exit For
If ____________________________________ Then
If (InStr(A(row, col), A(i, col)) > 0) Then
'The digit contained in A(i,col) is repeating in the
possibility-string of A(row,col)
'Eliminate it from A(row,col)by replacing it with null
character
A(row, col) = _______________________________________
End If
End If
Next i
End Sub

197

Page 198 of 260

IIMA/CISG0104TEC

Sub ChkSubSq(row As Integer, col As Integer, A)


'-----------------------------------------------------------------' Given a possibility-string in A(row,col)
' to remove from A(row,col) all the digits
' that are already existing in the
' filled-in cells of the 3x3 sub-square to which (row,col) belongs
'
' row... index of the row containing the possibility-string under
consideration
' col... index of the column containing the possibility-string
under consideration
' A..... 9x9 array showing the filled-in digits and possibility
strings in various cells
' i,j... counters for FOR--NEXT Loops
' ru,rl..indices of top and bottom rows of the 3x3 subsquare to
which (row,col) belongs
' cu,cl..indices of top and bottom rows of the 3x3 subsquare to
which (row,col) belongs
'
'--------------------------------------------------------------Dim i As Integer, j As Integer, rl As Integer, ru As Integer
Dim cl As Integer, cu As Integer
ru
rl
cu
cl

=
=
=
=

_______________________
ru - 2
________________________
cu - 2

For i = rl To ru
For j = cl To cu
If Len(A(row, col)) = 1 Then Exit For
If ___________________________________ Then
If (InStr(A(row, col), A(i, j)) > 0) Then
'The digit contained in A(i,j) is repeating in the possibility string of A(row,col)
'Eliminate it from A(row,col) by replacing it with null
A(row, col) = ______________________________________
End If

198

Page 199 of 260

IIMA/CISG0104TEC

End If
Next j

Next i
End Sub

67. Vector Rotation.

1
2
3
4
5
6
7
8
9
10
11
12

F
1
2
3
4
5

5
4
3
2
1

Suppose there is a named vertical range in a spreadsheet. An array function called Vrotate is written in VBA
such that it outputs in a highlighted range the contents of the above range after rotating MT through one of
three types of rotations: Type-1 rotation means rotation by 90 degrees clockwise, type-2 means rotation by
180 degrees clockwise, and type-3 means rotation by 270 degrees clockwise. The function is to be provided
with the two arguments, name of the input range and the type of rotation. For type-1 or type-3 rotation, a
suitable horizontal output range is to be highlighted by the user, and for type-2, a vertical output range is to
be highlighted, and then the formula = Vrotate with appropriate arguments is to be typed in, followed by
control+shift+enter. For example in the above spreadsheet F1:F5 contains a five-element input vector named
as MT. The range G6:K6 consists of the formula=Vrotate(MT,1), the range F7:F11 the formula
Vrotate(MT,2), and A6:E6 the formula =Vrotate(MT,3).
The VBA listing of function Vrotate is given below. Fill in the blanks

68. Data Analytics for Shoe King.


The following table presents sales data related to Shoe King company during the three year period 20082010, in each of its five sales outlets. The company sells shoes for ladies (L) and gents (G). Data on
number of units (or pairs) sold and sales revenue obtained, is collected for each of the four quarters, in each
of the three years, for each outlet, and for each shoe type (L or G).
1. Present the data on sum of sales revenue for each of the following combinations:
Year and outlet
199

Page 200 of 260

IIMA/CISG0104TEC

Outlet and Shoe type


Year and Shoe type

2. For the same combinations as bove, present the data on sum of the number of units sold, and on average
unit price.
3. Is it possible for you to break the year-wise data in the above analysis into quarter-wise data?
S.No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

OutletCode
4
4
2
2
5
2
3
1
3
5
5
1
4
2
1
5
4
2
2
3
4
4
1
2
2
1
1
2
5
5
3
5
1
3
3
5
4

Year
2010
2009
2008
2010
2010
2009
2008
2008
2010
2009
2008
2009
2008
2008
2010
2010
2010
2009
2010
2010
2008
2008
2009
2010
2008
2008
2008
2009
2009
2010
2008
2008
2009
2010
2009
2010
2008

QuarterNo ShoeType NoofUnits Revenue(Rs)


2
G
46
102500
3
G
38
55000
4
G
25
100000
4
G
41
122500
1
G
32
125000
4
G
48
115000
2
G
49
75000
2
L
26
52500
1
G
21
125000
4
L
32
75000
3
G
48
50000
1
G
49
115000
1
L
47
49500
2
L
35
57000
1
G
31
92500
3
L
21
48000
1
L
48
72000
1
G
38
82500
3
G
29
112500
3
G
33
65000
1
G
23
120000
2
L
37
46500
2
L
25
45000
1
L
25
66000
1
G
28
65000
1
L
30
45000
4
L
44
48000
4
L
25
39000
3
L
29
58500
3
G
36
77500
1
L
20
46500
2
G
24
100000
3
L
21
54000
3
L
41
54000
4
L
34
63000
4
G
25
60000
2
G
44
117500
200

Page 201 of 260

S.No.
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

OutletCode
1
1
3
2
4
3
5
3
5
2
4
5
4
2
5
1
4
3
5
1
3
4
1
1
1
3
1
5
3
5
2
4
2
4
4
5
5
4
1
3
4
1
3

IIMA/CISG0104TEC

Year
2010
2009
2009
2010
2010
2010
2009
2008
2008
2008
2008
2009
2009
2008
2009
2010
2009
2009
2010
2010
2009
2010
2010
2009
2008
2008
2008
2010
2009
2008
2009
2010
2010
2009
2010
2008
2010
2008
2009
2009
2009
2010
2009

QuarterNo ShoeType NoofUnits Revenue(Rs)


2
G
20
122500
2
G
32
112500
2
G
46
77500
4
L
44
46500
4
G
21
122500
4
G
25
55000
3
G
21
117500
4
L
40
52500
1
G
34
122500
4
L
37
37500
3
L
36
60000
2
L
40
61500
2
L
24
69000
3
G
35
112500
1
L
33
37500
1
L
21
51000
3
L
36
46500
3
G
43
117500
2
G
28
80000
4
G
43
90000
2
L
47
31500
3
L
28
42000
4
L
47
73500
1
L
30
45000
3
L
20
49500
1
G
33
60000
1
G
33
85000
2
L
26
63000
1
L
32
42000
2
L
48
70500
3
G
35
55000
4
L
36
64500
2
G
20
60000
4
L
25
45000
3
G
46
67500
4
G
40
80000
4
L
26
36000
4
L
36
39000
3
G
47
102500
4
G
29
122500
4
G
37
65000
2
L
42
52500
3
L
33
67500
201

Page 202 of 260

S.No.
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

OutletCode
1
2
3
5
1
2
3
1
3
2
2
4
2
1
2
3
1
2
4
4
5
2
3
3
4
5
5
5
3
5
3
4
2
4
1
2
4
3
5
1

IIMA/CISG0104TEC

Year
2008
2009
2010
2010
2010
2008
2008
2008
2010
2008
2009
2009
2009
2010
2008
2010
2009
2010
2009
2010
2008
2009
2008
2008
2008
2009
2009
2008
2008
2008
2010
2008
2010
2009
2009
2010
2010
2009
2009
2008

QuarterNo ShoeType NoofUnits Revenue(Rs)


2
G
38
77500
2
G
44
125000
2
L
46
46500
1
L
21
57000
3
G
41
107500
1
L
41
75000
3
L
30
61500
4
G
47
112500
2
G
48
80000
3
L
39
57000
3
L
47
51000
1
L
48
58500
2
L
27
55500
3
L
35
70500
2
G
43
92500
4
L
50
73500
4
G
47
122500
2
L
22
31500
1
G
46
52500
1
G
37
117500
4
L
42
66000
1
L
40
39000
3
G
37
115000
4
G
37
90000
3
G
23
60000
2
G
47
60000
4
G
39
77500
3
L
45
69000
2
L
39
54000
1
L
28
54000
1
L
28
34500
4
G
50
90000
3
L
29
63000
2
G
49
50000
4
L
33
33000
1
G
45
92500
2
L
50
43500
1
G
41
120000
1
G
48
60000
3
G
25
100000

202

Page 203 of 260

IIMA/CISG0104TEC

69. Magic Square Generation.


A magic square consists of a square grid with number of rows = number of columns = r, containing integers
1,2,3,, r2 occupying the different cells of the grid, one integer per cell, such that the sum of integers in
each row= the sum of integers in each column = the sum of integers in each of the two diagonals. We
describe below an algorithm to generate a magic square of odd order r, r>=3:
1. Empty all the cells of the square.
2. Fill the middle cell of the top row with the integer 1. Repeat step 3 till the entire square is filled:
3. The next integer in sequence is to be filled in an empty cell which is found as follows:
A. From the cell that is just filled, go up by one row if feasible(ie if you are not in the first row);
otherwisego to the corresponding cell in the last row. that is rth row.
B. Go to the column on the left if feasible( ie if you are not in column 1); otherwise, go to the
corresponding cell in the last column, that is the rth column, of the grid.
C. If the cell reached at the end of the above two steps is empty, the cell is to be filled with the next
integer; otherwise, the cell vertically below (ie one row below) the cell that is just filled is guaranteed
to be empty, and is to be filled with the next integer.
A. Function MgSq().
A VBA function named MgSq is presented below to create a magic square as per the above algorithm.
The DIM statements provide for a square of a reasonable size.
The function is invoked by highlighting a range of the spreadsheet with equal number of rows and columns,
the number of rows and columns being odd, and typing in =MgSq(), followed by pressing
control+shift+enter keys.The function fills the above range with the magic square generated using the above
algorithm.
The figure below shows the magic square of order 5 generated by this function.
15
16
22
3
9

8
14
20
21
2

1
7
13
19
25

24
5
6
12
18

17
23
4
10
11

Fill in the blanks in the function.

203

Page 204 of 260

IIMA/CISG0104TEC

Option Explicit
Option Base 1
Function MgSq()
'--------------------------------------------------------------------------' Array function that outputs an odd order Magic Square
' in the highlighted range from which the function is called
' The highlighted area should have equal number of rows and columns and
' the number of rows and columns should be odd
' No error checking is done
' M ............Matrix to be filled in; set to range "MagicSquare"
' r ..............number of rows = number of columns in the magic square
' n .............total number of elements in the magic square= r*r
' i and j.......the row and column number for the element to be filled in
' ni and nj...possible row and column for next element to be filled in
' k ............. the next value to be filled in
'--------------------------------------------------------------------------Dim r As Integer
r = _______________________
Dim M() As Integer
ReDim ______________________________
Dim n As Integer, k As Integer
Dim i As Integer, j As Integer, ni As Integer, nj As Integer
For i = 1 To r
For j = 1 To r
M(i, j) = 0 ' Initialize M
Next j
Next i
n=r*r
i=1
j = _________________________
' Put 1 in the topmost row, middle column
M(i, j) = 1
For k = 2 To n
ni = (i - 1)
If ____________________ Then
ni = ________________________
End If
nj = (j - 1)
If _____________________ Then
nj = _____________________
End If
IF _______________________ THEN
____________________
____________________
ELSE
______________________________
End If
M(i, j) = k
Next k
______________________________
End Function
204

Page 205 of 260

IIMA/CISG0104TEC

B. SUB MagicSum.
A SUB called MagicSum verifies the output generated by the function MgSq as follows.
The SUB is invoked by highlighting the output generated by the above function and then clicking a
command button associated with the SUB.
Let r be the number of rows and s be the number of columns of the highlighted range.
The SUB does the following:
1. If the number of rows is not equal to the number of columns, the SUB writes the message
Non-Square in the first column, one row above the highlighted range; then it stops.
2. It computes the sum of cells in the forward diagonal ( the diagonal running from the southwest corner to northeast corner) of the highlighted range. The sum is written in the column
following the last column of the range and in the row above the first row.
3. It computes the sum of the cells in the backward diagonal, and writes it in the column
following the last column of the range, and in the row following the last row.
4. It computes for each row, the sum of the cells in the row, and writes it in the same row, in
the column following the last column.
5. It computes for each column, the sum of the cells in the column, and writes it in the same
column, in the row following the last row.
If any of the sums in steps 2,3,4,5 is not equal to what the sum should be in a magic square of the
corresponding dimensions, then the output is preceded by ** in the same cell.
As an illustration, shown below is the output generated by the above SUB when it is invoked after
highlighting the 5x5 rage whose entries are in bold font.

15
16
22
3
9
65

8
1
14
6
20 13
21 19
2 25
65 **64

24
5
6
12
18
65

17
23
4
10
11
65

65
65
**64
65
65
65
65

Fill in the blanks in the SUB.


Option Explicit
Option Base 1
Sub MagicSum()
'----------------------------------------------------------------------------------------------------------------------------' Given a highlighted range:
' If the range is not square,
' to print the message "Non-Square" just above the range(one row above, and in first column),
' and quit.
' Assuming that the entries in the range represent a magic square,
' to compute CSum, what the sum of each row, column or diagonal should be;
' to compute the actual sum of each row, column, and diagonal
' and To print in designated cells alongside the range either of the following:
' 1. the sum if it is equal to CSum, or
' 2. the sum preceded by ** if the sum is not equal to CSum
205

Page 206 of 260

IIMA/CISG0104TEC

' The above are printed in the following locations:


' 1. For each row,in the column following the last column of the range
' 2. For each clumn, in the row following the last row of the range
' 3. For the forward diagonal( ie the diagonal that runs from last row, first column to first row, last
column), in the cell in the row preceding the first row, and in the column following the last column
' 4. For the backward diagonal, in the cell in the row following last row, and in the column
following last column
'
' r .... .....number of rows and no of columns in a highlghted range
' s...........number of columns in the highlighted range
' Csum........Correct sum of each row, column and diagonal,if the given range consists of a magic square
' sum... .....variable for a sum
' i and j ....loop counters
'-------------------------------------------------------------------------------------------------------------Dim sum As Long, i As Integer, j As Integer, r As Integer, csum As Long, s As Integer
r = Selection.Rows.Count
s = ________________________________
If ______________________ Then ' if range is non-square print mesage and exit
Selection(0,1)=Non-Square Selection(0,1) is a shortcut for Selection.Cells(0,1).Value
___________________________
End If
csum = __________________________________
'..find forward diagonal sum
sum = 0
For i = ______________________________
sum = sum + ________________________________
Next i
_________________________________ = sum
If sum <> csum
Then
_______________________________ = "**" & sum
End If
'find backward diagonal sum
sum = 0
For i = 1 To r
sum = sum + _______________________________
Next i
___________________________ = sum
If sum <> csum Then
_______________________ = "**" & sum
End If
'find each row sum
For i = 1 To r
sum = 0
For j = 1 To r
sum = sum + _______________________________
Next j
____________________________ = sum
If sum <> csum Then
_______________________ = "**" & sum
End If
206

Page 207 of 260

IIMA/CISG0104TEC

Next i
'..find each column sum
For j = 1 To r
sum = 0
For i = 1 To r
sum = sum + ____________________________
Next i
_________________________________ = sum
If sum <> csum Then
______________________________ = "**" & sum
End If
Next j
End Sub

Option Explicit
Option Base 1

'Vector rotation through ninety, one-eighty, or twoseventy degs


Function vrotate(M As Range, T As Integer)
'T .... 1 means 90 degree rotn
'T......2 means 180 deg rotatn
'T......3 means 270 deg rotn
Dim result() As Integer '... to be re-dimensioned
Dim r As Integer, c As Integer, i As Integer, j As Integer
r = M.Rows.Count
c = M.Columns.Count
' each case corresponds to one type of rotation
Select Case T
Case 1
ReDim result( _____________________ ) As Integer
For j = ___________________
result(1, j) =_______________________________
Next j
Case 2
ReDim result (________________________ )
For j = 1 To r
result( ________ ) = __________________________________
Next j
Case 3
207

Page 208 of 260

IIMA/CISG0104TEC

ReDim result(______________________________ )
For j = _____________________
result(____________) = _______________________________________
Next j
End Select
____________________________________________
End Function

70. Forward-Pass Algorithm in a Project Network.


Consider a project with activities 1,2,,N whose durations T(1),T(2),T(3),T(N) are given. The time at
which the very first activity can be begun is considered as the origin of the time scale, time = 0. The project
is defined to be complete when all the activities are complete. In other words, the minimum possible
duration of the project (PrjDurn) is equal to the the earliest possible completion time of the final activity of
the project. An activity, except the first, cannot begin until all the activities designated as its immediate
predecessors are complete. Cyclic relations between activities are not permitted; i.e., if an activity-i is an
immediate predecessor of another activity-j, then j cannot be is immediate or indirect predecessor. The
activities are indexed consecutively such that the index of an activity is not lower than the index of any of its
immediate predecessors; obviously, one of the activities without any immediate predecessorsand at least
one such activity is guaranteed to existis indexed as activity-1.
The forward pass algorithm computes the minimum possible duration (Prjdurn)of the project as below:
1. Let the earliest possible start time EST(1) of activity-1 be zero. The activity under consideration is
activity-1; that is, i = 1. Go to step-2 below.
2. The earliest possible finish time EFT of the activity under consideration, activity-i, be EFT(i) =
EST(i)+T(i). Go to step-3 below.
3. If the activity under consideration is activity-N, stop with PrjDurn as equal to EFT (N). Otherwise,
consider the next activity in sequence as the activity under consideration, that is i = i+1. Go to step-4
below.
4. The earliest possible start time of activity under consideration, EST (i) = maximum of the earliest possible
completion times of all its immediate predecessors, if any; else EST(i) =0.Go to step-2 given above.
As an illustration, consider an eight activity project, with data as given below:
Activity index Activity Duration List of immediate predecessors
1
10
Nil
2
20
1
3
30
1
4
40
2,3
5
50
4
6
60
5
7
50
5
8
40
6,7

208

Page 209 of 260

IIMA/CISG0104TEC

For the above data , application of the forward pass algorithm yields the minimum possible project duration
as 230 time units. It can also be verified that the EST and EFT for the activities would be:

Activity index EST of the activity EFT of the activity


1
0
10
2
10
30
3
10
40
4
40
80
5
80
130
6
130
190
7
130
180
8
190
230
One of the ways of representing the immediate predecessor information is by using a zero-one matrix called
precedence matrix with N rows and N columns. If the value of the element in row-i and column-j of the
precedence matrix is 1, it means that activity-j is an immediate predecessor of activity-i; and if the value is
zero, it means that activity-j is not an immediate predecessor of activity-i. Obviously, all elements of row-1
are zero, and so are all diagonal elements, i.e. those in row-i and column-i, for i = 1,2,,N.
The forward pass algorithm is implemented in the VBA function PrjDurn shown below. The function
outputs the project duration, given the precedence matrix (Pred), which is an NxN range in the spread sheet,
and a one-column range T with N cells, containing the activity durations in sequence.
In addition to finding project duration, the function converts to red font all the cells in T which lead to the
EST value for each activity in step-4 of the algorithm; in case there is more than one such activity, the cells
in T of all such activities are shown in red font. More specifically, if at the end of step-4, let i be the node
under consideration, and j be an immediate predecessor of the node such that EST(i) = EFT(j), then the
contents of the jth cell in range T would be turned to red font. Further, the first and last cell of range T are
shown in red font.
Fill in the blanks in the VBA function. You can assume that all activity durations are integers, and that
activity durations and PrjDurn can be declared as integer in VBA.
Option Explicit
Function PrjDurn(Pred As Range, T As Range) As Integer
'-----------------------------------------------------------'N...... No. of activities in the project
'Pred... an NxN range in the spreadsheet such that Pred(i,j) =1 means
'
node j is an immediate predecessor of node-i; otherwise,
'
j is not an immediate predecessor of node-i
'T...... an Nx1 one-column range in the spreadsheet such that
'
T(i) is the duration of activity-i
'i,j..... Indices for FOR--NEXT loops, indices for range cells etc
'
'EST... A single dimensioned array. EST(i) is the
'
earliest possible start time of activity-i
'EFT... A single dimensioned array.EFT(i) is the
'
earliest possible completion time of activity-i
'-----------------------------------------------------------Dim N As Integer, i As Integer, j As Integer
Dim EST() As Integer, EFT() As Integer
N = ______________________________
209

Page 210 of 260

IIMA/CISG0104TEC

ReDim ___________, _______________


'initialize
For i = 1 To N
EST(i) = 0
________.Font.Color = RGB(0, 0, 0) ' change the font color to black
Next i
EFT(1) = EST(1) + T(1, 1)
______.Font.Color = RGB(255, 0, 0) ' change the font color to red
_______.Font.Color = RGB(255, 0, 0)
For i = 2 To N
For j = ___________
If ___________________________ > EST(i) Then
EST(i) = _______________
End If
Next j
EFT(i) = _____________________
For j = 1 To i - 1
If _________________________ = EST(i) Then
__________.Font.Color = RGB(255, 0, 0)
End If
Next j
Next i
________________________
End Function

210

Page 211 of 260

IIMA/CISG0104TEC

71. Eclipse Tourism.


(The global date format is set to dd/mm/yyyy in the following excel Sheet.)
Figure-1. Data on Solar Eclipses during 2011-2020. (Source: http://eclipse.gsfc.nasa.gov/Sedecade/SEdecade2011.html; the data from the source is
slightly modified for the purpose of the problem)
A

CalendarDate

EclipseType

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

2011 Jan 04
2011 Jun 01
2011 Jul 01
2011 Nov 25
2012 May 20
2012 Nov 13
2013 May 10
2013 Nov 03
2014 Apr 29
2014 Oct 23
2015 Mar 20
2015 Sep 13
2016 Mar 09
2016 Sep 01
2017 Feb 26
2017 Aug 21
2018 Feb 15
2018 Jul 13
2018 Aug 11
2019 Jan 06
2019 Jul 02
2019 Dec 26
2020 Jun 21
2020 Dec 14

Partial
Partial
Partial
Partial
Annular
Total
Annular
Hybrid
Annular
Partial
Total
Partial
Total
Annular
Annular
Total
Partial
Partial
Partial
Partial
Total
Annular
Annular
Total

C
Eclipse
Magnitude
0.858
0.601
0.097
0.905
0.944
1.05
0.954
1.016
0.987
0.811
1.045
0.788
1.045
0.974
0.992
1.031
0.599
0.336
0.737
0.715
1.046
0.97
0.994
1.025

Duration

Visibility

Year

Month

Day

DurMin

DurSec

TotSec

Ndate

05m46s
04m02s
06m03s
01m40s
05m01s
02m47s
04m09s
03m06s
00m44s
02m40s
04m33s
03m39s
00m38s
02m10s

EUR,ASA,AFR
ASA,NAM,ARC
INO
AFR,ANT,AUS
ASA,PCF,NAM,ASA,PCF,NAM
AUS,PCF,SAM,PCF
AUS,PCF
NAM,SAM,EUR,AFR,ATL
INO,AUS,ANT
PCF,NAM
ARC,EUR,AFR,ASA,ATL
AFR,INO,ANT
ASA,AUS,PCF,INO
AFR,INO,ATL
SAM,ATL,AFR,ANT
NAM,SAM,ATL,AFR,ANT
ANT,SAM
AUS
EUR,ASA
ASA,PCF
PCF,SAM
ASA,AUS
AFR,EUR,ASA
PCF,SAM,ANT

2011
2011
2011
2011
2012
2012
2013
2013
2014
2014
2015
2015
2016
2016
2017
2017
2018
2018
2018
2019
2019
2019
2020
2020

1
6
7
11
5
11
5
11
4
10
3
9
3
9
2
8
2
7
8
1
7
12
6
12

4
1
1
5
20
3
10
3
9
3
20
3
9
1
6
21
15
13
11
6
2
26
21
14

5
4
6
1
5
2
4
3
0
2
4
3
0
2

46
2
3
40
1
47
9
6
44
40
33
39
38
10

346
242
363
100
167
249
186
44
160
273
219
38
130

04/01/2011
01/06/2011
01/07/2011
05/11/2011
30/04/2012
03/11/2012
30/04/2013
03/11/2013
09/04/2014
03/10/2014
28/02/2015
03/09/2015
09/03/2016
01/09/2016
06/02/2017
21/08/2017
15/02/2018
13/07/2018
11/08/2018
06/01/2019
02/07/2019
26/12/2019
21/06/2020
14/12/2020

M
Elapsed
Days
168
316
346
473
650
837
178
365
522
699
847
187
375
176
334
530
178
326
355
503
680
177
355
531

N
Month
Names
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec

211

Page 212 of 260

IIMA/CISG0104TEC

Inspired by the excitement created by a recent total solar eclipse, Mr. XYZ wanted to start a new business in the
domain of eclipse tourism. As a preliminary step in developing his business plan, he wanted to analyze the data on
solar eclipses that are predicted to occur during the decade 2011-2020. He downloaded the corresponding data from
the website of NASA ( http://eclipse.gsfc.nasa.gov/SEdecade/SEdecade2011.html) into the range A1:E25 of an
EXCEL sheet, which is shown above ( see Figure-1). The above range shows data on 24 eclipses, each row for one
eclipse, the total number of fields for each row being 5. Each field is precisely defined by NASA, and for the current
purpose you need not understand those definitions. Further, some data in the fields is changed and edited to simplify
our questions. The following table ( see Figure-2) describes each field of the above data:
Figure-2. Format of the input fields in Figure-1.
In the range F1:M25 of figure-1, the data imported from NASA site is recast in a form suitable for computations.
Figure-3 describes how each of the derived fields has been obtained along with their formats.
FieldName
CalendarDate

Format
Text string. Four characters for the year number, followed by a space, followed by three
characters for month name, followed by a space, followed by two characters for the day of the
month.
EclipseType
Text string. The four types of solar eclipses are Partial, Total, Annular, Hybrid.
EclipseMagnitude Number. The number is usually a positive fraction; for some eclipses, it can even be slightly
greater than one.
Duration
Text string. For Partial eclipse type, duration is not defined; hence the value of this field for a
partial eclipse is shown as a dash, -. For others, the string consists of two characters for
minutes, followed by m , followed by two characters for seconds, followed by s.
Visibility
Gives a list of regions in which the eclipse is visible, the successive regions in the list being
separated by a comma. For this purpose the whole surface of earth is divided into eleven zones,
each denoted by a unique three character code.

212

Page 213 of 260

IIMA/CISG0104TEC

Figure-3. Explanations of various derived columns of Figure-1.


Range
F2:F25
G2:G25

Format
Number
Number

H2:H25
I2:I25

Number
A dash,-, or a number
(whichever is applicable)
J2:J25
A dash,-, or a number,
whichever is applicable
K2:K25 A dash,-, or a number,
whichever is applicable
L2:L25
A number, formatted as a
date in the dd/mm/yyyy
format
M2:M25 A number

Explanation
Year of the eclipse in the corresponding row
Month of the eclipse in the corresponding row; 1 for Jan, 2 for Feb, 3
for Mar etc. The month names Jan,Feb,MarDec are given in
N2:N13 of the spreadsheet
Day of the month for the eclipse of the corresponding row
Minutes part of the duration; if the eclipse type is Partial, the value is a
dash.
Seconds part of the duration; if the eclipse type is Partial, the value is a
dash.
The duration is expressed in seconds; for Partial eclipse, the value is a
dash.
The same as the CalendarDate field, except that here the data is a number
shown in the date format dd/mm/yyyy.
The elapsed time in days since the immediately previous Total solar
eclipse; for the very first eclipse, that is the one in row-2, the elapsed time is
given to be 168 days

Question 1. In the 8 ranges(except the last ) listed in figure-3, a formula is given in the first cell of each range and
copied to the other cells of the range, to obtain the values shown in Figure-1. In the range M2:M25 the first cell is
filled with value 168, and a formula is given in M3, which is copied to the cells below.
Fill in the following table.
Question

Cell

1.1

F2

1.2

G2

1.3

H2

1.4

I2

1.5

J2

1.6

K2

1.7

L2

1.8

M3

Formula in the Cell ( which is copied to the other cells below in the range)

213

Page 214 of 260

IIMA/CISG0104TEC

Figure-4. Range A27:F32 with some analysis of the Eclipse Data of Figures 1 and 3.

A
B
27 MeanIntvlTotl:
28 Type
MeanDurn(Sec)
29
30 Annular
199.3333333
31 Total
203.5
32 Hybrid
100

C
D
E
633.333
EclipseType
Type
MaxDurn(sec) Annular
363
Annular
363
Total
273
Hybrid
100

F
MaxSec
363

In range A27:F32 (see Figure-4) of the same spreadsheet as in all the other questions, further analysis of the data of
Figure 1 is performed.

Question 2.1. In Cell C27 is computed the mean interval in days between successive total solar eclipses of the above
decade through a formula. What is the formula in cell C27 (no criterion range nor a database function is to be used)?

Answer: _________________________________________________________
Question 2.2. A30:B32 tabulates the mean duration in seconds of the three types of eclipses Annular, Total, and
Hybrid, by a formula in B30, which is copied to B31:B32 (No criterion range nor the data table feature is involved in
this process). What is the formula in B30?
Answer:___________________________________________________________
Question 2.3: Using the criterion range E27:E28, and using the data table feature, the maximum duration of each
type of eclipses, Annular, Total, and Hybrid, is tabulated in D30:D32. The formula in D29 is =F28, and the table
range is C29:D32. What is the formula in F28?
Answer________________________________________________________________

214

Page 215 of 260

IIMA/CISG0104TEC

Figure-5. Range H27:I41 of the spreadsheet.


H
I
27 RGN
XRGN
28 ASA
TRUE
29 Region NoofOccurncs
30
9
31 ASA
9
32 AFR
9
33 AUS
7
34 EUR
5
35 NAM
5
36 SAM
7
37 ARC
2
38 ANT
7
39 ATL
5
40
INO
5
41
PCF
8

A data table is shown in Figure-5 above in the range H30:I41. This data table tabulates for each of the eleven regions
the number of solar eclipses visible (out of the twenty four listed in the input). This table is obtained by data filtering
using the criterion range I27:I28 and a DCOUNT formula. The column input cell is H28.
Question 3.1. What is the formula in cell I28?
Answer:_________________________________________________________

Question 3.2. What is the formula in cell I30?


Answer:____________________________________________________________

215

Page 216 of 260

IIMA/CISG0104TEC

72. Electricity Bills


Figure: Spreadsheet analyzing the electricity consumption of Mr. ABC
A

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

Mr. ABC's Electricity Consumption


1
FulCstPerunt
20
GovtDuty(%)
5
MetrRent
10
FixChrg
01/04/2008
1020461

Date
01/05/2008
01/06/2008
01/07/2008
01/08/2008
01/09/2008
01/10/2008
01/11/2008
01/12/2008
01/01/2009
01/02/2009
01/03/2009
01/04/2009
Season
S
R
W

Meter
Units
1020711
250
1021361
650
1021961
600
1022261
300
1022461
200
1022611
150
1022766
155
1022906
140
1023006
100
1023126
120
1023226
100
1023366
140
MonthList
May,June
August,September
December,January

LB
0
51
201

Rs/Unt
2.5
3
4

K
Chrgat
LB
0
128
579

Uchrg FChrg
775
250
2375
650
2175
600
975
300
575
200
425
150
440
155
395
140
275
100
335
120
275
100
395
140
Data Table
1250
S
1250
R
350
W
220

Gduty
205
605
555
255
155
115
119
107
75
91
75
107

TChrg
1245
3645
3345
1545
945
705
729
657
465
561
465
657

Unts/D
8.3333
20.968
20
9.6774
6.4516
5
5
4.6667
3.2258
3.871
3.5714
4.5161

61
61
61
62

6990
6990
1650
1026

20.492
20.492
5.7377
3.5484

SlabTable

Mnth
4
5
6
7
8
9
10
11
12
1
2
3
S
XMnth
FALSE

Nday
s
30
31
30
31
31
30
31
30
31
31
28
31

SlbN
o
3
3
3
3
2
2
2
2
2
2
2
2

Mno
1
2
3
4
5
6
7
8
9
10
11
12
3495
3495
825
513

Name
January
February
March
April
May
June
July
August
September
October
November
December

114.6
114.6
27.05
16.55

216

Page 217 of 260

IIMA/CISG0104TEC

The spreadsheet given in this question shows the data on the electricity consumption in twelve
consecutive months of Mr. ABC, and computations related to the electricity charges for each of
the above months, and analysis related to the electricity consumption in various seasons. Assume
that the windows date format set through control panel is dd/mm/yyyy.
The main input is in B9:C20. In this range, the following input is given:
Column B: For each of the twelve months, the date of the first day of the month,
Column C: the electricity meter reading noted at the beginning (say at 00:00 hrs mid-night!) of the
corresponding date given in column B. The meter reading is an integer.
The date and meter reading for the reading immediately preceding the above twelve readings are
given in B6 and C6 respectively.
Using the above data, the total charge for the electricity consumed by ABC is to be computed in
each of the twelve months. The total electricity charge consists of four components:
1. Uchrg (H9:H20): A variable component based on the number of units consumed in the month
(Units). An incremental slab system is used to compute this charge, the rate for the first 50 units
(ie from zero to 50, including 50) being Rs. 2.5 per unit, the rate for next 150 units ( ie from 51 to
200, including 51 and 200) being Rs. 3 per unit, and the rate for further consumption (ie for units
greater than or equal to 201) being Rs 4 per unit.
The lower bounds of each of the above three slabs, the per unit charge, and the Uchrg at the lower
bound of each of the intervals are shown in I2:K4.
While the entry in K2 is 0, that in K3 is obtained by a formula, and the formula is copied to K4 to
obtain the value in K4.
2. FChrg (I9:I20). A variable component indicating the fuel charge, which equals the fuel charge
per unit, whose value is given in cell D2, multiplied by the number of units consumed in the
corresponding month (Units). The Units in each month are computed in D9:D20.
3. Gduty (J9:J20). Government duty, which is a certain percentage (specified in D3), levied on
the sum of the above two charges.
4. Monthly meter rent (given in D4), and other fixed charges per month (given in D5).
5. TChrg(K9:K20). Total of all the above four components.
To facilitate the above computations, the calendar month number (Mnth)for which the charges
are computed, and the number of days in the month(Ndays), for each of the above twelve months
are also computed in E9:E20, and F9:F20 respectively. The number of the slab (SlbNo) to be
applied in computing
Uchrg is computed in G9:G20.
Further, after computing the total electricity charge in each month, the average number of units
consumed per day in the month (Unts/D) is also computed, and shown in L9:L20.

217

Page 218 of 260

IIMA/CISG0104TEC

In the following table we give a list of cells referred above; for each cell write the formula
contained in the cell.
Cell

Cell formula
to be copied
to

K3

K4

D9

none

D10

D11:D20

E9

E10:E20

F9

none

F10

F11:F20

G9

G10:G20

H9

H10:H20

I9

I10:I20

J9

J10:J20

K9

K10:K20

L9

L10:L20

Cell formula

218

Page 219 of 260

IIMA/CISG0104TEC

The data is further analyzed season-wise. For this purpose, a list of seasons and the months
corresponding to the seasons is developed. It is assumed that a season can have more than one
month, in which case the month names are given one after the other separated by commas. This
data is given in the range B22:C24, the first column showing the season names, and the second
the list of months in each season. A data table is developed in H22:N25 to tabulate for each
season the following:
1. the total number of units consumed in the season( I23:I25)
2. the total number of days in the season (J23:J25)
3. the total electricity charge incurred in the season (K23:K25)
4. the average number of units consumed per day in the sason (L23:L25)
5. average charge per calendar month in the season (M23:M25)
6. the average charge per day in the season (N23:N25)
To help do the above analysis, the number and name of each calendar month are given in range
N9:O20.A criterion range is developed in E23:E24. For the data table H22:N25, the column input
cell is E22.
In the following table, for each cell listed, write the cell formula. For E24, a formula with blanks
is already given; for this case, fill the blanks in the formula.
Cell

Cell formula

=_________________(FIND(VLOOKUP(________________________________________),
E24
VLOOKUP(__________________________________________________________),1))

I22
J22
K22
L22
M22
N22

219

Page 220 of 260

IIMA/CISG0104TEC

73. Hotel Tariff


Consider a spreadsheet in which the actual check-in (ex: 01/07/2011 10:30 AM) and actual
checkout (ex: 02/07/2011 2:30 PM) data for a sample of ten guests (a room is checked-in in the
name of only one guest, even though actually more than one person may occupy it, especially in
the case of double occupancy) is given in columns B and C, in the range B3:C12; row-2 of the
sheet is used for field headings. This data is to be used for studying the impact of new tariff
policies under consideration. All the date and time data is in the format dd/mm/yyyy hh:mm
AM/PM.
A

Checkout

RmType

Charge from

Charge to

L M

Date time format is dd/mm/yyyy hh:mm AM/PM

S.No.

Checkin

3
4
5
6
7
8
9
10
11
12

1
2

ND

BChrg

0.25

0.1

K
TChrg

N
P

4000

6000

5000

7000

8000

10000

3000

4000

6
7
8
9
10
11

12

13

14

15

>4

16

17

There are four categories of rooms: Premium(P), Luxury(L), Royal (R), and Budget(B); each
room has two modes of occupancy, Single (S), and Double(D). The base tariff depends on the
combination of room category and occupancy mode; the base tariffs in Rs per day are given in
220

Page 221 of 260

IIMA/CISG0104TEC

the range N2:P5 for each of the above combinations; column-O of the above range consists of
tariff for S and column-P for D.
There are additional charges over the base tariff:
1) if an extra bed (E) is put in the room to accommodate a child, there is an extra charge of
25%, given as a parameter in I1, over the base tariff;
2) if the room is facing the hotel garden (G), then the extra charge over base tariff is 10%,
which is given as a parameter in J1.
The above features that apply to each of the ten sample guests is given as a string in the
corresponding rows of D3:D12; this string begins with a character indicating the room category;
then followed by some or all of the following, whichever is/are applicable: D (for double
occupancy), E (for extra bed), and G (for garden facing), in any order. For example if the string
is BDG or BGD, then it means the room category is Budget, the occupancy mode is Double, and
it is Garden facing; since E does not appear, no extra bed was used. Similarly, PGE or PEG
means, Premium room, Garden facing, using an Extra bed, and occupancy mode is single,
because D is missing.
Furthermore, the duration of stay is computed using the rule that the allowed check-in and
allowed check-out times are 12:00 PM, ie 12:00 noon; and, one noon to the next noon is
considered as one day for purposes of charging. If the actual check-in happens before noon, it is
considered to have happened at 12:00 noon on the previous day, and if the actual check-out
happens after 12:00 noon, it is considered to have happened at 12:00 noon next day. For example,
if a person checks in at 10:30 AM on 1 July 2011, and checks out at 4:00 PM on 2 July 2011, then
the check-in is considered to have happened at 12:00 noon on 30 June 2011 and check-out at
12:00 noon on 3 July 2011, and the guest will be therefore charged for three days.
1. A formula is entered in E3 and copied to E4:E12, to compute the date and time from which
each of the corresponding guests has to be charged. What is the formula in E3?
______________________________________________________________________________
2. A formula is entered in F3 and copied to F4:F12, to compute the date and time up to which
each of the corresponding guests has to be charged. What is the formula in F3?
_____________________________________________________________________________
3. What is the formula in G3, copied to G4:G12, which computes the number of days for which
each of the guests is charged?
______________________________________________________________________________
4. A formula is entered in H3, and copied to H4:H12, to compute the total base charge, in Rs,
applicable to each of the guests for the number of days computed in G3:G12. What is the formula
in H3?
______________________________________________________________________
5. A formula is entered in I3, and copied to I4:I12, to compute the extra charges , in Rs, due to
extra bed (if any) for each of the guests, over the amount computed in H3:H12. What is the
formula in I3?
_________________________________________________________________________
221

Page 222 of 260

IIMA/CISG0104TEC

6. A formula is entered in J3, and copied to J4:J12, to compute the extra charges, in Rs, due to
the fact the room is facing the garden (if any) for each of the guests, over the amount computed in
H3:H12. What is the formula in J3?
______________________________________________________________________________
7. A formula is entered in K3, and copied to K4:K12, to compute the total of all the charges
computed in the corresponding rows of H3:J12, for each guest. What is the formula in K3?
___________________________________________________________________________

8. Out of the above ten guests, how many have been charged for E, G, P,L,R, S? This data has
been tabulated in N11:O16, through the Data Table feature, using the criterion range defined in
Q7:Q8; for the data table, the column input cell is Q6.
8a. What is the formula in Q8?
______________________________________________________________________________
8b. What is the formula in O10?
______________________________________________________________________________

9. Out of the above ten guests, how many have checked in on a Sunday (ie day no. 1), how many
on Monday,, how many on Saturday? This data has been tabulated in Q11:R17 through the
data table feature, using the criterion range defined in R7:R8; for the data table, the column input
cell is R6.
9a. What is the formula in R8?
___________________________________________________________________________
9b. What is the formula in R10?
_____________________________________________________________________________
10. The duration of stay for each of the ten cases is summarized by tabulating how many guests
had a duration of 1 day, how many 2 days, how many 3 days, how many four days, and how many
greater than four days, in U11:U15, using COUNTIF. What is the formula in U11 copied to
U12:U15?
_____________________________________________________________________________

74. A Greedy Heuristic for the Assignment Problem.


Suppose there are n machines, i1, i2, , in , and an equal number of jobs j1,j2,,jn. A job can be
manufactured on any of the machines( and conversely a machine can manufacture any of the
jobs). The cost, C(i,j), of manufacturing jth job (or job-j) on ith machine (or machine-i),is known
for i=1,2,,n and j=1,2,,n. We need to decide a manufacturing plan such that:
(1) a job is assigned to be manufactured only on one machine, and a machine is assigned to
manufacture only one job, and
(2) the total cost of manufacturing all the jobs is a minimum.
The above problem is called the assignment problem.
222

Page 223 of 260

IIMA/CISG0104TEC

The following pseudo-code specifies a greedy heuristic to obtain a feasible solution (not
necessarily optimal) to the above problem:

Initialization:
Cost of assignment
0
No. of assignments made
0
While the number of assignments is less than n

Find the minimum cost value among all C( i , j)s, that is, find i min and j min such
that C(imin , j min) equals Min{C(i,j), i = 1,2,...,n; j = 1,2,...,n}
Assign Job j min to machine i min.
Change all costs of machine i min and of job j min to infinity;
that is, set C(imin , j ) to infinity for j = 1 ,2,..., n; and C( i , jmin ) to infinity for
i=1,2,...,n
No. of assignments made + 1
No. of assignments made
Cost of assignment
Cost of assignment +C( i min , j min)

End While

To illustrate, we show below a cost matrix C( i, j ), i = 1,2, , n , j = 1, 2, ,n corresponding to


a five machine, five job assignment problem.
j1

j2

j3

j4

j5

i1

11

12

18

40

19

i2

14

15

13

22

16

i3

11

17

19

23

25

i4

17

14

20

28

32

i5

15

22

15

Application of the above heuristic leads to the following assignments of(machine number, job
number):
(5,4), (1,1), (2,3), (4,2), (3,5) with the total cost of assignment
being 68.

We give below a VBA sub named GASSNMNT that uses the above heuristic to find a feasible
solution to a given assignment problem. Specifically, the input to the SUB is a cost matrix given
in the spreadsheet range named costrng. Each row of costrng corresponds to a machine and each
column to a job. The solution is written next to costrng by the SUB as follows: for each machine,
the number of the job assigned to it is written in the same row as the machines costs, in the
column just to the right of the costrng; for each job, the number of the machine assigned to it is
written in the same column as the jobs costs, one row below costrng. The total cost of assignment
is written in the row below and in the column to the right of costrng. Further, in costrng, the
colour of each assigned cells font is changed to red.
We show below the relevant portion of a spreadsheet to illustrate the input and output of the SUB.
223

Page 224 of 260

IIMA/CISG0104TEC

11

12

18

40

19

14

15

13

22

16

11

17

19

23

25

17

14

20

28

32

15

22

15

68

In the sheet, A1:E5 is the range COSTRNG, consisting of the cost matrix of a 5x5 assignment
problem. The SUB writes its output in the row below the COSTRNG, that is, in row-6, and in the
column to the right of COSTRNG, that is, in column-F. For example in the input, c(2,3), that is
the cost of manufacturing job-3 on machine-2, is 13, which is the value in cell C2. In the output,
the value of cell F3 is 5, which means that the job assigned to machine-3 is job-5; the same
information is given in cell E6, whose value is 3, indicating that the machine on which job-5 is to
be manufactured is machine-3. The value of cell F6 is 68, indicating that the total cost of
assignments made by the heuristic for the above problem is 68.
Fill in the blanks in the SUB. The comments are correct and self explanatory.

224

Page 225 of 260

IIMA/CISG0104TEC

Option Explicit
Option Base 1
Sub GASSNMNT()
'------------------------------------------------------------------------------'A greedy heuristic for the ASSIGNMENT problem.
'
'
Given a (n*n) range
'
each row, i, of which corresponds to a mchine, machine-I ,
'
and each column, j, of which corresponds to a job, job-j ,
'
each cell, cell (i,j), the cost of performing Job-j on Machine-i;
'
To assign the jobs to machines such that
'
a job is assigned to one and only one machine,
'
and a machine to one and only one job,
'
and the total cost of assignment is a minimum
'
'Heuristic Used:
' Repeat n times
'
Choose the row and column corresponding to min cost element, make the
assignment,
'
Update the total cost,
'
Make all costs in chosen row, and column, equal to infinity
' End Repeat
'
' Names of variables, ranges, and arrays:
'CMat ........The range consisting of the cost data
'Cost().......An internal square-array consisting of the cost matrix,
'N... ........No.of jobs, which is equal to no. of machines
'Infinity.....Numerical equivalent of infinity, which is max of all C(i,j) + 10
'MinVal.......Minimum value in the cost range
'MinCol.......The column number in which MinVal occurs
'MinRow.......The row number in which MinVal occurs
'i, j, k......Loop counters
'----------------------------------------------------------------------------------Dim
Dim
Dim
Dim
Dim

cmat As Range
n As Integer
i As Integer, j As Integer, k As Integer
TCost As Single, Infinity As Single
Minval As Single, MinCol As Integer, MinRow As Integer

Set cmat = Range("costrng")


n = ___________________________________
Dim cost() As Single

' Cost () is an internal array of costs

ReDim _____________________________________
'***** Initialize Cost array, Clear red font if any, and set the value of
Infinity
Infinity = cmat(1, 1)
For i = 1 To n
For j = 1 To n
cost(i, j) = __________________________________________
cmat(i, j).Font.Color = RGB(0, 0, 0) 'Colour of font = black
If ___________________________ Then
Infinity = cost(i, j)
End If
Next j

225

Page 226 of 260

IIMA/CISG0104TEC

Next i
Infinity = Infinity + 10
______________________ = 0
'**** Make n assignments,
For k = 1 To n

each between a machine and a job

________________
__________________
__________________
'**** Scan each row
For i = 1 To n
**** Scan each column
For j = 1 To n
'*****

= Infinity
= 0
= 0

Update minval, minrow, and mincol if necessary


If ________________________________ Then
_______________________
_______________________
_______________________
End If
Next j

Next i
'****

Update TCost, and the output, and the colour of the assignment cell

TCost = _____________________________________
cmat(n + 1, MinCol) = MinRow
cmat(__________________________) = ____________________
cmat(_____________________________).Font.Color = RGB(256, 0, 0)
'**** Cross out the assigned column
For i = 1 To n
cost(_______________________) = Infinity
Next i
'**** Cross out the assigned row
For j = 1 To n
cost(__________________________________) = Infinity
Next j
Next k
cmat(____________________________) = __________________________

End Sub

226

Page 227 of 260

IIMA/CISG0104TEC

V. Appendices

The following twelve appendices (Appendix-1 to Appendix-12)


summarize functions and other features of Excel relevant for this
note. All of the information for the appendices was taken from the
Excel Help, which can be invoked by pressing the F1 key, while in
Excel. The key words to be typed for the search in the help window
are provided at the top of each appendix. Wherever necessary, the
functions are explained through examples.

227

Page 228 of 260

IIMA/CISG0104TEC

Appendix-1a: Menu Options in Excel for some important tasks


(Source: Microsoft Excel Help (F1) ribbon)
Function

Formatting:
To change the width of the column of the cursor
To insert a row above the cursor
To insert a column to the left of the cursor
To delete one or more rows
To delete one or more columns
To change row height or column width
To change the font (font type, size, style, effects etc)
To change the alignment of an cell entry (horizontal,
vertical, inclined etc, text control like wrap around)
To change the color of the characters in a cell
To change the shading (or background) color of a cell
Conditional formatting
Date formatting
Time formatting
To change date settings in windows

To change timesettings in windows

Copying and Moving:


To copy one range of cells to another (copy and Paste)
To move one range of cells to another (cut and paste)
To copy a range to another by converting formulae to
values

To select (or highlight) a specified cell or range

Menu Option(s)(Ribbon tabs,


groups, options within a group,
options appearing in a drop box, or
boxes within a form)
Home Cells Format Column
Width
Home Cells Insert Insert
sheet rows
Home Cells Insert Insert
sheet columns
Home Cells Delete Delete
sheet rows
Home Cells Delete Delete
sheet columns
Home Cells Format
Home Font
Home Cells Format Format
Cells Alignment
Home Cells Format Format
Cells Font Color
Home Cells Format Format
Cells Fill Background Color
Home Styles Conditional
formatting
Home Number Long date or
short date in drop box
Home Number Time
Start Settings Control Panel
Regional & Language options
Customize Date
Start Settings Control Panel
Regional & Language options
Customize Time
Home Clipboard
Home Clipboard
Home Clipboard
Home Clipboard
Home Clipboard
Home Clipboard
Paste values

Copy
Paste
Cut
Paste
Copy
Paste

To copy a range by converting rows to columns

Home Editing Find & Select


Go To GoTo:
Home Clipboard Copy
Home Clipboard Paste
Transpose

File Operations:
To erase the current spreadsheet and display another
spreadsheet

Office icon

open
228

Page 229 of 260

IIMA/CISG0104TEC

Function

To store current spreadsheet in a worksheet file with the


same name as before
To store the current worksheet as a worksheet with a
different name
To convert data of a text file to columns
Worksheet Operations:
To erase the entire worksheet
To set the horizontal/vertical titles so that they remain on
screen during scrolling
To set split screen horizontally or vertically
To display worksheet settings
To insert a page break above the cursor (for printing)
Range Operations (Naming, Locking etc):
To create a range name
To create a range name from names given in spread sheet
in adjacent cells of the range
To see a table of range names already existing
To switch between display of results and display of
formulae in a range

To delete a range name


To disallow changes to a range if global protection is
enabled
To enable the worksheet protection
To unprotect sheet
Database Operations:
To fill a range with a series of numbers with a starting
value and with the same given gap between successive
values
To create a data table
To re-arrange data in a range in increasing or decreasing
order of values in a column
To find all data records of a range that satisfy given
criteria
To insert a pivot table

Menu Option(s)(Ribbon tabs,


groups, options within a group,
options appearing in a drop box, or
boxes within a form)
Office icon save
Office icon

Save As

Data Data Tools


Columns
Home
all
View

Text to

Editing

Clear

Clear

Window

Freeze panes

View Window Split


Office icon Excel Options
(choose appropriate option)
Page Layout Page Setup
Breaks
Formulas Defined Names
Define Name
Formulas Defined Names
Create from selection
Formulas Defined Names
Name manager
Press together the control and grave
accent keys ( Control + `). The
grave accent and tilde symbol
occur together on the same key;
alternatively,
Formulas Formula auditiong
Show formulas
Formulas Defined names
Define name
Home Cells Lock cell
Home Cells Format Protect
sheet
Review Changes Unprotect
sheet
Fill in the first two cells; drag with
fill handle over the range to be
filled
DataWhat-if analysis Data
table
Data sort and filter sort
Data
Insert

sort & filter


Tables

advanced

Pivot table
229

Page 230 of 260

IIMA/CISG0104TEC

Function

Others:
To add an add-in
To attach/ edit a comment in a cell
Use Solver
Scenario analysis
Goal seek
To Create a macro

To edit a macro
To associate a command button with a macro

Menu Option(s)(Ribbon tabs,


groups, options within a group,
options appearing in a drop box, or
boxes within a form)
Office button Excel Options
Add-ins Manage excel add ins
Review Comments
Data Data Tools Analysis
Solver
Data Data Tools What if
analysis Scenario manager
Data data Tools What if
analysis Goal seek
View Macros Macros
Record macro; or
Developer Code Macros
Record New Macro
View Macros Macros
View macros
Developer Controls Insert
Form Controls

To include form control buttons in quick access tool Microsoft Office Button Excel
Customize
All
bar
Options
Commands in the Choose
commands from list select all
(form control)
Add click
OK.
To perform VBA operations
To output a range to printer or disk file
To create a graph
To exit Excel system

Developer Code Visual Basic


Office button Print
Insert Charts
Office button exit excel

230

Page 231 of 260

IIMA/CISG0104TEC

Appendix-1b: Keyboard Shortcuts


( Source: Microsoft Excel Help (F1 ) Excel Shortcut and function keys)
Move one cell up, down, left, or right.

Arrow keys

Move one cell to the right.

TAB

Move one cell to the left.

SHIFT+TAB

Move to the edge of the current data region (data region: A range of cells that contains data
and that is bounded by empty cells or worksheet borders.).

CTRL+arrow key

Move to the beginning of the row.

HOME

Move to the beginning of the worksheet.

CTRL+HOME

Move to the last cell on the worksheet, in the bottom-most used row of the rightmost used
column.

CTRL+END

Move down one screen.

PAGE DOWN

Move up one screen.

PAGE UP

Move one screen to the right.

ALT+PAGE DOWN

Move one screen to the left.

ALT+PAGE UP

Switch to the next pane in a worksheet that has been split (Window menu, Split command).

F6

Switch to the previous pane in a worksheet that has been split.

SHIFT+F6

While editing a cell address, to change a relative reference to absolute reference, for the
cell address immediately following the cursor (Four-way Toggle)

F4

To open Visual Basic Editor

Alt+F11

To edit the contents of an active cell

F2

Scroll to display the active cell.

CTRL+BACKSPACE

Display the Go To dialog box.

F5

Display the Find dialog box.

SHIFT+F5

Repeat the last Find action (same as Find Next).

SHIFT+F4

Move between unlocked cells on a protected worksheet.

TAB

231

Page 232 of 260

IIMA/CISG0104TEC

Appendix-2: Mathematical Functions


(Source: Microsoft Excel Help (F1) List of worksheet functions
functions)

Math and trigonometry

Excel provides a number of trigonometric functions, which are not listed in the following table.
You will note that there are some functions which yield matrices (arrays) as their output. For
entering these functions in the formula box, choose the top-left cell of the range (or array) in
which the output has to appear, block the array, type in the formula and, instead of pressing the
Enter key press control, shft and enter keys together.

Function

Format

ABS

ABS(number)

EXP

EXP(number)

FACT

FACT(number)

INT

INT(number)

ROUND

ROUND(number, number
of places to be rounded to)

LN

LN(number)

MDETERM

MDETERM(array)

MINVERSE

MINVERSE(array)

MMULT

MMULT(array1,array2)

MOD

MOD(number, divisor)

PI

PI( )

RAND

RAND( )

SQRT

SQRT(number)

Explanation
Returns the absolute value of the argument
For example
=ABS(4.5) gives 4.5
=ABS(-4.5) gives 4.5
Returns e raised to the number
Returns the factorial of the number; if the
number is not an integer, it is truncated
Rounds the number down to the nearest
integer. For example,
=INT(13.67) gives 13
=INT(-13.67) gives -14
The given number is rounded to the given
number of places after the decimal point; if
the number of places to be rounded to is
negative, the rounding takes place to the left
of the decimal point, as shown in the second
example below:
=ROUND(1456.116,2) gives 1456.12
=ROUND(1456.116,-2) gives 1500
Returns the natural logarithm of the number
Returns the determinant of the matrix
contained in the square array specified
Returns the inverse of the matrix of the
given square array. This is an array
function.
Returns the matrix that is the product of the
matrix in array1 and that in array2. This is
an array function.
Returns the remainder obtained after
dividing the number with the divisor
Returns the value of the mathematical PI,
i.e., 3.14159
Returns a random number (generated from
uniform distribution) greater than or equal
to zero and less than 1; this is reevaluated
every time a recalculation takes place in the
worksheet. If you do not want the random
number to change press F9 after entering
the function in the formula box
Returns the positive square root of the given
number
232

Page 233 of 260

IIMA/CISG0104TEC

SUM

SUM(range or array or
numbers)

SUMPRODUCT

SUMPRODUCT(array1,
array2,)

SUMIF

SUMIF(range1,criteria,
range2)

AVERAGEIF

AVERAGEIF(rangeif,crit
eria,range2)

COUNTIF

COUNTIF(range, criteria)

Returns the sum of the given values, or


those in the specified range, or array
Multiplies corresponding components of the
given arrays and returns the sum of the
products. The number of arrays can be two
or more; all arrays must consist of the same
number of cells, and should have the same
number of rows and columns.
Evaluates which cells in range1 satisfy the
criteria, and sums the corresponding cells of
range2. If range2 is not given, the sum of
cells of range1 that satisfy the criteria is
found. Criteria can be given as a number, a
string, an expression, or a reference to a cell
containing a text string. Example criteria
are: 34, >=34, >&B4,ROSE. Range1
and range2 should be of the same size.
Same as SUMIF, except that here the
average is found instead of sum
Counts the number of cells of range that
satisfy the criteria. The way the criteria is
specified is the same as that in SUMIF.

233

Page 234 of 260

IIMA/CISG0104TEC

Appendix-3: Statistical Functions


(Source: Microsoft Excel Help (F1) List of worksheet functions

Statistical functions)

The names of the statistical functions are self explanatory


Most of these operate on ranges or arrays of numbers. If any of the cells in the specified range or
array are empty, there are two ways of dealing with such cells: 1. Assume that an empty cell has
value zero, that is, there is no difference between a cell with value zero and an empty cell, 2. Ignore
an empty cell, that is, do not count it in evaluating the value of the function. Excel provides for some
standard statistics two versions of the same function, for example, AVERAGEA and AVERAGE, the
former dealing with empty cells and cells with text as if they contained value zero, cells with logical
value TRUE as if it is equal to 1, cells with logical value FALSE as if it is equal to zero, and the latter
not taking into account the empty cells. In the table below, both the versions of such functions are
described together. The differences between COUNT and COUNTA, MAX and MAXA, MIN and
MINA are similar.
Excel also provides a number of functions each dealing with computations for standard theoretical
proability distributions such as binomial distribution, exponential distribution, normal distribution,
gamma distribution and beta distribution. These functions are not described below.
Name of the
function

Arguments

AVERAGE,
AVERAGEA

Values or ranges or
arrays

CORREL

Array1, array2

COUNT,
COUNTA

Values or ranges or
arrays

FREQUENCY

Data array, bins


array

MAX, MAXA
MIN, MINA

Values, ranges or
arrays
Values, ranges or
arrays
Values, range or
array

What the function does


Returns the arithmetic mean of the specified set of
numbers. AVERAGEA takes into account even
the cells with non-numeric data; it treats text as
zero, empty cell as zero, TRUE as 1, and FALSE
as zero. AVERAGE takes into consideration only
cells with numeric entries, ignoring empty cells,
cells with text and logical values
Returns the coefficient of correlation between the
two series of values in array1 and array2
Computes the number of cells that contain
numerical values among the given set of cells. The
difference between COUNT and COUNTA is
similar to that between AVERAGE and
AVERAGEA.
Finds the frequency distribution of values given in
data array. The bins array specifies the upper limits
of each frequency interval. This is an array
function, given in a vector, whose number of
elements is one plus the number of elements in the
bins vector. The last element contains the
frequency of vales exceeding the last interval
specified by the bins array.
Largest of the given values
Smallest of the given values

PERCENTILE

Array, k

The most frequently accuring among the given set


of values
Returns the kth percentile of values in the given
array; k should be between 0 and 1 (inclusive)

PERCENTRANK

Array, x

Returns the rank of the value x in the data set

MODE

234

Page 235 of 260

RANK

STDEV,
STDEVA
STDEVP,
STDEVPA

IIMA/CISG0104TEC

Number, reference
range, order

Array
Array

VAR, VARA

Array

VARP, VARPA

Array

LARGE
SMALL

Array, k
Array, k

contained in array as a percentage of the data set


Gives the rank of the number if the reference range
were arranged in the specified order; with a value
of zero for order indicating descending order and
non-zero indicating ascending order; duplicate
values get the same rank.
Standard deviation of the given data set, assuming
that the data set is a sample
Standard deviation of the given data set, assuming
that the data set is the population
Variance of the given data set, assuming that the
data set is a sample
Variance of the given data set, assuming that the
data set is the population
k th largest value of the array
k th smallest value of the array

235

Page 236 of 260

IIMA/CISG0104TEC

Appendix-4a: Text Functions


(Source: Microsoft Excel Help (F1) List of worksheet functions

Text functions)

Within a text string, Character positions are counted from one onwards
The code number that corresponds to a character is given by ANSI character-set standards

Name of the function

Arguments

CHAR

Code number

CLEAN

Text

CODE

Text

CONCATENATE

Text1, text2,

DOLLAR

Number, decimal places

EXACT

Text1, text2

FIND

Find_text, within_text,
start_number

FIXED

Number, number of decimals,


no_commas

LEFT

Text, number_of_characters

LEN

Text

LOWER

Text

MID

Text, start_number,
number_of_characters

PROPER

Text

REPT

Old_text, start_number,
no_of_characters, new_text
Text, number_of_times

RIGHT

Text, no_of_characters

SEARCH

Same as in FIND

SUBSTITUTE

Within_text,old_text,
new_text, instance_number

Value or reference

TEXT
TRIM
UPPER
VALUE

Value, format_text
Text
Text
Text

REPLACE

What the function does


Returns the character specified by the
code number
Removes all nonprintable characters
from text
Returns a numeric code for the first
character in a text string
Joins several text items into one text item
Converts a number to text, using
currency format
Checks to see if two text values are
identical
Finds one text value within another
(case-sensitive)
Formats a number as text with a fixed
number of decimals
Returns the leftmost characters from a
text value
Returns the number of characters in a
text string
Converts text to lowercase
Returns a specific number of characters
from a text string starting at the position
you specify
Capitalizes the first letter in each word of
a text value
Replaces characters within text
Repeats text a given number of times
Returns the rightmost characters from a
text value
Finds one text value within another (not
case-sensitive)
Substitutes new text for old text in a text
string
If the value is text or reference is
pointing to text, T returns the text value;
else, T returns the empty string.
Formats a number and converts it to text
Removes spaces from text
Converts text to uppercase
Converts a text argument to a number

236

Page 237 of 260

IIMA/CISG0104TEC

237

Page 238 of 260

IIMA/CISG0104TEC

Appendix-4b: Illustration of Text Functions

S.No.
1

Name of
Function
CHAR

2
3

CLEAN
CODE

4
5
6
7

CONCATENATE
DOLLAR
EXACT
FIND

FIXED

LEFT

10

LEN

11
12

LOWER
MID

13
14
15
16

PROPER
REPLACE
REPT
RIGHT

17
18

SEARCH
SUBSTITUTE

19

20

TEXT

21

TRIM

22
23

UPPER
VALUE

Example(s)
=CHAR(65)
=CHAR(48)
=CLEAN(CHAR(65)&CHAR(7))
=CODE("A")
=CODE("ABC")
=CONCATENATE("ABC","-","DEF")
=DOLLAR(13.45,2)
=EXACT("RAMA","rama")
=FIND("IN","INDIAN INSTITUTE OF MGMNT",4)
=FIND("X","INDIAN INSTITUTE OF MGMNT",4)
=FIXED(-2435.356,2,FALSE)
=FIXED(2435.668,2,TRUE)
=LEFT("ABCD")
=LEFT("ABCD",1)
=LEFT("ABCD",2)
=LEFT("ABCD",5)
=LEN("ABC")
=LEN("")
=LEN(CHAR(8))
=LOWER("ABC")
=MID("ABCD",2,1)
=MID("ABCD",1,2)
=MID("ABCD",2,4)
=PROPER("ind inst of mngmt")
=REPLACE("IndInstofMangmnt",4,4,"Institute")
=REPT("Inst",3)
=RIGHT("ABCD")
=RIGHT("ABCD",1)
=RIGHT("ABCD",2)
=RIGHT("ABCD",5)
=SEARCH("IN","Indian Institute",3)
=SUBSTITUTE("ABACADAE","A","X",3)
=SUBSTITUTE("ABACADAE","A","X",5)
=T("123")
=T(123)
=TEXT(123,"0.00")
=TEXT(123.12,"00")
=TEXT(-123.456,"0")
=TEXT(0.2,"0.00%")
=TEXT(123.45,"General")
=TRIM(" Ind Inst ")
=TRIM(" Ind Inst ")
=UPPER("abcd")
=VALUE("12.56")
=VALUE("1A")

Result
A
0
A
65
65
ABC-DEF
Rs13.45
FALSE
8
#VALUE!
-2,435.36
2435.67
A
A
AB
ABCD
3
0
1
abc
B
AB
BCD
Ind Inst Of Mngmt
IndInstituteofMangmnt
InstInstInst
D
D
CD
ABCD
8
ABACXDAE
ABACADAE
123
123.00
123
-123
20.00%
123.45
Ind Inst
Ind Inst
ABCD
12.56
#VALUE!

238

Page 239 of 260

IIMA/CISG0104TEC

Appendix-5: ANSI Character Set


The following table presents only a sub set of the ANSI character codes. The characters indicated by
a small rectangle are non-printable ones.
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

Char






















!
"
#
$
%
&
'
(
)
*
+
,
.
/
0
1
2
3
4
5
6
7

Code Char Code Char


56
8
101
e
57
9
102
f
58
:
103
g
59
;
104
h
60
<
105
i
61
=
106
j
62
>
107
k
63
?
108
l
64
@
109
m
65
A
110
n
66
B
111
o
67
C
112
p
68
D
113
q
69
E
114
r
70
F
115
s
71
G
116
t
72
H
117
u
73
I
118
v
74
J
119
w
75
K
120
x
76
L
121
y
77
M
122
z
78
N
123
{
79
O
124
|
80
P
125
}
81
Q
126
~
82
R
127
83
S
128
84
T
129
85
U
130

86
V
131

87
W
132

88
X
133

89
Y
134

90
Z
135

91
[
136

92
\
137

93
]
138

94
^
139

95
_
140

96
`
141
97
a
142
98
b
143
99
c
144
100
d
145

146

147

148

149

150

239

Page 240 of 260

IIMA/CISG0104TEC

Appendix-6a: Date and Time Functions


(Source: Microsoft Excel Help (F1) List of worksheet functions
functions)

Date and time

In the serial number of a date, the serial number is counted from January 1, 1900; In the latest version
of Windows the last date permitted is Dec 31, 9999. The serial number of January 1, 1900 is given as
1. Serial number of time is a fraction and it indicates the fraction of the day that has elapsed from the
12.00 midnight of the day.
Name
DATE

Parameters
Year number, month
number, day number

DATEVALUE

Date text

DAY

Serial number

DAYS360

Start_date, end_date

EDATE

Start_date, month

EOMONTH

Start_date, number_of_
months

HOUR

Serial number

MINUTE

Serial number

MONTH

Serial number

NETWORKDAYS

Start_date, end_date

NOW
SECOND

Serial number

TIME
TIMEVALUE
TODAY

Hour, minute, second


Time text

WEEKDAY

Serial number

WORKDAY

Start_date, days

YEAR

Serial number

YEARFRAC

Start_date, end_date

What the function returns


Serial number of the date
Serial number of the date
represenmted by the date text
Day of the month corresponding
to the date of the serial number
Number of days between the given
two dates based on 360 days per
year method
Serial number that represents the
date that is the indicated number
of months after the start_date
Serial number of date for the last
day of the month that is away
from the given date by the given
number of months
Hour corresponding to the serial
number
Minutes corresponding the serial
number
Month number corresponding to
the date of the serial number
Number of whole working days
between start_date and end_date
Serial number of current date and
time
Seconds corresponding the serial
number
Serial number of the given time
Serial number of time
Serial number of the current date
Day of the week corresponding to
the serial number
Serial number of the date which is
away from the start_date by the
given number of work_days
Year number of the date
corresponding to the date of the
serial number
Fraction of the year between the
given two dates

240

Page 241 of 260

IIMA/CISG0104TEC

Appendix-6b: Illustration of Date and Time Functions


Shown below is the range B4:F6 of a spreadsheet in which a number of date and time values are
given. These are referred to in the various date and time formulae of the next table. Assume that
the following short-date and time formats were chosen in the regional date and time settings of the
windows control panel:
Short Date: dd/mm/yyyy
Time: HH:mm:ss
B C
D
E
F
4
20/07/2010
01/01/1900
11/01/1900 01/01/1900 18:45:40
5
20/07/2010 15:25:32
6
17/7/2010
Illustrative Functions
S.No.

Function

Result

=DAY(E4)

11

2
3

=MONTH(E4)
=YEAR(D4)

=HOUR(F4)

18

=MINUTE(F4)

45

=SECOND(F4)

40

=WEEKDAY(E4)

=WEEKDAY(E4,2)

=DATE(1900,1,3)

10

=DATEVALUE("3/1/1900")

11

=DAYS360(DATEVALUE("1/1/190
1"),DATEVALUE("1/3/1902"))

12

=EDATE(B4,3)

20/10/2010

13

=EOMONTH(B4,3)

31/10/2010

14

=NETWORKDAYS(B6,B4)

15

=NETWORKDAYS(B6,B4,DATE(2
010,7,19))

1
1900

420

What the formula/its result mean


In the date given in cell E4, the day number within the
month is 11
In the date given in cell E4, the month number within
the year is 1; that is, the month is January
In the date given in cell E4, the year number is 1900
The hour field of the time value given in cell F4 has the
value 18
The minutes field of the time value given in cell F4 has
the value 45
The seconds field of the time value given in cell F4 has
the value 40
The date given in cell E4 fell on the fourth day of its
week, counting the days of the week starting with
Sunday as 1; that is the date fell on Wednesday
The date given in cell E4 fell on the third day of its
week, counting the days of the week starting with
Monday as 1; that is the date fell on Wednesday
The date whose year is 1900, month is 1, and day 3 has
the serial number 3, counting from 1st Jan 1900 as 1.
The string 3/1/1900 is converted to the date whose
serial number is 3, ie to the date 3 January, 1900.
The number of days between the dates 1/1/1901 and
1/3/1902, including the two dates, is 420, using the rule
that every month has 30 days, and every year 360 days(
the system is called 30/360)
The date that is three months after the date given in cell
B4; As B4 has 20 July 2010, the result is 20 October
2010
The date of the end of the month of the date that is three
months after the date given in cell B4; As the date three
months after 20 July 2010 is 20 Oct 2010, the result of
the formula is 31 Oct 2010
B6 has 20/7/2010, and B4 has 17/7/2010. 20 July 2010
falls on Tuesday and 17 July 2010 falls on Saturday;
thus 17 July and 18 July form a weekend. Thus, the
number of work days, that is days which do not fall on a
weekend nor on other holidays if any (specified as the
third parameter of the function) is 2
This function is the same as the above, except that it has
a third parameter containing the date 19 July 2010,
which means 19 July 2010, Monday, is a holiday.
241

Page 242 of 260


S.No.

16

Function

=YEARFRAC(B4,B6)

IIMA/CISG0104TEC
Result

0.00833333
3

What the formula/its result mean


Hence the number of work days between 20 July 2010
and 17 July 2010 is 1.
The number of days between 17 July 2010 and 20 July
2010, which is 4, represents 0.008333 of an year, under
the system 30 days per month and 360 days per year. If
you want to use another system the third parameter of
the function needs to be specified; para meter values
1,2,3 correspond to actual/actual, actal/360,actual/365
systems.

242

Page 243 of 260

IIMA/CISG0104TEC

Appendix-7: Database functions


(Source: Microsoft Excel Help (F1) List of worksheet functions

Database functions)

Each function in this category has three arguments: the reference to a database range including the
titles row, field number or title corresponding to the field or a cell address which contains the title
of the field on which the function has to operate, criteria range that specifies the condition for
selection of records from the database. If instead of a field number, the field title is given, then the
field title needs to enclosed in double quotes. Each function selects the records from the given
database according the criteria given in the criteria range and computes something using the
values in the specified field of the selected records. The functions SUMIF and COUNTIF, already
described in Appendix-2, are somewhat similar to (but not identical to) DCOUNT and DSUM.

Name
DAVERAGE
DCOUNT
DGET
DMAX
DMIN
DPRODUCT
DSTDEV
DSTDEVP
DSUM
DVAR
DVARP

Value returned from the selected records


Average of the values in the field
No. of non-blank cells of the field, if the field number is specified.
If the field number is not specified, the function simply returns the
number of records that satisfy the criteria.
The value contained in the cell corresponding to the field, if only
one record is selected; otherwise, error.
Largest number among all cells in the field
Smallest number among all cells in the field
Product of values in all cells of the field
Standard deviation of values the population, of which the values in
the field form a sample
Same as above, except that the values in the field are assumed to be
the population
Sum of values in the field
Variance of the population, of which the values in the field form a
sample
Variance of the population of values in the field

243

Page 244 of 260

IIMA/CISG0104TEC

Appendix-8: Lookup Functions


(Source: Microsoft Excel Help (F1) List of worksheet functions
functions)

Lookup and reference

In the following functions wherever, sorted order of values is required, assume that the sorted
order for the different characters and values in ascending order is -2,-1,0,1,2,3,,AZ,FALSE,TRUE. Capital case text and small case text are treated equivalent in matching.
Name of
function

Arguments

CHOOSE

Index_number,
value1,value2,

HLOOKUP

Lookup_value,
look_up_array,
row_index_number,
Range_lookup
(optional)

VLOOKUP

Lookup_value,
lookup_array,
column_index
number,
Range_lookup
(optional)

1. Array format:
Array, row_number,
column_number
INDEX

2. Reference format:
reference to one or a
list of arrays, row
number, column
number,
area_number

What it returns
From the given list of values, the value in the position
indicated by index_number. The Index number should
refer to a value between 1 and 29; the values in the list
could be constants, or references to cells or ranges.
Searches for the lookup_value in the top row of the
array, from the column containing the matching value,
returns the value in the row specified by the
row_index_number.
Range_lookup can be TRUE or FALSE. If it is omitted,
the default is TRUE. A TRUE value for Range_lookup
means an approximate match is acceptable. That is, the
values in the first row should be in the ascending order
from left to right, and the largest value less than or equal
to the look_up value is taken to be the matching value. If
the value of Range_lookup is FALSE, the values of the
first row need not be in the sorted order; the value that is
exactly equal to the lookup value is taken to be the
matching value. If there is no matching value an error
message is returned. While matching, lower and upper
case letters are not distinguished.
Same as above except that the search is done vertically
in the first column, and if a matching row is is found, the
result is returned from the column corresponding to the
column_index_number. The Range_lookup is TRUE or
FALSE and it works in a way similar to that in
HLOOKUP. If TRUE or omitted, an approximate match
is done in the lookup array; ie, the largest value less than
or equal to the lookup value is taken as the matching
value. In this case, the values in the first column of
lookup array should be in ascending order; If
Range_lookup is FALSE, the values in the first column
of lookup array need not necessarily be in ascending
order, and the value exactly equal to the lookup value is
taken as the matching value. Other rules are also similar
to those in HLOOKUP.
1. Array format: Returns the value at the intersection of
the specified column and row of the array, if the array is
two dimensional. If the array is one-dimensional, only
the column or row number, whichever is applicable, can
be given. If the number of column (or row) is given as
zero, an entire row(or column) is returned as array, in
which case the function needs to be typed in as an array
function.
2. Reference format: Returns only a reference of the cell
corresponding to the row and column numbers of the
244

Page 245 of 260

Name of
function

LOOKUP

IIMA/CISG0104TEC

Arguments

Format 1 (Vector
format):
Lookup_value,
lookup_vector,
result_vector
Format-2 (array
format):
Lookup_value,
Array

MATCH

Lookup value,
lookup vector,
Match type (-1,0, or
1).
Match type is
optional.

OFFSET

Range or cell
reference, no of
rows, no of
columns, height,
width

INDIRECT

Reference text, a
logical value

What it returns
specified array, given through the area_number, in the
list of arrays given through the first parameter. The cell
reference output by this function is inturn used normally
by another function as an input parameter.
Vector format: Finds the position of the lookup_value in
the lookup_vector, and returns the value in the
corresponding position of the result_vector. The result
and lookup vaectors should be of the same length, but
they need not be of the same orientation: one can be a
row and the other a column. Lookup vector should have
values in ascending order.
Array format:
Case 1. The array has more columns than rows. The
matching value is searched for in the first row, and the
value in the corresponding position from the last row is
returned.
Case 2: The array has columns less than or equal to
rows. The matching value is searched for in the first
column, and the value in the corresponding position of
the last column is returned.
In both cases, the values in the first row (or column) are
assumed to be in increasing order, and an approximate
match is made like in other functions.
Relative position of the lookup value in the lookup
vector. If match type is -1, the matching value is taken to
be the smallest value greater than or equal to the lookup
value, and the vector is assumed to be sorted in
descending order. If the match type is 1 (which is the
default), the vector is assumed to be in the ascending
order, and the matching value is the largest value less
than or equal to the lookup value. If the match type is
zero, matching value is the value that is exactly equal to
the lookup value; in this case, the vector need not be
sorted.
Returns a range (or cell) reference, which is a specified
no of rows and columns away from the given reference
cell or the top-left cell of the given reference range; if
the returned reference is a range it will have the given
height and width. This function can be used as a
parameter that is a range within another function such as
SUM, AVERAGE, VLOOKUP , and LINEST. If the
number of rows is positive, you are saying that the
returned reference should be below the given reference,
and if it is negative, the returned reference is above the
given reference; similarly, positive number of columns
indicate an offset to right, and negative an offset to right.
The default height and width are the height and width of
the given reference. If OFFSET is used by itself, and not
as a parameter within another function, the result will be
the value of the returned reference.
The reference text is interpreted as a cell reference
which contains in turn another cell reference whos value
245

Page 246 of 260

Name of
function

IIMA/CISG0104TEC

Arguments
indicating whether
the cell referred to
has A1 type
reference or
not(default is
TRUE)

What it returns
is needed.
For example suppose cell B1 has value 1 and cell C1 has
value 2. Further suppose cell A1 has the text B1, and A2
the text C1. Suppose in D1 you enter the function
=indirect(A1)+Indirect(A2). It will be interpreted as B1
+ C1 and therefore be evaluated as 1+2 and the result in
cell D1 would be 3.
As another example, consider using INDIRECT in a
spreadsheet with R1C1 cell referencing. Suppose using
Excel Options Formulas R1C1 reference style, you
have chosen R1C1 style in the spreadsheet. Suppose
cells R1C5 and R2C5 consist of the entries R1C7 and
R2C7 respectively. Suppose the cells R1C7 and R2C7
consist of the values 3 and 4 respectively. If in cell
R1C8
the
formula
=INDIRECT(R1C5,False)+INDIRECT(RC5) is entered,
it would yield the result 7.

246

Page 247 of 260

IIMA/CISG0104TEC

Appendix-8a. Illustration of Lookup Functions

2
3
4
5
6

10

15

30

100

150

1.5

15

5.9

2.5

25

4.8

4.8

48

2.5

5.9

59

1.5

The above figure shows the values in the range J2:N6 of a spreadsheet. The various Lookup functions are
illustrated below, with formulae that refer to the values of the above range.

S.No.

Formula

Result

=CHOOSE(3,L3,L4,L5,L6)

=CHOOSE(3,SUM(J3:J6),MAX(J4:J6),MIN(M3:M6))

1.5

=SUM(CHOOSE(2,J3:J6,K3:K6,M3:M6))

147

=INDEX(M3:M6,2)

4.8

=INDEX(J3:N3,3)

=INDEX(K3:M6,3,3)

2.5

=SUM(INDEX(K3:M6,0,3))

14.7

=MAX(INDEX(J3:K6,INT(INDEX(J3:J6,3)),0))

59

=INDEX(K3:K6,5)

#REF!

10

=INDEX((J3:J6,M3:M6,K3:K6),4,,2)

1.5

11

=MATCH(2.5,M3:M6,0)

12

=MATCH(4.95,J3:J6,0)

#N/A

Meaning of the formula


From the four-cell list L3,L4,L5,L6,
find the value in the third, ie the
value in cell L5.
From the list of three actions given,
perform the third, ie MIN(M3:M6)
Choose the second range in the list of
three ranges and SUM it, ie find the
sum of K3:K6
Find the second value in the given
vector M3:M6
rd
Find the 3 value in the vector J3:N3
Find the value at the intersection of
rd
rd
3 row and 3 column of the array
K3:M6, the value of M5
Find the sum of the third column of
the array K3:M6, ie the sum of
M3:M6
Find the maximum of a certain row in
the array J3:K6; the row number is
given by the integer part of the third
value of J3:J6, the value of J5. The
integral part of the value in J5 is 4.
Hence maximum of the fourth row of
J3:K6 is to be found, ie the maximum
of J6:K6, which is 59.
Find the fifth value in the vector
K3:K6 ( and return an error message
if the value cannot be found)
Find the value in the 4th position of
the second vector of the list J3:J6,
M3:M6,K3:K6.
In the vector M3:M6, find the
position of 2.5 (using exact match)
In the vector J3:J6, find the position
of 4.95 using exact match ( and
return an error message if the match
does not succeed)
247

Page 248 of 260

IIMA/CISG0104TEC

S.No.

Formula

Result

13

=MATCH(4.95,J3:J6,1)

14

=MATCH(4.8,J3:J6,1)

15

=MATCH(10.5,J3:J6,1)

16

=MATCH(1.4,J3:J6,1)

#N/A

17

=MATCH(6.2,M3:M6,-1)

#N/A

18

=MATCH(5.9,M3:M6,-1)

19

=MATCH(4.81,M3:M6,-1)

Meaning of the formula


In the vector J3:J6, find the position
of the interval (or range) to which
4.95 belongs; the values of J3:J6 are
given in ascending order, and each
represents the lower bound of the
interval corresponding to the
respective position.
In the vector J3:J6, find the position
of the interval (or range) to which 4.8
belongs; the values of J3:J6 are given
in ascending order, and each
represents the lower bound of the
interval corresponding to the
respective position.
In the vector J3:J6, find the position
of the interval (or range) to which
10.5 belongs; the values of J3:J6 are
given in ascending order, and each
represents the lower bound of the
interval corresponding to the
respective position.
In the vector J3:J6, find the position
of the interval (or range) to which 1.4
belongs; the values of J3:J6 are given
in ascending order, and each
represents the lower bound of the
interval corresponding to the
respective position. As 1.4 is less than
the very first value of J3:J6,, an error
message results.
In the vector M3:M6, find the
position of the interval (or range) to
which 6.2 belongs; the values of
M3:M6, and hence the
corresponding intervals, are in
descending order, and each value
represents the upper bound of the
interval corresponding to the
respective position.
In the vector M3:M6, find the
position of the interval (or range) to
which 5.9 belongs; the values of
M3:M6, and hence the
corresponding intervals, are in
descending order, and each value
represents the upper bound of the
interval corresponding to the
respective position.
In the vector M3:M6, find the
position of the interval (or range) to
which 4.81 belongs; the values of
M3:M6, and hence the
corresponding intervals, are in
descending order, and each value
represents the upper bound of the
interval corresponding to the
248

Page 249 of 260


S.No.

20

IIMA/CISG0104TEC
Formula

=MATCH(2.4,M3:M6,-1)

Result

Meaning of the formula


respective position.
In the vector M3:M6, find the
position of the interval (or range) to
which 2.4 belongs; the values of
M3:M6, and hence the
corresponding intervals, are in
descending order, and each value
represents the upper bound of the
interval corresponding to the
respective position.

249

Page 250 of 260

IIMA/CISG0104TEC

S.No.

Formula

Result

21

=MATCH(1.49,M3:M6,-1)

22

=MATCH(-5.5,M3:M6,-1)

23

=VLOOKUP("D",L3:N6,3,FALSE)

24

=VLOOKUP("D",L3:N6,2,FALSE)

1.5

25

=VLOOKUP(25.5,K3:N6,2,TRUE)

26

=VLOOKUP(100,K3:N6,2,TRUE)

27

=HLOOKUP(A,J3:N6,3,FALSE)

28

=HLOOKUP(25,J4:N6,2,FALSE)

48

Meaning of the formula


In the vector M3:M6, find the
position of the interval (or range) to
which 1.49 belongs; the values of
M3:M6, and hence the
corresponding intervals, are in
descending order, and each value
represents the upper bound of the
interval corresponding to the
respective position.
In the vector M3:M6, find the
position of the interval (or range) to
which -5.5 belongs; the values of
M3:M6, and hence the
corresponding intervals, are in
descending order, and each value
represents the upper bound of the
interval corresponding to the
respective position.
Find the position of D in the first
column of L3:N6, ie in L3:L6.
Whatever is the content of the cell in
rd
the corresponding position of the 3
column of L3:N6, ie in N3:N6, is the
result. The lookup should be exact.
Find the position of D in the first
column of L3:N6, ie in L3:L6.
Whatever is the content of the cell in
the corresponding position of the
2nd column of L3:N6, ie in M3:M6, is
the result. The lookup should be
exact.
Find the position of the interval (or
range) to which 25.5 belongs in the
first column of K3:N6, ie in K3:K6.
Whatever is the content of the cell in
the corresponding position of the
2nd column of K3:N6, ie in L3:L6, is
the result. The values in the first
column are in ascending order, and
so should be the corresponding
intervals, assuming that the value in
the first column specifies the lower
bound of the corresponding interval.
Find the position of 100 in the first
column of K3:N6, ie in K3:K6.
Whatever is the content of the cell in
rd
the corresponding position of the 2
column of K3:N6, ie in L3:L6, is the
result. It is a range lookup.
Find the position of A in the first
row of J3:N6, ie in J3:N3; the value in
rd
the corresponding position of the 3
row is the result. Use exact lookup.
Find the position of 25 in the first
row of J4:N6, ie in J4:N4; the value in
250

Page 251 of 260

IIMA/CISG0104TEC

S.No.

Formula

Result

29

=HLOOKUP(20,J2:N6,3,TRUE)

25

30

=HLOOKUP(175,J2:N6,3,TRUE)

31

=HLOOKUP(5,J2:N6,3,TRUE)

#N/A

32

=LOOKUP(2.7,J2:J6,N2:N6)

33

=LOOKUP(120,J2:N2,J6:N6)

1.5

34

=LOOKUP(60,K3:N6)

35

=LOOKUP(15.5,J2:N4)

25

36

=LOOKUP(3,J2:L6)

37

=OFFSET(K2,2,3)

38

=SUM(OFFSET(K2,2,2,3,1))

8.8

Meaning of the formula


rd
the corresponding position of the 2
row is the result. Use exact lookup.
Find the position of 20 in the first
row of J2:N6, ie in J2:N2; the value in
rd
the corresponding position of the 3
row is the result. Use range lookup.
Find the position of 175 in the first
row of J2:N6, ie in J2:N2; the value in
rd
the corresponding position of the 3
row is the result. Use range lookup.
Find the position of 5 in the first row
of J2:N6, ie in J2:N2; the value in the
rd
corresponding position of the 3 row
is the result. Use range lookup.
Find the position of 2.7 in the vector
J2:J6, using the interval lookup
procedure (the values of J2:J6 are in
ascending order); take the result
from the corresponding position of
N2:N6.
Find the position of 120 in the vector
J2:N2, using the interval lookup
procedure (the values of J2:N2 are in
ascending order); take the result
from the corresponding position of
J6:N6.
LOOKUP in the array format. In the
lookup array, the number of columns
is equal to number of rows. Find the
position of 60 in the first column of
the array K3:N6, ie in the column
vector K3:K6, using the ascending
order interval( or range) lookup
procedure; and take the result from
the corresponding position of the last
column, ie from the column vector
N3:N6.
LOOKUP in the array format. In the
LOOKUP array, the number of
columns is greater than number of
rows. Find the position of 15.5 in the
first row of J2:N4, and the result is in
the corresponding position of the last
row of J2:N4
LOOKUP in the array format. In the
lookup array, the number of rows is
greater than number of columns.
Find the position of 3 in the first
column of J2:L6, and take the result
from the corresponding position of
the last column
Find the value two rows below and
three columns to the right of the cell
K2,ie the value in cell N4.
Find the cell two rows below and two
251

Page 252 of 260

IIMA/CISG0104TEC

S.No.

Formula

Result

39

=OFFSET(J2,2,3)

4.8

40

=INDEX(OFFSET(K2,2,2,3,2),2,2)

Meaning of the formula


columns to the right of cell K2; with
the cell as the top left corner cell
consider the range with three rows
high, and one column wide, and find
its sum; ie find the sum of the range
M4:M6.
Find the value in the cell which is two
rows below and three columns to the
right of the cell J2; ie find the value of
the cell M4.
Consider the range with the following
attributes: starting cell is the cell
which is two rows below and two
columns to the right of cell K2,
number of rows in the range is 3, and
number of columns 2; that is,
consider the range M4:N6. In this
nd
range find the value in the 2 row
nd
and 2 column, ie the value in the
cell N5.

252

Page 253 of 260

IIMA/CISG0104TEC

Appendix-9: Some Excel functions whose inputs and/or outputs are arrays.
(Source: Microsoft Excel Help (F1) List of worksheet functions Math and trigonometry
functions)
S.No.

1.

2.
3.

4.

5.

6.

7.

8.

9.

Function

Explanation
Matrix multiplication of the two arrays
array1 and array2 in that order. The
MMULT(array1,array2)
dimensions of array1 and array2 should
be such that matrix multiplcation is
possible.
Inverse of the matrix specified by array.
MINVERSE(array)
It should be invertible.
Transpose of the matrix specified by
TRANSPOSE(array)
array.
Fits a regression using KnownYs and
KnownXs. Finds the projected Ys
corresponding to NewXs. If Const is
TREND(KnownYs,KnownXs,NewXs,Const)
TRUE the regression is estimated with a
constant; otherwise the constant is
assumed to be zero.
Fits a regression between KnownY's and
FORECAST(X,KnownYs,KnownXs)
KnownX's and finds the estimated vale
for X
Estimates a regression equation between
Y whose known values are given in a
vector KnownYs, and one or more
independent variables whose values are
given in a vector or matrix
KnownXs.Const and Stats are logical
constants, that is they should contain
LINEST(KnownYs,KnownXs,Const,Stats)
TRUE or FALSE values. If Const is
TRUE, the regression is estimated with
a constant; if Stats is TRUE all
regression statistics are prited. This is to
be entered as an array formula, in a
range of the follwing size: Number of
columns = no. of independent variables
+ 1; number of rows = 5.
For each pair of corresponding values in
SUMX2MY2(arrayX,arrayY)
array X and array Y, finds difference of
squares and sums the the differences.
For each pair of corresponding values in
SUMX2PY2(arrayX,arrayY)
array X and array Y, finds the sum of
squares, and sums the sum
For each pair of corresponding values in
SUMXMY2(arrayX,arrayY)
array X and array Y, finds the
difference, squares it and sums the result

253

Page 254 of 260

IIMA/CISG0104TEC

Appendix-10: IS Functions
(Source: Microsoft Excel Help (F1) List of worksheet functions

Information functions)

All the following functions are concerned with checking whether the value in the specified cell is
of the given type. Each function returns TRUE or FALSE. The parameter of each can be a
specific vale or a reference to a cell
S.No.

Function

1.

ISBLANK(value)

2.

ISERR(value)

3.

ISERROR(value)

4.

ISLOGICAL(value)

5.

ISNA(value)

6.

ISNONTEXT(value)

6.

ISNUMBER(value)

7.

ISREF(value)

8.

ISTEXT(value)

Explanation
Is the given value, or the value in the given cell,
blank?
Is the given value or the value in the given cell an
error message except #N/A?
Is the given value or the value in the given cell any
error message including #N/A?
Is the given value or the value in the given cell a
logical value?
Is the given value or the value in the given cell the
error message #N/A?
Is the given value or the value in the given cell
anything other than text?
Is the given value or the value in the given cell a
number?
Is the given value or the value in the given cell a
reference?
Is the given value or the value in the given cell a
text?

254

Page 255 of 260

IIMA/CISG0104TEC

Appendix-11: Error Codes


(Source: Microsoft Excel Help (F1) List of worksheet functions
basics Correcting formulas)

S.No.
1.
2.
3.
4.
5.
6.
7.
8.

Error Code
######
#DIV/0!
#N/A!
#NAME!
#NULL!
#NUM!
#REF!
#VALUE!

Formula and name

Explanation
Negative date or time, or column not wide enough
Division of a number by zero
A value required is not available
Some text is not recognizable
The area of overlap between two ranges is null
Invalid numeric values
Invalid cell or range reference
Wrong type of operator or argument

255

Page 256 of 260

IIMA/CISG0104TEC

Appendix-12: Solver Options


(Source: Microsoft Excel Help (F1) Solver Options)
S.No.
1

Option
Max time

Explanation
Limit on the time taken by the solution process. The
computation will stop automatically if a solution is
not found within the maximum time limit.

Default
100
sec

Iterations

Maximum number of iterations permitted

100

Precision

1.0E-6

Tolerance

Convergence

Assume linear
model

Assume nonnegative

Used in checking the feasibility of constraints and


bounds. Should be a number between 0 and 1,
preferably between 1.0E-4 and 10E-8. The lower
this value the higher the precision.
For example let a constraint be f(x) =k, and let x0
be a solution. Then the above constraint is
considered satisfied if
|f(x0-k| precision
This specifies how close should be the value of the
objective function at the time of stopping, to the real
objective function.. Let x0 be the solution vector
that satisfies all constraints. Let z(x0) be the value
of the objective function for x0. Let x* be the real
optimal solution vector and let z(x*) be the value of
the optimal objective function. Then solver stops at
x0 if |{(z(x0)-z(x*)}/z(x*)| tolerance.
Eventhough the value zero for tolerance leads to the
real optimal solution, it would also cause the
solution process to take an extremely long period of
time.
Let Z be the current objective value, and let
z1,,Z5 be the objective value for the last five
iterations. If |{z-zi}/zi| <= convergence for i =
1,2,,5 then solver stops with Z as the optimal
value.
If linear model is assumed( that is, constraints and
objective function are linear), then simplex method
is used for solving; If the problem is integer
programming, then simplex is used for solving the
problem at each node;if this option is not chosen ,
then GRG2 algorithm ( Generalized Reduced
Gradient Algorithm 2) is used, which is slow for
LPs, compared to simplex method. It is not
compulsory for you to choose this option if your
problem is an LP; it is only a question of efficiency
and accuracy.
Applicable only for variables whose lower bounds
are not specified in constraints.

Use autoscaling

In the objective function and constraints, if the


coefficients are of widely different magnitudes ( for
examples if one is in billions and the other is a
minute fraction),normal arithmetical operations on
the coefficients might lead to serious numerical
inaccuracies. To prevent such inaccuracies, autoscaling option can be used. This would scale the
coefficients to prevent numerical inaccuracies.

Relevance
Relevant for all
types of
problems: LP,
mixed integer,
and non-linear
programs
Relevant for all
types of
problems
Relevant for all
types of
problems

0.05

Relevant for
mixed integer
programs.

0.0001

Relevant for
only non-linear
problems

Relevant for LP,


and MIP.

Relevant for all


types of
problems
Relevant to all
types of
problems

256

Page 257 of 260

IIMA/CISG0104TEC

S.No.

Option

Explanation
However an inverse operation is applied when the
final results are presented to the userso that the
results are in the original units.
If this option is chosen, the solver pauses at the end
of each iteration and displays the current solution on
the spreadsheet.
Method for estimating initial values of basic
variables

Show iteration
results

10

Estimates:
Tangent,
Quadratic

11

Derivatives:
Forward,
Central

Method for estimating partial derivatives of


objective function and constraints

12

Search:
Newton,
Conjugate

Method for determining the direction to search at


each iteration

Default

Relevance

Relevant only
for non-linear
programs (ie
when using
GRG2)
Relevant only
for non-linear
programs (ie
when using
GRG2)
Relevant only
for non-linear
programs (ie
when using
GRG2)

257

Page 258 of 260

IIMA/CISG0104TEC

Appendix-13: Normal Distribution Functions


(Source: Microsoft Excel Help (F1

Normal distribution)

There are two main functions, Normdist and Norminv, the first to find the value of cumulative
distribution function, given the value of a normal variate, and the second to find the value of a
normal variate, given the value of the cumulative distribution function. Normdist can also be
used to find the value of the probability density function for a given value of the variate, by
setting the value of the last parameter suitably. Although Normdist and Norminv can be used to
deal with a normal distribution with any given mean () and standard deviation ( ), ttwo special
functions Normsdist and Normsinv are provided to deal with the standard normal distribution ( ie
normal distribution with = 0, and = 1). The parameters associated with these functions are
described below:
1. Normdist ( x, , , CDF ): x is the value of the normal variate; is the mean of the normal
distribution; is the standard deviation of the normal distribution; CDF is a Boolean constant: if
TRUE or 1 is entered for CDF, it means you want the function to compute the value of the
cumulative distribution function at x; if FALSE, it means you want the function to compute the
value of the probability density function at x.
To further clarify,
Normdist ( x, , , TRUE ): given the value of a normal variate x following a normal distribution
with mean and standard deviation , to find the value of the cumulative distribution function at x ,
to find the probability that the random variable in question takes a value < = x
Normdist ( x, , , FALSE ): given the value of a normal variate x following a normal
distribution with mean and standard deviation , to find the value of the cumulative distribution
function at x , to find the probability density function at x, that is to find the y- coordinate of the
normal curve when the X-coordinate has value x.
2. Norminv ( p, , ): For the normal distribution with mean and standard deviation, find the
value x of the variate, such that the value of the cumulative distribution function at x is p; that is,
the probability of the normal variate taking a value less than or equal to x is p. p needs to be
between 0 and 1, otherwise an error will result.
3. Normsdist ( x, CDF ): For a standard normal distribution to compute the cumulative
distribution function or probability distribution function at x, depending on whether CDF is
TRUE or FALSE, more specifically,
Normsdist ( x, TRUE ): For the standard normal distribution, to find the value of the cumulative
distribution function at x
Normsdist ( x, FALSE ): For the standard normal distribution, to find the value of the probability
density function at x
Normsdist(x,CDF) is the same as Normdist(x,0,1,CDF)
4. Normsinv ( p ): For a the standard normal distribution, to find the value x of the the variate
such that the cumulative distribution has the given value p at x; p needs to be between 0 and 1,
otherwise an error will result.

258

Page 259 of 260

IIMA/CISG0104TEC

Examples of the built-in functions for the normal distribution


S.No.
1

Function
Normdist(3,0,1,TRUE)

Result
0.99865

Normdist(-3,0,1,TRUE)

0.00135

Normdist(0,0,1,TRUE)

0.5

Normdist(0,0,1,FALSE)

0.398942

Normdist(3,0,1,FALSE)

0.004432

Normdist(-3,0,1,FALSE)

0.004432

Normdist(12,10,2,TRUE)

0.841345

Normdist(14,10,2,TRUE)

0.97725

Norminv(0.99865,0,1)

2.9999977

10

Norminv(0.99865,10,2)

15.99995

11

Norminv(0.5,0,1)

-1.4e-16

12

Normsdist(0,True)

0.5

13

Normsinv(0.5)

Meaning of the result


For a standard normal
distribution, the area under the
curve to the left of x=3 is
0.99865
For a standard normal
distribution, the area under the
curve to the left of x=-3 is
0.00135
For a standard normal
distribution, the area under the
curve to the left of x=0 is 0.5;
ie half the area is to the left of
0.5
The height of the standard
normal curve at x=0 is
0.398942
The height of the standard
normal curve at x=0 is
0.004432
The height of the standard
normal curve at x=0 is
0.004432
For the normal distribution
with mean=10, and standard
deviation =2, area under the
curve to the left of x = 12 is
0.841345
For the normal distribution
with mean=10, and standard
deviation =2, area under the
curve to the left of x = 14 is
0.97725
The value of x such that the
area to the left of x under a
standard normal curve is
0.99865 is 2.999977
The value of x such that the
area under the normal curve
for the normal distribution
with mean 10 and standard
deviation 2 to the left of x is
0.99865, is 15.99995
For the standard normal
distribution the value of x such
that the area of the curve to the
left of x is 0.5 is approximately
zero
The area to the left of 0 under
a standard normal curve is 0.5
The value of x such that the
area under the standard normal
curve to the left of x is 0.5 is 0

259

Page 260 of 260

IIMA/CISG0104TEC

260