USING EXCEL ON THE COMPUTER TO FIND THE MEAN AND STANDARD DEVIATION AND TO DO LINEAR REGRESSION ANALYSIS AND GRAPHING
 Dr. Susan Petro

printer icon
Click here for printer friendly version

TABLE OF CONTENTS                                

Topic

1.  On Following Directions

2. Opening Excel

3. Making your table

            a) Inserting a ° symbol 
            b) Inserting a Δ symbol
            c) Subscripts and superscripts
            d) Significant figures
             e) Merging cells

4. Making your graph
        a) Deciding how to set the y intercept

        b) Adding the correlation coefficient ( r ) to your graph

        c) Formatting your graph
 

5. Solving for Unknowns

            a) To solve for x when you know y

            b) To solve for y when you know x

6. Formatting your table

            a) Centering data

            b) Formatting table headings

            c) Adding borders

7. Making a Multi-line Graph

8. Making a Histogram

9. Calculating the Mean

10. Calculating the Standard Deviation

11.  How to add a mean and standard deviation line to a histogram

12. How to embed your Excel graphs and tables into a Word document

13.  Examples of Graphs

            a) Single Line Graph

            b) Multi-line Graph

            c) Histogram

 

On Following Directions
From We Took to the Woods by Louise Dickinson Rich
    
I'm a good knitter, and I'm proud of it.  I can make up my own directions, or I can follow printed directions, which apparently is the harder thing to do, although I don't see why it should be.
     I think the difficulty with people who can't follow printed directions for knitting or anything else is that they try to understand them.  They read the whole thing through and it doesn't make sense to them, so they start with a defeatist attitude.  They try to relate the first few steps to the whole, and there is no obvious relation, so they get discouraged and say, "Oh, I can't learn things out of books...."
     You don't have to understand directions.  All you have to do is follow them; and you can follow them only one step at a time.  What you need is not intelligence, but a blind faith.  I never read directions through.  I never read beyond the operation I am engaged in, having a simple trust that the person who wrote them knew what he was doing.  That trust is usually justified.  Oh, there's no trick to following directions, and if I don't teach my children one other thing, I'm going to teach them that.  I think it's important.

Opening  Excel

        Click on start at the bottom left of the screen.

        Click on Programs.

        Click on MSOffice.

        Click on Microsoft Excel.

Making your Table

        Decide what data should go on the x axis (the determinate axis) and what data should go on the y
        axis (the indeterminate axis).  The information you knew before you ran the experiment goes on
        the x axis and the information you got by doing the experiment goes on the y axis.  For example
        if you are measurieng the absorbance of a number of dye concentrations the dye concentrations
        will be on the x axis since you decided on and prepared the concentrations you wanted to test.
        You didn't know what the absorbances would be until you put the various concentrations in the
        spectrophotometer, so absorbance would go on the y axis.

        Type in the heading for the x axis in the A1 box e.g. concentration (mg/ml). If the heading is too
        long to fit in the box, you may increase the box width by placing the cursor on the line between
        A and B so you get a double headed arrow 1 and dragging to the width you want.

        To have your data in columns, type in the heading for the y axis e.g. absorbance in the B1 box.
        To have your data in rows, type in heading for the y axis e.g. absorbance in the next box in the
        column, A2. Remember your page width only goes through I so if you have rows to the right of
        I they will not show up on your page when you print it. Also if you have increased the width of
        a box, your page width will not go as far as I anymore.

        Enter the values for x (numbers only, no letters or symbols) in the A column under your
        heading if you are doing your data in columns.
        Enter values for x in the1 row following your heading if you are doing your data in rows.

        For data in columns, enter values for y (numbers only, no letters or symbols) under the y axis
        heading e.g. enter values in B2, B3, etc.
        For data in rows, enter values for y in boxes to the right of your y axis heading e.g. B2, C2, D2,
        E2, etc.

        DO NOT enter values for your unknown in the table at this point.

Inserting (°) symbol

        To insert a degree (° ) symbol hold down the Alt key and type 248 on the number pad. (If you are
        using a Macintosh computer  hold down the Alt key, shift key and hit the number 8 key.)

Inserting a Δ  symbol

       To insert a Δ symbol open up a Microsoft Word document.  Click on insert on the task bar.  Click on symbol. 
       Find the Δ symbol on the table and select it.  Click on Insert then click on Close.  Now select the
       Δ and click on Edit on the task bar.  Click on cut or copy.  Open your Excel document and click on
       Edit and then Paste.

