0% found this document useful (0 votes)
35 views18 pages

Null 1

This document provides an overview of topics that will be covered in an Excel Basics for Engineering course, including: - Data input and manipulation - Built-in and user-defined functions - Data plotting - Using the Solver and GoalSeek tools to find roots of equations and for linear/non-linear regression - Formatting cells and printing spreadsheets It then provides instructions and exercises for students to practice basic Excel skills like entering data, using relative and absolute cell references, writing formulas, and performing simple calculations. The exercises illustrate how to organize and present data in a spreadsheet for reporting purposes.

Uploaded by

Kimmmmy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views18 pages

Null 1

This document provides an overview of topics that will be covered in an Excel Basics for Engineering course, including: - Data input and manipulation - Built-in and user-defined functions - Data plotting - Using the Solver and GoalSeek tools to find roots of equations and for linear/non-linear regression - Formatting cells and printing spreadsheets It then provides instructions and exercises for students to practice basic Excel skills like entering data, using relative and absolute cell references, writing formulas, and performing simple calculations. The exercises illustrate how to organize and present data in a spreadsheet for reporting purposes.

Uploaded by

Kimmmmy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Computational Methods for Chemical

Engineering

CHEN10050

Excel Basics for Engineering

Department of Chemical Engineering and Analytical


Science

2020/21
CHEN10050 Excel Basics for Engineering 2020/21

Topics covered:
• Data input and manipulation
• Built-in and user-defined functions
• Data plotting
• Roots of equations using the Solver/GoalSeek tools
• Linear and non-linear regression with plots and the Solver tool

1
CHEN10050 Excel Basics for Engineering 2020/21

1 Spreadsheeting Exercises
1.1 Introduction
A spreadsheeting package such as Microsoft Excel can help you with many aspects of your course.
Amongst other things, it can organise data, perform calculations and draw graphs for use in reports.
The exercises illustrate some of the things that might prove useful in connection with, say, your maths,
laboratory and project courses.
Save your files on MyDocuments or anywhere you can easily access the files because during
the online assessment you will allowed to use them to solve the exercises.

You are reminded that work submitted for assessment must be the result of your own efforts.

1.2 Using Excel


• Excel is available from the Windows Start button -> All programs -> Microsoft Office .
• Figure 1 shows a typical Excel window.

1.3 Printing your results


Although you have not got any results yet, it is important to think about printing them. If you plan ahead,
the spreadsheet layout can usually be organised to give a pleasing appearance when printed.
The secret of successful printing is to design your spreadsheet from the outset to fit A4 paper. A4 paper
is 21 cm wide by 29.7 cm long. A left margin of at least 2.5 cm is usually required to allow for binding,
hole punching, etc. The right margin should be at least 1 cm and top and bottom margins about 2.5 cm
each. The effective printing area is thus no more than about 17.5 cm by 25 cm. It is usually the width
restriction that causes the most trouble. Although Excel allows landscape printing (that is, the paper is
turned sideways), it is preferable to use portrait layout in reports if possible. The following simple
guidelines may help:

• Keep column headings concise - use multiple rows rather than wide columns. As an alternative,
Excel has ways of rotating text and wrapping it to fit available column width. Right click on the cell,
choose Format cells.., then Alignment to see the options available.
• Do not use too many decimal places in number formats.
• Use the Format, Column, Autofit selection sequence of menu bar commands (Page Layout) to match
column widths to column contents. Beware of the effect of long titles. Restrict the fit to particular cells
by highlighting them. Long titles in a single cell of the column will automatically overflow into adjacent
empty cells.
• Arrange the information flow to be vertical rather than horizontal. Page breaks are more natural that
way.
• Always use the Preview facility to check that the results are what you expect.
• Include your name on each page of output. This makes it easier to find your output among lots of
other similar output. You can use a Header or Footer (a bit of text that automatically appears at the
top or bottom of every page) for this purpose. (In Excel, see Page Layout, and click on the small
arrow on the right of “Sheet Options”.)

1.4 Cells

1.4.1 Exercise 1: Absolute and relative cell addresses.


The main area of the Excel window is split up into cells. Figure 1 shows a screenshot of a typical Excel
window. Each cell is identified by its cell address consisting of the column letter and row number. The
column letters appear just above the cells and the row numbers appear to the left of the cells. You make
a cell active by clicking on it with the mouse. Once a cell is active you can type in data, then press Enter.

