# USING EXCEL 2007 FOR LINEAR REGRESSION, HISTOGRAMS AND BAR GRAPHS AND TO FIND THE MEAN AND

STANDARD DEVIATION
Dr. Susan Petro

Click here for printer friendly version TABLE OF CONTENTS Topic 1. On Following Directions 2. Opening Excel 3. Determining the size of your page for printing 4. Directions for making your table a) Table title b) Determining what goes on the x and y axes c) Table headings d) Entering the data e) Significant figures f) Inserting a ° symbol i) Merging cells j) Subscripts and superscripts 5. Formatting your table a) Title b) Centering data c) Formatting table headings d) Adding borders 6. Directions for making your graph a) Labeling the x and y axes b) Sizing your graph c) Adding the trendline and formulas d) Deciding how to set the y intercept e) Adding the correlation coefficient ( r ) to your graph f) Formatting your graph To change the graph axes labels, etc. To format the axes labels To format the axes number
g) Inserting a Δ symbol h) Inserting a ±

7. Solving for Unknowns a) To solve for x when you know y b) To solve for y when you know x 8. Adding the Figure Number and Title to Your Graph 9. Making a Multi-line Graph 10. Making a Histogram a) Making the table for your histogram b) Formatting your histogram c) Adding a mean and standard deviation line to your histogram 11. Making a Bar Graph 12. Calculating the Mean 13. Calculating the Standard Deviation 14. How to embed your Excel graphs and tables into a Word document 15. Examples of Graphs a) Single Line Graph b) Multi-line Graph c) Histogram d) Bar graph 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 Microsoft Office. Click on Microsoft Excel. DETERMINING PAGE SIZE FOR PRINTING Click on the circle icon in top left corner of screen (1). Click on arrowhead to right of Print (2). Click on Print Preview (3).

Click on OK.

A broken line will appear around the area that will print on an 8 1/2 X 11 sheet of paper. Making your Table
Title of the table In the first row, A1, type in the table number and the table title.

Below is an example of a table title. Don't do anything further with the title at this point.

Determining what goes on the x and y axes Decide what data should go on the x axis (the determinate or independent axis) and what data should go on the y axis (the indeterminate or dependant axis). so absorbance would go on the y 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.g. Concentration of new methylene blue dye (mg/ml). You didn't know what the absorbances would be until you put the various concentrations in the spectrophotometer. For example if you are measuring 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. To have your data in columns To have your data in columns. If the heading is too long to fit in the box. type in the heading for the y axis e. you may increase the box width by placing the cursor on the line between A and B so you get a double headed arrow  dragging and to the width you want.e. Table Headings Type in the heading for the x axis in the box below the title. absorbance(Abs units) in the B column .g.