Subscripts and Superscripts

        To insert  a superscript or subscript in Excel click on Format on the menu bar.  Then click on
        Cells.  A window will open.  In the lower left of the window it says Effects.  Click on the box
        to the left of subscript or superscript.  A check mark will appear.  Now click on OK.  Type
        in your superscript or subscript.  To exit super/subscript mode repeat the process above.
        When you click on the box with the check mark it will disappear.  Click on OK.

Significant figures

      To have all your data values have the same number of spaces to the right of the decimal point
      select all the cells containing numbers.  Click on Format.  Click on Cells.  Click on Number.
      Click on Number under Category.  Decide the number of spaces you want to the right of the
      decimal point based on the significant figures you used for your measurements.  Click on OK.

Merging cells
To merge cells select the cells you want to merge and then click on the merge icon on the toolbar

           Merge icon

Making your Graph

        Select the entire table including the headings.

        Click on Chart Wizard on the standard toolbar (top row of icons). This icon looks like a
        multi-colored bar graph.

        Chart Wizard Step 1 of 4 - Chart Type will appear.

        Click on XY (scatter) line under Chart Type.

        Under Chart subtype click on the top chart if it is not already selected.

        Click on Next.

        Chart Wizard Step 2 of 4 - Chart Source Data will appear.

        If the data in your table is in columns click on columns, if it is in rows click on rows

        Click on Next.

        Chart Wizard Step 3 of 4 - Chart Options will appear.

        On the Title card enter chart title (e.g. The Effect of Concentration on the Absorbance
        of Methylene Blue Dye at Wavelength of 675nm).

        Enter X axis title e.g. Concentration (mg/ml) of Methylene Blue Dye.

        Enter Y axis title e.g. Absorbance (Abs units) of Methylene Blue Dye .

        Click on Next.

        Chart Wizard Step 4 of 4 - Chart Location will appear.

        Decide if you want your chart as a new sheet or as an object on the sheet with your table.
        For Fundamentals of Biology have the table on the same page as the chart for ease in
        correcting so click on as an object in the sheet.

        Click on Finish.

        Click on the chart area.  Small boxes will appear along the borders.  Click on the white
        area of the graph so a four-sided arrow appears.  Holding down the left mouse button
        drag the chart below your table.  Now click on one of the small boxes on the bottom edge
        of your graph so a double-sided arrow appears.  Drag the bottom of the graph down to
        number 42.  Click on  one of the small boxes on the right side of your graph so a
        double-sided arrow appears.  Drag the right side of the graph to the letter I  if you haven't
        increased the size of the cells.

        Double click on the plot area. Format Chart Area will appear. To change the background
        color of the plot area click on the box under Area that is the color you want. I prefer a
        white background for maximum contrast so click on none. Click on OK.

        Click on one of the points on your graph. All the points in the line to which that point belongs
        will become larger squares.

        Click on Chart on the menu bar.

        Click on Add Trendline.

        Click on Linear box if it is not already highlighted.

        Click on Options card behind Type card.

        Click on Set Intercept when dealing with linear regression data where y was zero
        when x
was zero for example in labs using the spectrophotometer to measure absorbance.
        (The spectrophotometer is blanked; set to
zero absorbance at zero concentration of the
        substance whose absorbance is to be
measured). Otherwise don’t click on Set Intercept.
        Set Intercept will set the y intercep
t at zero so when your formula (y = bx + a) comes
        up the a value will be zero and not appear.

        Click on 'Display equation on chart'. The formula y = bx + a with appropriate values for
        b (slope) and a (y intercept) will appear on your graph

        Click on 'Display R-squared value on chart'. Ris the correlation of determination.
        Values for the correlation of determination range from zero to one.  The higher the
        correlation of determination (the closer to one) the better the regression line is in
        explaining the variation of the data.

        Click on OK.

        To move formulas where they can be more easily seen, click on the formula. A hatched
        border will appear around the formula. Click on the border so a four-sided arrow appears
        and drag it where you want it.

        The default point size of the formulas is quite large so to change the point size, click the
        down arrow next to the displayed point size in the Formatting toolbar and choose a
        smaller point size.

To add the correlation coefficient ( r ) to your graph:

If your graph is on the same sheet as your table, click in any empty cell to the right
of your graph. A heavy border will appear around the cell.

Type in =sqrt(the R2 value from your graph) e.g. if R2 was 0.949 then type
 =sqrt(0.949). Hit Enter. The r value will appear in the cell.

Now click on the graph so the hatched border appears around the plot area
of the graph and the word ‘plot area’ appears in the Name box.