2
CHEN10050 Excel Basics for Engineering 2020/21

Figure 1: Typical Excel window

Tab
Cell column
Active cell letter
border Formula Bar
HELP
button

Button
Active cell

Cell row
numbers

Enter the values 1, 2, 3 in cells A1, A2, A3. Enter 4, 5, 6 in the next column alongside, then 7, 8, 9 in
the next column.
Cell addresses are used to help manipulate data, perform calculations etc. You can use lower case
letters in cell addresses. Cell b2 means the same as cell B2.
Cell B2 should contain the value 5. To illustrate the use of cell addresses, type =b2 in cell B8, then
press Enter. Note that the formula appears in the formula bar at the top of the screen as you type. Cell
B8 now contains the value 5.
Activate cell B8 by clicking on it. The formula =B2 is displayed in the formula bar as illustrated in Figure
2.
The active cell has a bold border with a button in the bottom right hand corner. If you click on the border
and move it to another cell the whole contents of the cell moves. If you click on the button and move
that, the instructions in the cell are extended into the highlighted cells.
Use the button on the border of cell B8 to extend the highlighted area into cell B9 – that is, down one
cell. Now click on cell B9 and observe that it contains the formula =b3. A cell address written as B2 is
a relative address. If you drag it down one row it will change to B3. Repeat the exercise by dragging
cell B8 right into cell C8, then click on cell C8 and observe that it contains the formula =C2. Confirm
that dragging cell B8 up one cell produces the formula =B1 in cell B7, and that dragging it left produces
=A2 in cell A8.
The Edit..Copy and Edit..Paste menu commands can also be used to copy cell B8 up, down, left and
right one cell. The results are identical to using the button.
The column or the row or both in a cell address can be fixed by putting a $ in front of it. To illustrate the
effect of fixing the column, enter =$B2 in cell B12. Then drag cell B12 into the adjacent vertical and
horizontal cells. Compare the results with what you did previously. Introducing the $ sign forces absolute
addressing of the column. The part(s) of the cell address preceded by the $ do not change if you copy
the cell to another location.

3
CHEN10050 Excel Basics for Engineering 2020/21

Now try fixing the row part of the cell address by typing =B$2 in cell B16 and copying that cell to adjacent
ones.
Finally, fix both row and cell by typing =$B$2 in cell B20 and copy that one into the adjacent cells too.
Review all your results. Introducing the $ sign forces absolute addressing of the column, row or both.
The part(s) of the cell address preceded by the $ do not change if you copy the cell to another location.
It is very important to understand the correct use of cell addresses.
If you are unfamiliar with the 2007 version of Office, you can always use the question mark button on
the top left of the window (HELP button).
Save the spreadsheet as file P:\ex1.xls using the File..Save As... feature from the menu bar. Excel
will automatically add the file name extension .xls. DO NOT type the .xls in the filename.

1.5 Formulae and graphics


Formulae are used to perform calculations in a spreadsheet. Figure 2a shows a screenshot of some
simple examples. Figure 2b shows how formulae were used to produce the results. You would not
usually see the version in Figure 2b on the screen, but you can switch to it (and back again) by pressing
the Control key and the ` key (first button on the left top in the keyboard) together (usually shown as
Ctrl+` in manuals). Formulae use cell addresses to make sure the right things are added, subtracted,
multiplied etc. Thus in the addition example the contents of cells b4 and b5 are added together. Note
that all the entries in column A of Figures 2a, 2b are just descriptive text. Typing a+b in cell A6 does
NOT cause any calculation to take place! Cell B4 contains the value of a, cell B5 the value of b and the
formula =B4+B5 in cell B6 causes the addition of these two values. Note that the formula must begin
with the = sign.
Do these calculations in your own spreadsheet.

1.5.1.1 Technique
Use the symbol ^ in a formula to raise to a power.
To use sub- or superscripts, highlight the relevant part of the text, then right click and use the Format
cells.., Alignment options.
To adjust spreadsheet column widths, double click on the dividing lines in the column headings.

4
CHEN10050 Excel Basics for Engineering 2020/21

Figure 2a: Basic arithmetical operations Figure 2b: Formula view

1.5.2 Exercise 2: The tank farm