. no letters or symbols) in the A column under your heading if you are doing your data in columns. type in heading for the y axis e. absorbance (Abs units) in the next box below the one in which you typed your x heading (in the same column).To have your data in rows To have your data in rows.g. Entering the Data Enter the values for x (numbers only.

DO NOT enter values for your unknown in the table at this point. .Enter values for x in the row following your heading if you are doing your data in rows. etc.. C5. B5. Select your table entries. For data in rows.) Inserting a Δ symbol To insert a Δ symbol open up a Word document. Click on Symbols. Inserting (°) symbol To insert a degree (° ) symbol hold down the Alt key and type 248 on the number pad. B5. enter values in B4. If you are using a Macintosh computer hold down the Alt key.g. D5. Click on the appropriate decimal point icon to either increase or decrease the number of decimal places you want. . no letters or symbols) under the y axis heading e. E5. For data in columns. etc. enter values for y in boxes to the right of your y axis heading e. enter values for y (numbers only. Click on Insert on the task bar. Significant figures 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 Symbol. shift key and hit the number 8 key (not the 8 on the number pad. Click on More Symbols.g.

Find the Δ symbol on the table and select it. . Now select the Δ and click on Control key and C.. Click on Insert then click on Close. Open your Excel document place the cursor where you want the Δ and click on Control key and V.

Inserting a ± symbol To insert a ± sign in front of your standard deviations move the cursor down one cell. To exit super/subscript mode repeat the process above.). Subscripts and Superscripts To insert a superscript or subscript in Excel click on the tiny arrow in the box to the right of the word Font. Under Effects click on the box to the left of subscript or superscript. (If you are using a Macintosh computer hold down the Alt key. Type in the superscript or subscript. Now click on OK. Now type in the standard deviation value you obtained. A Format Cells box will appear. Merging cells To merge cells select the cells you want to merge and then click on the Merge and Center icon on the toolbar. . the shift key and hit the + key. When you click on the box with the check mark it will disappear. A check mark will appear. hold down the Alt key and type 241 on your number pad. Click on OK.

Remember this letter. In this case I. Now place the cursor on the line between A and B and drag so your title fits completely in the new A cell. . Click on Wrap Text. Click the mouse in the title cell so it is selected as above (has a dark border around it).Formatting Your Table Title See what letter cell on the right of your document will fit in the print area within the dotted border line.

Your title will now fit on the printed page no matter how long it is. the A column fits the heading Temperature °C. Click on the Center icon on the toolbar. In this case G. Centering Data Select the entire table. In the example below. Selected empty cells will be pale blue. Drag cell width of A back to its original size to fit table headings. Click on Merge and Center. .Select all cells in that row through the one that you remembered from above step.

Formatting Table Headings Select just the table headings. Choose font style and size you want. Click on the B (bold) icon if you want the table headings bold. Click on All Borders . A drop down menu will appear. Click on border icon arrowhead. To add borders to your table Select the entire table.

Note: If you will be calculating unknowns from your graph wait until you have completed that step before adding your borders. See below. MAKING YOUR GRAPH Select the entire table including the headings. . but omitting the table title.

. See below. Then click on Scatter (2). Then click on the point graph (3). Click on Insert (1) on the menu bar. .

Do this by looking at the values on the x and y axes and the contents of the Legend box. . click on the Switch Row/Column Icon. If this is the case.Check to be sure your computer correctly decided if your data was in rows or columns. If these are not correct the computer decided your data was in rows when it was in columns or vice versa.

Click on the four tiny squares on the right side of your graph so a double-sided arrow appears. Click on More Primary Horizontal Axis Options (4). Drag the right side of the graph so it fills the width of the page almost to the dotted line. Now click on the four tiny squares on the bottom edge of your graph so a double-sided arrow appears. Drag the bottom of the graph down to number 43 or so to leave room to add a title below later. drag the chart below your table. Holding down the left mouse button.Sizing your graph Click on the white area of the graph so a four-sided arrow appears. If the axis numbers are too crowded (see below) Click on Layout (1). . Click on Primary Horizontal Axis (3). Click on Axes (2).

002 to 0.Under Axis Options click on Fixed and change your Major unit so numbers are not so crowded. For example. Click on Close. Delete any writing in the Chart title box. change from 0. See below. .005. The numbers on the x axis are now easier to read. in the case illustrated above.

Labeling the x and y axes Click on Chart Tools (1) at the top of the screen.g. Click on Primary Horizontal Axis Title (4). Enter x axis label in the box that appears below the graph e. repeat above directions except click on Primary Vertical Axis Title and then Rotated Title. Hit Enter key. Click on Title Below Axis (5). Click on Layout tab (2). Concentration of Methylene Blue Dye (mg/ml). . Click on Axis Titles icon (3). To label the y axis title.

. Adding the trendline and formulas Click on one of the points on your graph.Type in the y axis label e. Absorbance (Abs units). Hit Enter key.g. All the points in the line to which that point belongs will become a cross.

Click on Layout on the menu bar (1). Click on More Trendline Options (3). Click on Trendline (2). .

the in Click on Close. Click on 'Display equation on chart'. R2 is the correlation of determination. See below. . A box with handles will appear. A border will appear around the formula. To remove Linear click on the legend box. click on the formula. don’t click on Set Intercept. Hit the delete key to remove. To move formulas where they can be more easily seen. Now click a second time on just the Linear and the handles will be just around Linear. In the legend box Linear will apear. Otherwise Set Intercept will set the y intercept at zero so when your formula (y = bx + a) comes up the a value will be zero and not appear. 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'. Click on the border and drag it where you want it.Deciding how to set the y intercept zero Click on Set Intercept when dealing with linear regression data where y was when x was zero for example in labs using the spectrophotometer to measure absorbance. Values for the correlation of determination range from zero to one. The higher correlation of determination (the closer to one) the better the regression line is explaining the variation of the data. set to zero absorbance at zero concentration of the substance whose absorbance is to be measured).(The spectrophotometer is blanked.

point size. Choose a smaller point size or different font. etc. To add the correlation coefficient ( r ) to your graph: Click in any empty cell to the right of your graph.If you want to change the formatting of the formulas e. right click over formulas and a formatting box will appear. A heavy border will appear around the cell.g. .

The r value will appear in the cell.949 then type =sqrt(0.Method 1 Type in =sqrt(the R2 value from your graph) e. To format the axes labels Right click on the axis labael.8 is generally described as strong. Hit Enter. Hit Enter. but that there is some significant association between the two variables. Now click over formula box and under your R2 value type in r = whatever you got above e. Method 2 Type in =CORREL(select column of x values from table. If your correlation coefficient is not close to +1 or -1 your data is not linear. select column of y values from table). The r value will appear in the cell. Note that the correlation coefficient indicates a relationship between the variables of interest. This does not necessarily imply that one variable causes the other (for example. If this is the case you wouldn’t use linear regression for graphing your data. A value of +1 or -1 indicates a perfect direct or indirect relationship between x and y. The correlation coefficient indicates how closely the points on your graph fit a straight line. Make sure you type the comma between the two sets of data points. Link to visual aide on correlation coefficient. So if your slope was negative type a negative sign in front of your r value.949).974.) The cursor will appear and you can make your changes. if R2 was 0. exponential or polynomial). if the slope value was negative then the r value will be negative (See graph labeled Figure 2). but two separate clicks.g. whereas a correlation less than 0. If your slope value (b) was positive the r value is positive (See graph labeled Figure 1). (Perhaps it is logarithmic.g. etc.5 is generally described as weak. If the cursor . Change font. higher SAT scores do not cause higher college grades). A correlation greater than 0. r = 0. font size. Formatting Your Graph To change the graph axes labels Click twice on the item to be changed. To format the axes numbers Put the cursor on the axis whose numbers you wish to format. (Note: this is not a double click.

Type in the word ‘unknown’ in the empty space at the end of the y column.100/29.514 or =B12/29.is correctly positioned over the axis it will read Horizontal (Value) axis or Vertical (Value) axis. Click outside graph and scroll back to your table.514.514x.100 for example. This would mean a. If you knew y value for the unknown was 0. B12 to save time. Solving for Unknown x or y To solve for x when you know y. (If your y intercept was zero you only need to type the y value without parentheses. 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’. Format your axis numbers as you wish.514.g. Right click on the axis line. the y intercept.) Now type in / and the b value (slope) from the equation on your graph. Suppose the equation on your graph is y = 29. ( If the number is very long you can just type the letter and number of the cell e. Move pointer to the empty space at the end of the x column.) Now type . is zero since it doesn’t appear and b is 29. Type in the word 'unknown'.then the a value (y intercept) from the formula on your graph and a closing parenthesis. Type = then a parenthesis then the y value you just entered. Now move pointer to the box below the one where you just typed ‘unknown’. you would type =0. This is so the instructor knows this is where you calculated your unknown. .

then * and the x value you just typed under 'unknown' in the x column. Now enter the x value for the unknown in the box below the one where you typed ‘unknown’.0.Then hit Enter and that will give you your x value at that y. (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.98. Suppose the equation on your graph was y = .98 Hit Enter and that will give you your y value for that x.421*A12)+27.g. Type = then type a parenthesis then the b value (slope) from the equation on your graph. Move pointer to the empty space at the end of the y column. To solve for y when you know x. Type in the word 'unknown' in the empty space at the end of the x column. . Type in the word 'unknown'. A12) Now type the closing parenthesis then + then the a value (y intercept) from your graph. Now move the pointer to the cell below the one where you just typed ‘unknown’ in the y column.421x + 27. You would type =(-0. then the closing parenthesis then + then the a value (y intercept) from your graph.

C4. C.g. D4. etc. Add a descriptive title to your graph e. for ys.all cells with heading titles and values. The calories for the pine siskin will be typed in the 4 row e. Figure 1. MAKING A MULTI-LINE GRAPH Say you want to chart several lines on the same graph . C5. in our example Temperature (°C) in the A cell below the cell in which you typed the table number and title.if this is your first graph in a lab report or journal article type in Figure 1. D6. D7.g. etc. . B7. Your temperature values will be typed in the numbered rows e. Select the table as you did for a single line graph . C6. C7. B5. If you want your data in columns than headings will be in A cell for x and B.g. Say you wanted your data in rows. In the A cell below the x axis heading type in Calories English sparrow. Otherwise only the graph and and not the accompanying table will be printed. Click to see an example of a single line graph.Adding the Figure Number and Title to Your Graph In a cell below your graph type in the Figure number e. B6. B4. etc. The calories for the purple finch will be typed in the 3 row e. To see what your graph will look like prior to printing.g. D etc.g. etc. The calories for the English sparrow will be typed in the 2 row e. D5. Effect of Concentration on the Absorbance of New Methylene Blue Dye at a Wavelength of 675 nm BEFORE PRINTING YOUR GRAPH be sure to click outside the graph area itself. the purple finch and the pine siskin. in the next A cell type in Calories purple finch and in the next A cell type in Calories pine siskin.g. Type in heading for x axis data. click on File and click on Print Preview.for example the effect of temperature on the calories of energy consumed by several bird species say the English sparrow.

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

To put the legend symbol used for each line next to the label above each formula set as seen below. Click on . See below.g. English sparrow over the formulas that pertain to the English sparrow data line. make sure your cursor is in the chart area so chart Tools is in the menu bar. the r values will also be negative when you type them in. Repeat for the remaining lines. Make titles for each set of formulas as soon as each set is made and moved to prevent confusion about which formulas go with which line by clicking on the Text Box icon and then clicking the cursor above the set of formulas e. Note: Since the slopes for the lines in this sample graph are negative. Now add the r values using directions for a single line graph.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.

Size your shape and change to the appropriate color. Your shape will appear surrounded by a box. . Click on the shape that matches your legend symbol. Click on Shapes. Click on an empty cell.Insert.

60 Mean = 38. Below are the water volume measurements for the histogram at the end of this document.90 38. For the numbers above that would be 40.25 To get five bars (or any other number you want) on your histogram: Step 1: Subtract lowest value from largest.60 .10 39. If you want three bars divide by 3.50 38. HOW TO MAKE A HISTOGRAM USING EXCEL Histograms are used to represent continuous data.80 37. The bars represent ranges within which your data points fall.Move shape next to label over formulas.90 39. These were used to make a histogram with five equal bars.80.50 40. Sinc .20 38.35.20 38. Click to see an example of a multi-line graph. Step 2: Now divide your answer by the number of bars you want .47 Standard deviation = ±1. Water volume (ml) 35.80 = 4.00 38.

80 + 0.4.72.77-37. First range Step 4: For the second range begin with 36.76. . Delete the title on the histogram as this will be added later underneath the graph as you did in the single and multi-line graph directions.77.96 = 36. See previous directions for formatting a table. Put range values in first column and frequencies in second column.76 and one of the measurements happ whether to count it in the first range or the second range when you determine the frequencies. Now add 0.76) to get the upper value of the second range. because if you use 36. Click on Column (2).96 Step 3: Add this number to your lowest value to get your first range.9 (36.73 Making the table for your histogram Follow previous directions for making a table. Third range is 37. Click on the left most 2D Column graph icon (3). Click on Insert (1). Second range is thus 36. So 35. Select the entire table.89/5 = 0.

Label x and y axes. How to format your histogram. Chart Tools will appear at the top of the screen. Repeat for Primary Vertical Axis Title. Click on Primary Horizontal Axis Title (4). Click on one of the bars of the graph. Click on the Layout file tab if not already selected. Make sure Chart Tools (1) and Layout (2) are selected. Click on Axis Titles (3). Click on Title Below Axis (5). Click on Format .

Selection which is at the far left of your screen. Click on Shapes (2). Click on the straight line (3). . Since you are making a histogram set the gap width to 0. How to Insert a Mean and Standard Deviation Line on your Histogram Click on Insert (1). Click on Close.

Click on the straight line icon to make the end bar for each end of the horizontal line.Draw a vertical line above where the mean would fall. To add the mean and standard deviation values above the line click on the Text Box. Type in yuor mean and standard deviation values and move box over the center of your mean and standard deviation line. icon. A dotted line box will appear in your graph. Click to see an example of a histogram. Click on the straight line icon again to draw a horizontal line from the minus to the plus end of the standard deviation range. .

water volume in ml in A1 box Enter values in A column Skip down a few rows in A column and type in Mean. Since you are making a bar graph set gap width to whatever you want except 0. Click on Format Selection. You will follow the directions above for making a histogram but.g. Chart Tools should appear at the top of the screen. Click on the Layout file tab if not already selected. For Formatting a Bar Graph use the following directions: Formatting a Bar Graph if you want to change the gap width between bars Click on one of the bars of your graph. .HOW TO MAKE A BAR GRAPH USING EXCEL Bar graphs are used when you have data that fit into discrete categories rather than ranges. Now continue with the rest of the histogram directions Click here for an example of a bar graph HOW TO CALCULATE THE MEAN (AVERAGE) USING EXCEL Enter Microsoft Excel as previously described Type in heading e. See example below. Now continue your histogram directions until you reach the section titled Formating your Histogram. Click Close. Select only the y value column of the table. DO NOT select the entire table.

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 your Word document and when you come to the space where you want to add your Excel document click on Control V or Edit/Paste To save Click on File Click on Save Top of Form Bottom of Form . (If you are using a Macintosh computer hold down the Alt key. A4. it would mean that 68% of the tomatoes you weighed were between 95 and 105 grams. hold down the Alt key and type 241 on your number pad. A5. For example if you were weighing tomatoes and got an average tomato weight of 100 grams with a standard deviation of ± 5 grams.Go down to next row and type in =average(range of boxes containing your data) and hit Enter key e. A6 you would type =average(a2:a6) or after the first parenthesis simply select all the boxes containing the data and the range will appear automatically.g. HOW TO CALCULATE THE STANDARD DEVIATION USING EXCEL The standard deviation is a measure of the variablilty of your data.). Now type in the standard deviation value you obtained. A3. It describes a range within which 68% of your values lie.g. E. Add the closing parenthesis and hit Enter. if you entered data in box A2. A5. Add the closing parenthesis and hit Enter. Go down to the next row and type in =stdev(range of boxes containing your data) and hit Enter. Now skip down a couple rows in column A and type in Standard Deviation. A6 you would type =stdev(a2:a6) and hit the Enter key or after the first parenthesis simply select all the boxes containing the data and the range will appear automatically. To insert a ± sign in front of your standard deviations move the cursor down one cell. if you entered data in boxes A2. the shift key and hit the + key. A3. A4. Follow all directions for mean as above.

SINGLE LINE GRAPH .

.

MULTILINE GRAPH .

.

HISTOGRAM .

.

BAR GRAPH .

Sign up to vote on this title