Click in the formula bar that is to the right of the Name box. Three icons will
appear. Now type in r = whatever you got above e.g. r = 0.974.  If your slope
value (b) was positive the r value is positive, if your slope value was negative
then the r value will be negative.  So if your slope was negative type a negative
sign in front of your r value.

Click on the check mark icon. What you typed will appear on your graph
surrounded by a hatched box.

Drag the box so it is under your other formulas.

To change the font or point size of the r value click on Format. Click on
Selected Data Labels. Click on Font and choose size and font to match your
other formulas.

The correlation coefficient indicates how closely the points on your graph fit a straight line. 
A value of +1 or -1 indicates a perfect direct or indirect relationship between x and y. If 
your correlation coefficient is not close to +1 or -1 your data is not linear. (Perhaps it is 
logarithmic, exponential or polynomial). If this is the case you wouldn’t use linear regression 
for graphing your data.  Link to visual aide on correlation coefficient.

        Sometimes as you are working on the following formatting the r = equation will
        seem to disappear from your graph. Click on the spot where the equation was
        and it will reappear.

Formatting Your Graph

To change the graph title, axes labels, legend titles on a multi-line graph, etc.

            Click twice on the item to be changed.  (Note : this is not a double click, but two
            separate clicks.)  The cursor will appear and you can make your changes.

            Alternatively

             Click on the item you want to change.  A hatched border will appear around it.

             Put the cursor in the formula bar that is to the right of the Name box.  Three icons
                will appear.  Type in the orrections  you want to make.

Click on the green check mark icon.

To format the title

        Double click on the title.  A Format Chart Title dialog box will appear.

        Click on Font.  Choose the size you want.

        Alternatively

        Click on the title. A hatched border will appear around the title.

        Click on Format.

        Click on Selected Chart Title.

        Click on Font.

        Choose font, font style and size you want.

To format the axes labels

          Double click on the axis label.  A Format Title dialog box will appear.

          Click on Font.  Choose the size you want for your axis label.

           Alternatively

           Click on the axis label. A hatched border will appear around the label.

           Click on Format.

            Click on Selected Axis Title.

            Click on Font.

            Choose font, font style and size you want.

To format the axes numbers or axes lines

        Put the cursor on the axis whose numbers you wish to format. If the cursor is correctly
        positioned over the axis it will read Value (X) axis or Value (Y) axis.

        Double click on the axis line.  A Format Axis dialog box will appear.

        Click on Font.  choose the size you want your axis numbers to be.

         Click on Patterns.  Choose the weight you want for your axis line.

         Alternatively

         Place the cursor as above and single click.

         Handles will appear on each end of the axis line.

        Click on Format.

        Click on Selected axis.

        Click on Font.

        Choose font, font style and size you want.

To format the borders

        To remove borderlines you don't want e.g. the border around the legend or around
        the plot area or around the entire graph.

        Double click on the area inside the border.  A Format dialog box will appear.
        On the Patterns card click on None under Border.
 

To format the trendline

         The default line is quite thick so you may want to choose a lighter weight line.

         Double click on the trendline.

        A Format Trendline dialog box will appear.

        On Patterns click on the down arrow beside Weight and choose the thickness you want
        for your line.

        Alternatively

        Click on the line.  Handles will appear on each end.

        Click on Format.

         Click on Selected Trendline.

        Click on Weight and choose the line you want.
 
 
Click outside graph and scroll back to your table.

Solving for Unknown x or y

To solve for x when you know y.

        Type in the word ‘unknown’ in the empty space at the end of the y column.

        If your data is in columns enter the y value you got for the unknown in the box
        below the one where you typed ‘unknown’.

        Move pointer to the empty space at the end of the x column. Type in the word
        'unknown'. Now move pointer to the box below the one where you just typed
        ‘unknown’.

        Type = then a parenthesis then the y value you just entered. ( If the number is very
        long you can just type the letter and number of the cell e.g. D11 to save time.)  Now
        type - then the a value (y intercept) from the formula on your graph and a closing
        parenthesis. (If your y intercept was zero you only need to type the y value without
        parentheses.)  Now  type in / and the b value (slope) from the equation on your graph.
        Suppose the equation on your graph is y = 29.514x. This would mean a, the y intercept,
        is zero since it doesn’t appear and b is 29.514. You would type
        =D11(or the number in the D11 cell)/29.514.

        Then hit Enter and that will give you your x value at that y.