This example develops the use of formulae and cell addresses in spreadsheets. It also introduces
graphical display of data.
Crude oil is to be stored in cylindrical tanks before it is refined. The tanks are laid out in the pattern
shown in Figure 5 with p tanks in the x direction and q tanks in the y direction. Tank diameter, d, is 32
m. Tank height, h, is 10 m. The volume of one tank is d 2h/4 m3, but the usable capacity of each
tank is only 80% of its volume so the total tank farm capacity Vtotal is 0.8pq d 2h/4 m3.
Use Excel to complete Table 1, bearing in mind the lessons of Exercise 1, especially those concerning
absolute and relative cell addresses and copying cells.
Look again at Figure 5. It should be clear that the total area can be calculated in the following way:
• The length in the y direction is ly = qd + 2d + (q-1)(d/2) = 1.5(q+1)d.

• The length in the x direction is lx = pd + 2d + (p-1)(d/2) = 1.5(p+1)d.

• Tank farm area A = lxly.

1.5.2.1 Graphical display of the data


Use the ChartWizard button to create an X-Y scatter chart of usable capacity against area. Plot the
points without any connecting line. Highlight the two columns of data as shown in Figure 3, go to the
Inserttab press the button highlighted in yellow the Figure.

5
CHEN10050 Excel Basics for Engineering 2020/21

Figure 3: Chart Wizard

The plot appears in the same window (see Figure 4). Right click on the plot area to add labels to the
axis and change the graph characteristics.

Figure 4: Plot

1.5.2.2 Technique
You can type PI() in a formula to obtain an accurate value for  (see Functions below).

Use the symbol ^ in a formula to raise to a power


You should only enter the formula in any column once, then copy it into successive rows.
To adjust spreadsheet column widths, double click on the dividing lines in the column headings.

6
CHEN10050 Excel Basics for Engineering 2020/21

To get multiple lines of text in a single cell (or group of cells), select the cell(s), right click and use Format
cells.
To use sub- or superscripts, highlight the relevant part of the text, then right click and use the Format
cells.., Alignment options. In axis labels, use Format axis title similarly.
Text size can be changed by right clicking then adjusting the font size.

Figure 5: Tank farm layout

Tank Farm Layout


p=4, q=5

d/2 d/2 d/2


d d

d/2

d/2

Length
in y
direction
d/2

d/2

Length in x direction

Information Technology

7
CHEN10050 Excel Basics for Engineering 2020/21

Table 1: Relationship between tank capacity and tank area

Tank diameter, d m
Tank height, h m
Number of tanks Number of Tank farm area Total usable tank
2
in x direction tanks A, m capacity
p in y direction Vtotal, m3
q
4 4
4 7
4 8
4 9
4 10

1.6 Functions
Excel contains many built-in functions. You can see a list by clicking on Formula on the tab and then
click on “Insert Function” on the top left part of the screen as shown in Figure 6. The exercises in this
section illustrate the use of some of these functions.
Figure 6: Functions

1.6.1 Exercise 3a: Trigonometric function plot.


To illustrate the use of functions, chart the trigonometric functions. Evaluate the functions at 15 degree
intervals in the range 0-360 degrees.

• Create a table of values, including column titles. The first column should contain the angles 0, 15,
30, ... , 360. You do not need to type all these values individually. First type a title (for example,
Angle, degrees) in cell A1. Type 0 in cell A2, then 15 in cell A3. Highlight cells A2 to A3. Drag the
highlighted cells down using the button and observe that final value is displayed as you do so. Keep
dragging until the final value is 360. Excel assumed that you wanted to create a series of numbers
incrementing by 15.

8
CHEN10050 Excel Basics for Engineering 2020/21

• The trigonometric functions only work for angles in radians, not degrees. A conversion function is
available. If the first cell in your list of angles is cell A2, enter =radians(A2) alongside it in cell B2.
Put an appropriate title in cell B1.
• Select cell C2. Type = then click the “Insert Functions” button in the Formulas box in the tab. Type
“sin” then click on go. Figure 7 shows what happens next (only one row of the table is shown)

Figure 7: Selecting cells for functions

Insert the cell to be used

• Click the button shown in Figure 7. A small selection window will appear. Highlight cell B3 to indicate
that is what you want to take sin of. Press OK to complete the selection.
• Make an XY plot of sin versus angle in degrees.
• Highlight all 25 rows of numerical data in column A. Press the Ctrl key and highlight the same 25
rows of column C. Both column A and column C should now be highlighted.
• Click on “Insert” in the tab.
• Choose the Scatter in the chart option, then the variant that plots smoothed lines.
• Click on “Select Data” on the tab, select “Series 1” and then “edit”. Name the series as sin. (see
Figure 8)
• Add the labels for the x axis (Angle/degree) and the y-axis (Function value) and the plot title (SIN
function), clicking on “Chart Layouts”.

