NU Data Excel Orientation Graphing of Screening Data and Basic Graphing Functions.
SPREADSHEET AND GRAPHING WITH EXCEL -...
Transcript of SPREADSHEET AND GRAPHING WITH EXCEL -...
SPREADSHEET AND GRAPHING WITH EXCEL
Table of contents
Introduction 2
Layout of spreadsheet 2
Selecting a group of cells 3
Formatting of Cells and Cell Contents 3
Number format and alignment format 4
Font and border 5
Pattern 6
Type of data entry 6
Number 6
Text, labels, and formulas 7
Statistical analysis and other functions 12
Graphing in excel 13
Printing charts and graphs 28
Conclusion 30
SPREADSHEET AND GRAPHING WITH EXCEL
In the general chemistry curriculum at Norco College, the Excel program is used to record and
manipulate data, perform error analysis, and construct graphs. Although many students may be
quite familiar with Excel already, the following tutorial is written to provide a basic introduction
to Excel and to provide a review of commonly used functions in the course.
There are free tutorials available for Excel 2010 and can be accessed at
https://www.norcocollege.edu/lynda/Pages/Set-Up.aspx . You will need to first set up an
account by following the directions at this website. Refer to the following websites for the
tutorials:
Basics:
https://www.lynda.com/Excel-tutorials/Excel-2010-Essential-Training/61219-
2.html?srchtrk=index%3a3%0alinktypeid%3a2%0aq%3atutorial+excel%0apage%3a1%0as%3ar
elevance%0asa%3atrue%0aproducttypeid%3a2
Shortcuts:
https://www.lynda.com/Excel-2010-tutorials/power-shortcuts/69522-2.html
Charts:
https://www.lynda.com/Excel-2010-tutorials/Charts-in-Depth/81263-2.html
Advanced Formatting:
https://www.lynda.com/Excel-2010-tutorials/advanced-formatting-techniques/74462-2.html
For Excel 2003, the following screenshots and directions are helpful but may vary depending on
if your computer is a Mac or PC.
Layout of the Spreadsheet
Once you have opened the Excel program, choose Normal under View in the main menu bar
located at the top of the screen. You will be presented with a basic format of a spreadsheet.
Main Menu Bar for Excel (varies depending on the version of Excel and Mac or PC)
SPREADSHEET AND GRAPHING WITH EXCEL
The spreadsheet is made up of a series of columns (labeled A, B, C, etc.) and rows (labeled 1, 2,
3, etc.). When you click on any box in the spreadsheet, the column and row will be highlighted
(darker shade as compared to the other rows or columns). In addition, the cell that is selected
will be highlighted around the edges to alert you that this is the active cell (the cell you selected)
and its location is referred to as B6.
Selecting a Group of Cells
To select cells A3 through D14, click on cell A3 and hold and drag the cursor to cell D14. The
group of cells will be highlighted as shown in the figure below.
Formatting of Cells and Cell Contents
The Format option in the main menu bar allows you to do many things with the look of the
cells as well as the contents of the cells. Click on Format, then Cells…, and you should see the
following:
Column “B” Row 6 Cell B6
SPREADSHEET AND GRAPHING WITH EXCEL
• Number Format
o Changes the way values are written ($, scientific notation, etc.) and the number of
decimal places desired (click on Number and it gives an option to identify the
number of decimal places)
• Alignment Format
o Changes the way the contents are aligned in the cells
SPREADSHEET AND GRAPHING WITH EXCEL
• Font
o Allows you to change the type, size and style (superscript, etc.) of font.
• Border
o Allows you to change the border of the cells or a group of cells and the style of
border.
SPREADSHEET AND GRAPHING WITH EXCEL
• Pattern
o Allows you to change the color of the cell and its contents
Types of Data Entry
• Numbers (e.g. 352)
o Highlight the cell and type in the number and hit the Enter or Return key.
o Changing Formatting (scientific notation, decimals, number of digits or
placeholders, etc.)
▪ Select the cell(s) to be formatted
▪ Select Format on the main menu bar
▪ Select Cells…You should see the following screen:
SPREADSHEET AND GRAPHING WITH EXCEL
▪ From here, the most common selection under the Number menu item in
the category section is Number or Scientific. You may choose the
number of decimal places here too. This is useful when ensuring that you
report numbers to the correct number of significant figures.
▪ In addition to number formatting, you may also choose to change the
alignment, font, size, etc.
• Text or labels (e.g. concentration)
o Changing Formatting (font, size, style, etc.)
▪ Process is the same as for formatting numbers. Select Format under the
main menu bar, then select Cells… and then choose the type of
formatting you want (font, size, etc.).
• Formulas (e.g. =C1+D1)
o Excel makes performing mathematical operations on a series of data very easy.
You can add columns of numbers or do any other type of operation.
o Formula always starts with an “=” sign
o Mathematical symbols in order of operation include
▪ Parentheses ( ) or brackets [ ] to group expressions
▪ Exponents (a caret symbol, ^)
▪ Division (a forward slash, /)
▪ Multiplication (an asterisk, *)
▪ Addition (a plus symbol, +)
▪ Subtraction (a minus symbol, -)
For example, make a spreadsheet that contains the following information:
SPREADSHEET AND GRAPHING WITH EXCEL
Next, change the 3 in cm3 to a superscript. Highlight the 3 and then go to Format,
Cells…, and check the Superscript box (see below). Then hit OK to make the change.
Now, let’s change the format of the cells so that the contents of all cells in the table are
aligned in the center. First, click and drag to highlight the table, then go to Format,
Cells…, and Alignment.
Next, choose Center, and then hit OK. Your spreadsheet should look as follows:
SPREADSHEET AND GRAPHING WITH EXCEL
To calculate the volume of the block (L x W x H) using the formula function in Excel for
trial 1, first click on cell E7. Then type in the equal sign, “=” (all formulas begin with an
equal sign), and click on each of the three cells that contain the desired data with the
multiplication sign in between: B7 * C7 * D7.
After pushing the Return key, the screen looks like the following:
You have now calculated the volume by multiplying the length times the width times the
height. Instead of calculating the volume by hand, we did it by using Excel by entering a
formula. If you double click again on cell E7, it will show you the formula that was
used. Next, let’s copy the formula in cell E7 and paste it in the remaining two cells in
order to calculate the volume for trials 2 and 3. First copy the formula in cell E7 by
clicking on the cell, then by pushing the Control and c button at the same time. You can
do this another way by going under Edit in the main menu bar and clicking on Copy.
Next click and drag to highlight cells E8 and E9. The cells should be highlighted as
follows:
Notice the location of the formula that was copied has a dashed line around it and the
location of where the formula will be pasted is highlighted around the cell’s perimeter
and shaded.
SPREADSHEET AND GRAPHING WITH EXCEL
Next, hit the two buttons Control and p (for paste) and hit return. The volumes will be
now calculated for Trials 2 and 3.
The number of significant figures for volume should be 3 so the format for the cells E7-
E9 needs to be changed to reflect this. Make sure that these cells are highlighted. Then
go to Format in the main menu bar, then Cells… then Number.
Click on 1 decimal place and hit OK and now the results are shown with three significant
figures.
SPREADSHEET AND GRAPHING WITH EXCEL
Double click on each cell going from E7 to E9. Notice the formula will appear in each
cell and that the cell number only changes. By copying the cell in E7 we essentially
copied the “relative” cell. In other words by pasting the formula in the next two cells
below this, the relative location is kept (column B) but the row number changes. This
allows you to copy and paste formulas for a large amount of data which makes your life
MUCH easier!
You can further customize your table by making borders, colors, etc. For example, let’s
place a border around the entire table and around each cell. Click and drag to select cells
of the table and then click Format, Cells…, and then Border. From here, choose the
Outside, Inside borders and increase the Line thickness for the border. Play around with
the options to get more familiar with these features.
The result is as follows:
SPREADSHEET AND GRAPHING WITH EXCEL
Statistical Analysis and Other Functions
Functions can be used to calculate the average, standard deviation, etc. on a large set of data.
Below is a list of some common functions:
• Average: =average(cell range)
• Standard deviation: =stdev(cell range)
• Other functions: (see your Excel help section)
If we wanted to calculate the average volume and standard deviation (an indication to the level of
precision of the measurements), then it is easiest to use functions. Type “avg volume:” and “std
dev” below the “Height” column.
Then click on cell E11. Enter “=average(and then click on cell E7 and drag to cell E9 and enter
a closed parenthesis)”. Select Return.
The average value of volume is calculated for you and is shown in cell E11.
SPREADSHEET AND GRAPHING WITH EXCEL
You can also calculate the standard deviation of the volume by selecting first the cell where the
data is to be located, E12, and then by entering “=stdev(and choose the cell range by clicking
and dragging on cells E7..E9)”.
Select Return to show the value of the standard deviation.
At this point, you should change the number of significant figures in the standard deviation by
changing the format.
Graphing in Excel
Make a spreadsheet with the following information (be sure to also do all necessary formatting
changes).
SPREADSHEET AND GRAPHING WITH EXCEL
You may have to change the column width so that all information can be seen.
You can do this two ways. The first way is to move your cursor over the vertical line between
the B and C column heading. Your cursor should change. Then click on this spot and move
your cursor to expand (or shrink) the column width.
You may also do this by going to Format, Column, then Width to adjust the column width.
You can change the column width on a single column or a block of columns.
Next, in order to graph the data to make a plot of Concentration versus Absorbance data (this is
sometimes called a Beer’s plot or a calibration curve), you need to click on Insert, and then
Chart.
This will bring you to the following choices:
SPREADSHEET AND GRAPHING WITH EXCEL
The first thing to do is choose the type of chart you want. The most common chart to select is
XY (Scatter). You generally do not want lines to go from each point on your plot (like a dot-to-
dot picture). Therefore, select the chart with only points by clicking on the correct picture icon
under Chart sub-type (see above). Click Next to finish the graph.
You next come across the Data Range screen. You may either enter the data range by hand,
B6:C9 (the two dots between the cell addresses means to use all cells including and in between
these cells) or you may choose to use your cursor to click and drag over the data you want
plotted.
If you used your cursor to select the data range, your screen will look like the following:
SPREADSHEET AND GRAPHING WITH EXCEL
At this point it is CRITICAL to make sure you plotted the correct data for the graph. In other
words, make sure that concentration values are on the x-axis and absorbance values are on the y-
axis (check a couple of data points to verify that Excel is plotting what you intended). This
happened automatically in this example because the table of data listed the x data in the first
column and the y data in the next column.
If you did not plot the correct data you will need to go to the Series option and reselect the
correct data to plot (see below).
Note that the y data points are considered series data. If you have more than one set of y data
(several series of data), you can add more to the existing plot by selecting Add. Next, click and
drag or type in the correct data range for a particular series in the Y box. You can toggle
between the different series by clicking on the series of interest in the Series box (not the Series
tab!). You can also delete a series of data by first clicking on the series of interest in the Series
SPREADSHEET AND GRAPHING WITH EXCEL
box and clicking on Remove. However, this plot has only one series of data (one set of y
values).
Click the Next button and continue with the graph. The next screen looks like the following:
Fill in the table for your Chart title and Axes labels (see below), and then click on Next.
You have other choices in this screen as well. Click on Axes to see your options here.
SPREADSHEET AND GRAPHING WITH EXCEL
Click on Gridlines to see your options on placing horizontal and/or vertical lines on your graph.
Uncheck the Major gridlines box (and any other box) so that no gridlines appear on your graph.
SPREADSHEET AND GRAPHING WITH EXCEL
Click on Legend to see your options here.
The legend shows what series were plotted. The legend is most useful if more than one series is
plotted (i.e. more than one set of y values are plotted on the same graph which then requires a
legend to distinguish between the data sets). Since there is only one set of y values plotted,
deselect the Show legend box so that no legend appears on the graph.
SPREADSHEET AND GRAPHING WITH EXCEL
The Data labels option in this menu allows you to show the x and y values for each data point.
This is not commonly used on graphs. Select Finish to finish the graph.
You will then be asked to save the graph as part of the worksheet (As object in) or as a separate
worksheet (As a new sheet). It is easiest to save the graph as part of the worksheet since it
makes printing data and the graph together much easier. Select As object in. The screen should
look as follows:
SPREADSHEET AND GRAPHING WITH EXCEL
If you want to manipulate anything on the graph to further modify it, click once anywhere on the
graph. You will notice that the graph is outlined now and that there is a new menu that appears
at the top for graphing. Your computer may not show a new menu automatically. If not, go to
View, Toolbars, and then Graph to add a new menu bar. Notice also that there are other menu
bars that you can select to be shown instead of having to scroll through all of the choices on the
main menu bar. The spreadsheet now has two parts, a data part (where the cells are located) and
a graph part. If you want to alter anything on the data part of your spreadsheet, just click any cell
and the main menu bar changes so to reflect that you are working on the data part of the
spreadsheet (gives you menu options for changing the data part of the spreadsheet).
If you click anywhere on the graph part, the main menu bar changes to reflect that you are
working on the graph (gives you menu options for changing the graph).
SPREADSHEET AND GRAPHING WITH EXCEL
You can continue to customize your graph by double-clicking on any portion. For example if
you double click (or right click for PC users) on an axis, you can make changes to the axis
(change the scale, etc.).
For now, let’s make the 2+ in the Chart title a superscript. Highlight the 2+ with your cursor,
then go to Format and then Selected Chart Title.
The next screen should look like the following:
Check the Superscript box and then OK. The 2+ should now be a superscript.
SPREADSHEET AND GRAPHING WITH EXCEL
Let’s now alter the axes information and its format. Let’s explore this first by double-clicking on
the y-axis. You will get a screen that looks like the following:
In this screen, you can alter the cross or tick marks on your scale and the line thickness. Under
the Major tick mark type (tick marks besides the numbers on the scale), select Cross. Under
Minor Tick Mark type (tick marks between the major tick marks) select None. There are many
SPREADSHEET AND GRAPHING WITH EXCEL
styles to choose from here but it is recommended to choose a major tick mark and possibly a
minor tick mark. Click on OK to finish.
Now you have tick marks on the y-axis. Notice the absorbance values on the y-axis have either
one or two decimal places while the data in the spreadsheet has 3 significant figures. One way to
address this discrepancy is to change the number of decimal places to reflect the number of
decimal places you know for certain. The estimated digit in your measurements should be
determined by interpolating between the tick marks on your graph.
You will need to change the decimal places to two. To do this, first be sure your y axis is
selected (double-click) and choose the Number option in the Format Axis menu screen.
Choose Number and 2 decimal places and then click OK. Your graph on your spreadsheet
should look like the following:
SPREADSHEET AND GRAPHING WITH EXCEL
You can now estimate to the thousandth’s place for the absorbance values on the y axis which is
consistent with the measured absorbance values which is estimated to the thousandth’s place.
You should also check the x axis values to make sure the concentrations can be read to the
proper number of significant figures adjusting the tick marks on the x axis accordingly.
If you measured the absorbance of an unknown, you could then determine the concentration of
the unknown using the plot above after making the best-fit line through all of the data. Another
way to determine the concentration of an unknown is to determine the slope of the best-fit line,
which would give the Beer’s constant. The Beer’s constant is useful so that when you measure
the absorbance of an unknown Fe(SCN)2+ solution, you could determine its concentration by
using Beer’s Law: A = bC where A is absorbance, C is concentration and b is Beer’s constant.
This equation works if the y-intercept is equal to zero, i.e. the best-fit line passes through (0, 0)
on your graph. You could determine the slope of the line graphically (change of y over change
of x) or by doing a linear regression of the data since the relationship between absorbance and
concentration is linear. In either case, a best-fit line is needed which requires a linear regression
of the data. To do the linear regression, click on anywhere on your graph so that the graph main
menu bar appears at the top of your screen. Click on Chart, then on Add Trendline.
Next, select Linear.
SPREADSHEET AND GRAPHING WITH EXCEL
You can format the trend line and display the equation and the coefficient of determination (R2)
on the chart by selection Options and selecting the appropriate boxes. Checking the Set
intercept to zero box (you should discuss this with your professor first as to whether this should
be done for your specific graph) will force the line through zero. Checking the next two boxes
“Display equation on chart and Display R-squared value on chart” will display the equation
and the R2 value on the chart. The equation of the line (y = mx + b) gives two pieces of
important information, namely the slope (m) and the y-intercept (b). The R2 value gives you an
indication as to the degree that the data best fits a line (generally the closer the data fit a straight
line, the higher the R2 value. The maximum value for R2 is 1).
Click OK after selecting all three boxes.
SPREADSHEET AND GRAPHING WITH EXCEL
The displayed equation and the R2 value can be moved around on the chart if needed so that it is
not on the line by clicking on the text box and dragging it to another spot on the chart. Your
graph should look like the following:
There may be a time when you need to increase the number of significant figures on the slope
and/or y-intercept in your regression output (some programs round it to 1 significant figure and
this introduces a lot of rounding error in any subsequent calculations using this data). You can
estimate the number of significant figures that should be in your value of the slope by doing a
quick calculation by hand of the slope by choosing two data points on the line and estimating
these points to the proper number of significant figures. Use the correct rules for significant
figures when doing the calculation to determine the number of significant figures that should be
in your final slope value. Then, adjust the number of decimal places in the output of the
regression data to have a few more digits than required in order to minimize rounding errors in
subsequent calculations that require the use of the slope value.
Double-click on the regression data in your graph. Then select Number in the Format Data
Labels screen, then choose Number and 3 decimal places and then click OK.
SPREADSHEET AND GRAPHING WITH EXCEL
Your regression data should now show 3 decimal places in the slope of the line on your graph.
You now could either use the value of the slope to determine the concentration of an unknown if
the absorbance of an unknown is known using Beer’s Law or you could calculate the
concentration of the unknown using the graph only by finding the absorbance of your unknown
on your graph and moving over to where it intersects the line and then by reading the
concentration at that point.
Printing charts and graphs
Unless color is needed, it is best to change the color of the plot area of the chart to white. Click
on the chart so that it is selected. Under Format, choose Selected Plot Area. In the Colors and
Lines tab, under Fill, change the color by selecting No Fill. Click OK. This will change the
background of the plot area to white.
SPREADSHEET AND GRAPHING WITH EXCEL
If both the data table and chart are to be graphed on the same page, select both by clicking and
dragging the mouse over the entire area. Notice that selected area has dashed lines around it and
is highlighted. Under File, select Print Area, then Set Print Area. Then choose Print under
File. If on the other hand, only the graph is to be graph, click on the chart so that it is highlighted
and then click File and then Print.
The graph or the data table and graph can be printed in one of two styles: Portrait (vertical) or
Landscape (horizontal). Choose the appropriate style under File, Page Set Up. It is always a
good idea to do a Print Preview so that any mistakes can be fixed before the actual printing.
Doing so will save you time and paper.
SPREADSHEET AND GRAPHING WITH EXCEL
There are a variety of short cuts and icons that can be used to make working in Excel easier that
are not covered in this tutorial. Although the format of the spreadsheet might change depending
on the version of Excel or Mac/PC, the basic guidelines will remain fairly the same. For
additional help with items not covered in this tutorial or on more advanced Excel features, see
your professor.