To solve for y when you know x.

        Type in the word 'unknown' in the empty space at the end of the x column.

        Now enter the x value for the unknown in the box below the one where you
        typed ‘unknown’.

        Move pointer to the empty space at the end of the y column. Type in the word 'unknown'.
        Now move the pointer to the  cell below the one where you just typed ‘unknown’
        in the y column.

        Type = then type a parenthesis then the b value (slope) from the equation on your
        graph, then * and the  x value you just typed under 'unknown' in the x column.
        (If the x value is very long you may type the letter and number of the cell containing
        the x vallue you just entered e.g. A12)  Now type the closing parenthesis then + then
        the a value (y intercept) from your graph. then the closing parenthesis then + then the
        a value (y intercept) from your graph.

        Hit Enter and that will give you your y value for that x.

        Suppose the equation on your graph was y = - 0.421x + 27.98. You would type
         =(-0.421*A12)+27.98

Formatting Your Table

Centering Data

        Select the entire table.

        Click on the Center icon or

        Click on Format on the menu bar.

        Click on Cells
        Click on card heading that reads Alignment.

        Click Center under Horizontal.

        Click OK.

Formatting Table Headings

        Select just the table headings.

        Click on the B (bold) icon if you want the table headings bold.

        Click on Format on the menu bar.

        Click on Cells.

        Click on card heading that reads Font.

        Choose font, font style and size you want.

        Click on OK.

If you want to add borders

        Highlight the entire table.

        Click on Format on the menu bar.

        Click on Cells.

        Click on card heading that reads Border.

        Click on Outline and Inside boxes.

        Choose a style for your borderline. Click in that box.

BEFORE PRINTING YOUR GRAPH be sure to click outside the graph area
itself.  Otherwise only the graph and and not the accompanying table will be printed.
To see what your graph will look like prior to printing, click on File and click on Print Preview.

Click to see an example of a single line graph.
 
 

MAKING A MULTI-LINE GRAPH

Say you want to chart several lines on the same graph - for example the effect of temperature
on the calories of energy consumed  by several bird species say the English sparrow, the purple
finch and the pine siskin.

Type in heading for x axis data in the A1 cell - Temperature (°C).

Say you wanted your data in rows. In the A2 cell type in Calories English sparrow, in the A3
cell type in Calories purple finch and in the A4 box type in Calories pine siskin.

Your temperature values will be typed in the 1 row e.g. B1, C1, D1, etc.

The calories for the English sparrow will be typed in the 2 row e.g. B2, C2, D2, etc.

The calories for the purple finch will be typed in the 3 row e.g. B3, C3, D3, etc.

The calories for the pine siskin will be typed in the 4 row e.g. B4, C4, D4, etc.

Select the table

Follow directions using Chart Wizard as previously explained. The only difference is that
you must repeat the "Click on one of the points on your graph" sequence for each line.

When one has several lines the formulas may be crowded and it may be difficult to see
 which formula goes with which line so click on the formulas one at a time and drag them
away from the lines.

Make titles for each formula by clicking on the graph so a hatched border appears around
the plot area of the graph and the word 'plot area' appears in the Name box.

Put your cursor in the formula bar to the right of the Name box.  Three icons will appear.
Now type in the legend title for that line e.g. English sparrow.

Click on the green check mark icon.  What you typed will appear on your graph surrounded
by a hatched box.  Drag the box so it is above the formulas for that line.

Repeat for the remaining lines.

To put the symbol used for each line next to the title above each formula you will have
to draw it in by hand after you print the graph.

The computer will choose different colors for the points of each line.  If you are not using
a color printer the light colors will show up poorly when printed by a black and white printer.
Double click on one of the points of the trendline whose marker color you want to change.
A Format Data Series dialog box will appear.  Click on Patterns.  Under Marker click the
down arrow next to Foreground.  Click on black on the pop-up palette.  Now click on the
down arrow next to Background.  Click on black on the pop-up palette.  Click on OK.

Click to see an example of a multi-line graph.
 
 

HOW TO MAKE A HISTOGRAM

To have your histogram bars represent ranges.

Below are the water volume measurements for the histogram at the end of this document.  These were used to make a histogram with five equal bars.


Water volume (ml)
   
35.80

37.90

38.00

38.20

38.20

38.50

38.90

39.10

39.50

40.60

Mean = 38.47

Standard deviation = ±1.25


To get five bars (or any other number you want) on your histogram:


Subtract lowest value from largest.  For the numbers above that would be 40.60 - 35.80 = 4.80.
        
Now divide your answer by the number of bars you want .  If you want three bars divide by 3.  Since we want five bars divide as follows: 4.89/5 = 0.96

Add this number to your lowest value to get your first range.  So 35.80 + 0.96 = 36.76.  First range is thus 35.80-36.76.