Extend the table to include cos and tan. Make the chart display sin, cos and tan simultaneously as
separate series. Do NOT produce three separate charts. Click again on “Select Data” and click on “Add”
button.
Add the title of the new series of data. To enter the data click the 2nd button (for X values). Another pop-
up appears. Highlight the data in cells A2 to A26 then press the coloured button to return to Figure 8.
Click the 3rd selection button to choose cells D2:D26 as the Y values. You could use the 1st selection
button to get the series name from cell D1 in a similar way – but it might be just as easy to type cos in
the box.
Note the way Excel refers to a range of cells. D2:D26 means all the cells starting from D2 up to and
including D26. (Similarly H1:K15 would refer to a whole oblong block of cells with H1 at top left and K15
at bottom right.)

9
CHEN10050 Excel Basics for Engineering 2020/21

Figure 8: Adding another series

Graphing tan creates problems because it gets very large as the angle approaches 90 (and 270)
degrees, then becomes very large and negative as the angle increases beyond 90 (and 270) degrees.
Adding tan into the plot as a single series is NOT satisfactory.
Change the y-axis scale to ± 3 so that the sin and cos curves are clearly visible. Do this by right clicking
on the y-axis and navigating through the menus that appear.
Tidy up the plot by setting an appropriate x-axis scale, tick marks at 15 degree intervals on the x-axis
and 0.1 intervals on the y-axis, etc.
Tidy up the table by arranging that it displays radians, sin, cos and tan to four decimal places. To do
this, highlight the relevant columns, right click and choose Format cells…, Number… then choose
Number and set decimal places to 4 on the form that appears.

1.6.2 Exercise 3b: More functions


The file Nwproducts.xls contains data on a range of products available to order from a distributor. These
data are taken from a sample database file supplied by Microsoft for use with Access. Because of this
the entries in the Unit price column are in text form and cannot be used to perform calculations. Use
the Text functions LEN(), RIGHT() and VALUE() to convert these text entries into numerical equivalents
in a new column. You can even format the numerical values to display a $ sign by choosing a currency
format for the cells. Descriptions of LEN(), RIGHT() and VALUE() can be found by selecting these
functions from the menu. They are used here to remove the leftmost character ($) from each entry then
convert the remaining text to a number.
Use the COUNTIF Statistical function to count how many discontinued products there are.
Use the Statistical functions MAX, MIN and AVERAGE to find the maximum, minimum and average
values of unit price and units in stock.
Use the Math and Trig function SUM to calculate the total number of units in stock and units on order.
Finally, sort the table into ascending order of Supplier ID number. This is not done using functions. You
need to select the entire table of data then choose Data, Sort from the menu bar and fill in the forms
appropriately. NB do NOT sort only the Supplier column!

1.6.3 Exercise 3c: Creating custom Excel functions


It is also possible to develop our own custom functions in Excel. These functions are written in a
relatively easy to learn and use programming language called Microsoft Visual Basic. Custom functions
might be quite helpful, for example, to avoid typing long and complex mathematical expression several

10
CHEN10050 Excel Basics for Engineering 2020/21

times in the spreadsheet. To enable the creation of custom functions go to File→Options→Customize


Ribbon and select the option Developer, as indicated in Figure 9, and press OK.
Figure 9: Enabling custom functions editing

In the Developer tab of Excel’s ribbon, select Visual Basic to open the function editor. Next, in the menu
bar of the new window, select Insert→Module. The custom function should be typed in the new window
that will pop-up and should have the following structure:
Function function_name(argument1, argument2, …)
function_name = mathematical_expression
End Function

For example, the function called myfunction expressed mathematically as ax2+bx+c has as the
arguments a, b, c and x, and should be written as:
Function myfunction(x, a, b, c)
myfunction = a*x^2+b*x+c
End Function

as also shown in Figure 10.


Figure 10: Custom functions editor

11
CHEN10050 Excel Basics for Engineering 2020/21

Close the editor window and test the function in Excel. The myfunction function can now be used as
any Excel predefined function by typing myfunction() in a cell of the spreadsheet. Try plotting the custom
function for different values of x and for constant values of a b and c, as shown in Figure 11.

Figure 11: Custom function use in Excel

