Excel Tutorial The following tutorial is intended to as an overview of those aspects of Excel which are most relevant to documenting an engineering report. The main aspects covered are: Formatting cells / numbers Entering formulas Propagating number, sequences and formulas Fixing cell references Graphing results Adding a trend line and displaying its formula Determining slope of XY data Multiple graphs in one chart Other useful functions Formatting cells / numbers Whether a number typed in directly by the user or the result of a calculation, it can be reformatted to your suit your requirements. For example, where the result of a calculation runs to several decimal places, you may restrict the number of decimal places displayed. Also in engineering abbreviations used are in multiples 1000 you may wish to insert a comma for every third digit. To format a number: Right click on cell. Select Format cells Select the number tab For category select number. Specify the number of decimal places. Specify 1000 separator if required. Other tabs are available for formatting the font, border, alignment etc. Example Reformat the number below to add a 1000 separator and limit the number of decimal places to 2. Initial value Reformatted 12345.6789 12,345.68 N.B. The number is rounded up or down as appropriate. This does not affect the accuracy. N.B. It is desirable that you format your numbers so that there are not excessive numbers of decimal places displayed. S Dalton, IT Sligo 1
Entering formulas Excel can perform all the regular mathematical operations; Addition (+), subtraction (-), Multiplication (*), division (/), to the power of (^) etc. To divide the contents of Cell A1 by the contents of Cell B1 and place the result in cell C1. Click in Cell C1 Select the = key Click in Cell A1 Select the division key /. Click in Cell B1 Press Return to complete the operation/calculation The result will be displayed as shown. Excel of obeys to usual mathematical rules of precedence: Brackets are evaluated before multiplication and division. Multiplication and division are evaluated before addition and subtraction. Propagating values If a cell contains a number and you select that cell then using the drag handle at the bottom left hand corner of the selected cell, then you drag downwards by a number of cells. The number will be propagated or copied into the remaining cells. Propagating number sequences If two cells are selected and these cells form part of a sequence then, then pulling the drag handle downward will cause this sequence to be continued as the further cells are filled. Propagating formulas Where it is required to repeat a calculation several times, the formula may be entered once (as shown on the left), then propagated to the remaining cells (by pulling the drag handle downwards as shown earlier. N.B. Note that as the formula is propagated downwards the cells references are also incremented. S Dalton, IT Sligo 2
Fixing cell references If it is required to multiply a sequence of numbers by a fixed quantity, e.g. 6 times tables, 6 x 1, 6 x 2, 6 x 3 etc. or converting degrees to radians it is not necessary to repeat the fixed quantity. Instead a cell reference may be fixed or locked. A cell reference may have its column, its row or both fixed by placing a $ symbol adjacent to the relevant index. Example Enter a sequence of angles in the first column (column A). The conversion factor is 3.14159/180 = 0.01745. Enter this value in the top cell of column B. Next enter a formula in the top of column C to multiply cell A1 by B1. Then, placing the cursor over the letters B1 in the formula, select the F4 key. Each time the F4 key is selected the following options occur. $B$1 Column fixed row fixed B$1 Column free - row fixed $B1 Column fixed row free. B1 Column free row free This determines the behaviour of the cell reference when the formula is copied. In this case place a $ symbol in from of the row number B$1 then copy the formula downwards using the drag handle. N.B. While the first cell reference increments downward from A1 to A5, the second cell reference remains fixed on cell B1 as a result of fixing the row number using $1. Graphing results The most common type of graph used for engineering applications is an XY scatter plot. This allows one column of data to be plotted against another such as plotting a graph of stress vs strain. There are a variety of options for an XY scatter plot such as: points only, lines, line only, curve only, lines with points, and curves with points. The graph type can be determined at the time of creation or can be reformatted. S Dalton, IT Sligo 3
Ensuring that the data for the horizontal axis is on the left, and the data for the vertical axis is on the right an XY scatter plot can be created relatively quickly be select the chart tool (Alternative Select Insert Chart from menu ) From the chart type available select XY scatter and select the data points connected by lines option. Finally choose finish to create chart. This will create a chart similar to that shown on the current sheet. (Other options are available under Next but these can be addressed by reformatting chart later). Adding a trend line and determining its slope. Where a graph is approximately linear it may be desirable or necessary to create a best fit straight line and determine the slope. This can be useful for determining spring stiffness from a load-extension graph or for determining the Youngs modulus for a material from a stress-strain graph. To add a trend line, select the relevant graph, right click and select add trend line. Of the type s available select linear followed by OK. Applying a formula to a trend line Having added a best fit straight line to a chart, the equation of the line may now be added. This is achieved as follows:- Right click on the line and select format trend line. Under options select Display equation on chart. The number on the left (the coefficient of X) is the slope of the line while the second number is the intercept on the Y axis. A disadvantage of this number is that is not accessible for further calculation. An alternative is the used the slope function (see later). Another disadvantage is the potential inaccuracy due to rounding off. S Dalton, IT Sligo 4
Determining slope of data If it is required to determine the slope of graph data and then use it in subsequent calculations. It must be evaluated in the main body of the spreadsheet. This can be achieved using the slope function. This is achieved as follows: Select cell in which you wish to place the slope result Type =slope( Select the column representing the Y values Type a comma, Select the column representing the X values. Finally close brackets ) and select Return. The result should look as shown. Adding further graphs to an existing chart To add an extra graph to an existing chart. Right click on the chart and select source data. The dialog box which appears shows a preview of the existing chart. To create a new graph on the existing chart, select the [Add] button. To define the series name select icon A (hides dialog) then select cell A. To define the X values select icon B then select cell range B. To define the Y values select icon C then select cell range C. This will result in an extra line being added to the chart. S Dalton, IT Sligo 5
Other useful functions. Other useful functions exist for evaluating a range of data. =MAX(cell range) Isolates and displays the maximum value in a selected list of numbers. =MIN(cell range) Isolates and displays the minimum value in a selected list of numbers. =AVG(cell range) Calculates and displays the average of a list of numbers. =MEDIAN(cell range) Calculates and displays the median (or middle value) of a list of numbers if sorted in order. Decision making Excel has the ability to make decisions. In this simple example a simple if statement is used to evaluate whether a result contained in a particular cell is a fail or a pass. The if Function contains 3 components. The logical test (is the contents of the cell less than 40) What to do if the logic test is true (if yes display the word Fail) What to do if the logic test is false (if no display the word pass) Such logic test can also be nested to provide an extended range of evaluation results e.g Fail, Pass, Merit, Distinction. Also such logic tests can also be used to influence the flow of the calculation. E.g. Given one outcome perform calculation A, Given an alternate outcome perform calculation B. Pi or π Pi or 3.14159 is commonly used in engineering calculations. This value may be accessed in excel using the PI() function. This allows you access to an accurate value of PI without having to memorise the value. Working with angles In Excel as in any computer programming language trigonometry calculations are based on angles expressed in radians. Therefore, if it required to determine the vertical position of the end of rotating arm of specified length and whose position is specified in degrees then it is necessary to convert the angle to radians. Row 3 illustrates the formulas used while Row 5 shows the evaluated values. As expected the Sin of 30 degrees is 0.5 however in excel this can only be achieve by conversion to radians. S Dalton, IT Sligo 6
Data Validation Rather than giving to user total freedom to enter any value in a cell. You may restrict the options available to the user. i.e. by forcing them to select from a list. To present a user with a restricted list to select from select:- Data Validation Settings, Allow List Then select the items which the user may select from. Concatenate =concatenate(a1,a2,a3) or =A1&A2&A3 Vlookup e.g. Material properties example in conjunction with select from list Rather that specify a cell range, that range can be give an name e.g. data Convert =convert(a1, in, mm ) Trace Precedents Tools Formula Auditing Trace Precedents, Trace Dependants Remove all arrows Copying data from a PDF Use copy as table command Then convert all values to numbers. S Dalton, IT Sligo 7