For the second range begin with 36.77, because if you use 36.76 and one of the measurements happens to be exactly that you won't know whether to count it in the first range or the second range when you determine the frequencies.  Now add 0.96 to the end of the first range value (36.76) to get the upper value of the second range.  Second range is thus 36.77-37.72.  Third range is 37.73-38.68 and so on.

   
Follow previous directions for making a table.  Put range values (or individual numbers depending on type of histogram) in first column and frequencies in second column.

If your x values are ranges as above then select the entire table.

If your x values are not ranges but single numbers.  DO NOT select the entire table.  Select only the y value column of the table.

Click on Chart Wizard.

Chart Wizard Step 1 of 4 - Chart Type will appear.

Click on Column box.

Click on upper left chart under subtype if it is not highlighted already.

Click on Next.

Chart Wizard Step 2 of 4 - Chart Source Data will appear.

Click on columns if your data is in columns, click on rows if your data is in rows.

Click on Next.

Chart Wizard Step 3 of 4 - Chart Options will appear.

Enter Chart title and label x and y axes.

Click on Legend if you want the legend somewhere other than to the right.

Click on Next.

Chart Wizard Step 4 of 4 - Chart Location will appear.

If you want the chart as a new sheet, click on 'as new sheet'. If you want it as an object
in the same sheet click on 'as an object'

Click on finish.

How to format your histogram.

Double click on the plot area of your graph. Format Plot Area will appear. Click
on 'none' under Area so background will be white.

Click on one of the bars of the graph. Handles will appear on all the bars.

Click on Format. Click on Selected Data Series. Choose a color for the area inside
the bars. Don't click on OK yet. Click on Options. Set overlap at zero and gap width at 10.
Click OK.

To format the title, legend, axes and the table, see the directions on pages 4-7.

Click to see an example of a histogram.
 
 

HOW TO CALCULATE THE MEAN (AVERAGE) USING EXCEL

Enter Microsoft Excel as previously described

Type in heading e.g. water volume in ml in A1 box

Enter values in A column

Skip down a few rows in A column and type in Mean.

Go down to next row and type in =average(range of boxes containing your data) and hit
Enter key e.g. if you entered data in box A2, A3, A4, A5, A6 you would type
=average(a2:a6) or after the first parenthesis simply highlight all the boxes containing
the data and the range will appear automatically.  Add the closing parenthesis and hit Enter.  

HOW TO CALCULATE THE STANDARD DEVIATION USING EXCEL

 Follow all directions for mean as above.

Now skip down a couple rows in column A and type in Standard Deviation.

Go down to the next row and type in =stdev(range of boxes containing your data)
and hit Enter. E.g. if you entered data in boxes A2, A3, A4, A5, A6 you would type
=stdev(a2:a6) and hit the Enter key or after the first parenthesis simply highlight all
the boxes containing the data and the range will appear automatically.  Add the
closing parenthesis and hit Enter.

To insert a ± sign in front of your standard deviations move the cursor down one cell,
hold down the Alt key and type 241 on your number pad. (If you are using a
Macintosh computer hold down the Alt key, the shift key and hit the + key.).
Now type in the standard deviation value you obtained.

HOW TO INSERT A MEAN AND STANDARD DEVIATION LINE ON A HISTOGRAM

First you need to have the Draw Toolbar visible.
     Click on View on the Menu Bar
     Click on Toolbars
     Click on Drawing.  Draw Toolbar will appear.

Click on the stright line icon \ on the Draw Toolbar.

Draw a vertical line above where the mean would fall.

Click on the straight line icon again to draw a horizontal line from the minus to the plus end of the standard deviation range.

Click on the straight line icon to make the end bar for each end of the horizontal line.

Now click on the plot area.  Put your cursor in the formula bar to the right of the Name box which now says plot area.  Three icons will appear.  Type in the mean and standard deviation.

Click on the green check mark and the mean and standard deviation will appear on your plot area.  Now move these numbers above the mean line on the graph.

HOW TO EMBED YOUR EXCEL GRAPHS AND TABLES INTO A WORD DOCUMENT

Open your Excel file
     Select the table and graph
        Click on Control C or Edit/Copy
Now open Paint. To do this:
    Click on Start at bottom left of your computer screen
      Click on Programs
         Click on Accessories
            Click on Paint
To open you Excel document in Paint
   Control V or Edit/Paste
   Now Control C or Edit/Copy
Now open your Word document and when you come to the space where you want to add your Excel document
   Control V or Edit/Paste
To save
   Click on File
   Click on Save

   

Single-line Graph
 

Single line graph

Multi-line graph

  multi-line graph
   

HISTOGRAM

histogram