Important note: Workbooks that contain custom functions should be saved as Excel Macro-Enabled
Workbooks to work properly once they are re-opened. These files have extension .xlsm.

1.7 Roots of equations


The roots of any function f(x) are the values of x that make f(x) = 0. Excel can find real roots in at least
two ways - by plotting the function and by solving the equation. Finding complex roots is another
story. Figure 9 illustrates both ways of finding the roots of f(x) = x3 + 3x2 - 3. Because the function is
cubic (highest power of x is three) it must have three roots, r1, r2, r3.
First tabulate the function over some suitable range of values of x, probably chosen by trial and error.
Use this tabulation to produce an XY scatter plot. The function roots can be determined approximately
by observing where the function value is zero. If no roots are found, adjust the range of values of x.
The roots can be determined more accurately by solving the equation f(x) = 0. There are many ways of
doing these using numerical methods. Some will be described in your mathematics course. Whilst it is
valuable to understand how the calculations can be performed, it is also helpful to have a tool that will
do them for you. Excel 2010 has an analysis tool (Goal Seek) that does just that. Goal Seek adjusts the
values in the changing cells that you specify in “Set Cell” to produce the result that you specify in “To
Value” changing the values in the cell you specify (Figure 9). You can find this tool in the Data tab,
“What is Analysis”. (* Note here that these instructions are valid for Office version 2010. Previous
versions of Office used another tool called Solver, see also exercise 5.2, to find the roots of equation.
The modified version of Solver in Office 2010, cannot be used for this purpose anymore.)

Goal Seek is efficient but not very powerful; to find the root of the equation and needs to have a target
cell that is close to the actual root of the equation. Therefore, plot the function in a range of data (for
example in Figure 9 from 1.5 to 4) and identify the three roots. Click on the Data tab and on “What-If-
analysis” and then fill the form of Goal Seek. The Set Cell in the example case is C5 since this contains
the function expression. We want it set equal to zero by varying the value in cell B5. Click Ok. The

12
CHEN10050 Excel Basics for Engineering 2020/21

estimate of the root and the corresponding value of f(x) should replace the original values. Repeat this
procedure for all the roots of your equation. This means you should know in advance how many roots
your equation has!

1.7.1 Exercise 4: Roots


Find all three roots (r1, r2, r3) of f(x) = ax3 + bx2 + cx + d using both the graphical method and Solver.
Arrange your spreadsheet so that it is easy to change the values of a, b, c and d. Test your
spreadsheet using a = -0.3, b = 0.8, c = 4, d = -7.5.
You need to choose your starting guesses in Goal Seek carefully to ensure that all the different roots
are found. Your XY chart should help with these choices.

Figure 12: Roots of a cubic equation

1.8 Regression and curve fitting


Engineers often perform experiments to obtain data. In order to use the data in subsequent calculations
it can be very helpful to find an equation that draws a curve through the data points. Depending upon
the quality of the data and the type of calculations to be performed, the equation may need to fit the
data more or less accurately. Sometimes the form of the equation might be determined by theoretical
analysis. In other circumstances there may be little theoretical justification other than that the equation
reproduces the given data in an acceptable way. This exercise illustrates some of the many techniques
for fitting equations to data. More detail will be given in your mathematics course.
Table 2 contains some vapour pressure data obtained by experiment. An equation is required so as to
use these data in subsequent calculations.

13
CHEN10050 Excel Basics for Engineering 2020/21

Table 2: Vapour pressure data

Temperature, T Pressure, P
C mm Hg
-36.7 1
-19.6 5
-11.5 10
-2.6 20
7.6 40
15.4 60
26.1 100
42.2 200
60.6 400
80.1 760

1.8.1 Exercise 5.1


Read section 1.8.1.1 before attempting this exercise.
Enter the data of Table 2 into Excel. Produce an XY (scatter) chart showing P on the y-axis versus T
C. Use linear axes, with x-axis scale –40 to 100 and y-axis scale 0 to 800. Make the y-axis cross the
x-axis at T = -40 oC. Include appropriate chart and axis titles including units.
Use the chart trendline facility in Excel to fit polynomials

P = a 0 + a1T + a 2T 2 + ... + a mT m
of order m = 3 and m = 4 to the data of Table 2. Display the trendline equations in scientific notation
with six decimal places. (For example, 0.000123456 should be displayed as 0.123456E-03).
Note: by default Excel gives the trendline equation as y = f(x), and you should always edit the
equations to use the correct symbols, in this case P = f(T).
Use the trendline equations in the spreadsheet to re-calculate estimates Pestimate of P in each case.
Display the estimated pressures to 2 decimal places. Hence calculate the relative percentage error in
the estimated values ((Pestimate-P)*100/P), display to three decimal places).

1.8.1.1 Technique
Figure 13 shows part of the spreadsheet.
Use the Help facility to obtain an explanation of trendline equations and the meaning of R 2.
Right click on the data points on the chart to obtain the trendline option. Within the trendline dialogue,
choose the options to display the equation and R 2 value on the chart.
When the trendline equation is displayed, right click on it and format the labels to display in scientific
format with 6 decimal places.
You can copy coefficient values from the displayed equation into spreadsheet cells using Edit..Copy,
Edit..Paste. Take care not to lose the sign when copying negative values.

14
CHEN10050 Excel Basics for Engineering 2020/21

Figure 13: Example

1.8.2 Exercise 5.2


Read section 1.8.2.1 before attempting this exercise.

When you have a set a data that you want to fit with a specific equation (derived from a theory for
example), there is another tool of Excel called Solver that can help you. Solver works with a group of
cells that are related to the formula in the target cell. Solver adjusts the values in the changing cells that
you specify — called the adjustable cells — to produce the result that you specify from the objective
cell formula.
First of all check that Solver has been installed in your computer. Click on the Data tab, Solver should
be on the Analysis group (Figure 14). (If Solver does not appear in the Analysis group, you need to add
the solver Add-in program. Click the File tab, and then click Options, click Add-Ins, and then in the
Manage box, select Excel Add-ins. Click Go.)

So if you want to fit your data against the Clausius-Clapeyron equation (eq. 1), Solver can be used to
adjust the values of A and B
B
log10 P = A − (eq. 1)
(T + 273 .15 )
to the vapour pressure data of Table 2. To do this, you need to minimise the sum of squares of the error
(SSE) between the data and the fitted equation. For a set of estimated values ŷ i of data points y i , i =
1,…,n.
n
SSE =  ( yi − yˆi )
2

i =1

Use A=B=1 as your first starting guess.


Calculate the vapour pressure values predicted by the Clausius-Clapeyron equation using the values
of A and B you found.
Calculate the percentage errors with respect to the original values. Additionally, the coefficient of
determination, R 2 , can also be used to quantify how good the fitting is. It is calculated as

15
CHEN10050 Excel Basics for Engineering 2020/21

SSEmean − SSE
R2 =
SSEmean

where SSEmean is the total sum of the squares of the residuals between the data points and its mean
value, y , defined as
n
1 n
SSEmean =  ( yi − y ) and y =  yi
2

i =1 n i =1
The coefficient of determination can be interpreted as a normalized measure of how good the fitting
expression is in describing the variability of the data in opposition to simply assuming the mean value
of the data. For a perfect fit, SSE = 0 giving a value of R = 1 . When the fitting expression does not
2

represent any improvement, SSE = SSEmean resulting in R = 0 .


2

1.8.2.1 Technique
Figure 11 shows part of the spreadsheet.
Enter the raw data and calculate log 10P.
Enter the first guesses for constants A and B in two spreadsheet cells. Calculate the corresponding
estimates of log10P given by the Clausius-Clapeyron equation.

Figure 14: Example

To calculate the SSE of the 10 pairs of values directly:


Enter in cell E23 the formula =sum((E12:E21 – C12:C21)^2) and press Ctrl+Shift+Enter. The formula
bar should show that cell E21 contains {=sum((E12:E21 – C12:C21)^2)}. The braces { } (which you did
NOT type) denote an array formula. Each value in the array of cells C12 to C21 is deducted from the
equivalent cell in the range E12 to E21 and the result is squared. All the resulting squared errors are
summed. Excel Help gives more information on using array formulae.
The Solver can then be used to minimise the value of SSE in cell E23 (objective cell) by adjusting the
values of A and B in cells B24 and B25. (It is not advisable to ask Solver to find the values of A and B
that make SSE equal to zero.)

16
CHEN10050 Excel Basics for Engineering 2020/21

SSEmean can be calculated in the same way as SSE by entering the formula =SUM((E12:E21-
AVERAGE(E12:E21))^2) and pressing Ctrl+Shift+Enter.

[solutions: A=8.75, B=2035.17, R2=0.992]

17

You might also like