Vous êtes sur la page 1sur 25

Introduction to Excel

When you start up Excel97, you will see a screen like the following. Familiarize yourself with the various components of the spreadsheet.

Menu bar ChartWizard Reference of selected cell Formatting Numeric formatting Format cells Selected cell Current worksheet

Data and cell references All information in a spreadsheet is entered through data in cells. Each cell has a unique reference given by its column letter and row number. For example, the blue cell below is referenced as B38. <--------- Click into this cell. You'll notice that the cell reference box above the column headings says "B38". Also, you know the reference of the cell by locating the column and row that it belongs to. You can also have a range of cells. The yellow range below can be referenced by c44:g44

To select a range, click into the beginning of the range of cells. Hold down the mouse and drag to the end of the range. Check it out Formulas Select the range of cells b45:h45 Select the range of cells j42:j48

Copyright (c) 2003 R.Narasimhan

Page 1 of 25

Once you have entered data into cells, you will want to perform some operations with them. Basic arithmetic operators are: + : addition - : subtraction / : division * : multiplication ^ : exponentiation

The usual order of operations holds. Using the above operators, you can write formulas which manipulate the data you have entered in cells. Example 1 Solution Let x=3. Calculate f(x)=x^3-4x. We need to store the x value in a cell. We also need to store the x^3-4x result in another cell. Hence, we can make a simple table as follows. Note that you can enter text into a cell as well. Using a spreadsheet makes it easy to annotate your work. x 3 f(x) 15

Now, the value of x is contained in the cell D72. The value for f(x) is computed by the formula using the cell reference D72 in place of x. So, the formula for f(x) using cell references is =D72^3-4*D72 This formula is typed into the cell E72. (Note: E72 is the same as e72) Check it out Change the value in D72 from 3 to some other number and press <Enter>. What do you notice? Change f(x) to be f(x)= 2x^2+1. Enter the formula using cell references in E72.

Check it out

Copying and Pasting Now suppose you want to compute f(x) in Example 1 for x =1,2,3,4,5. You also want to display all these values simultaneously by creating a table. Instead of typing the formula over and over again, we can copy and paste. This is illustrated in the next example. Example 2 Compute f(x) for x=1,2,3,4,5 and display the results in a table. Solution Make columns for x and f(x). Enter the x values that you are interested in: x f(x) 1 2 3 4 5 In the yellow f(x) cell, enter the formula for f(x)= x^3-4x. This gives the following: x 1 f(x) -3

Click into this cell to see how the formula is entered Page 2 of 25

Copyright (c) 2003 R.Narasimhan

2 3 4 5

Click into this cell to see how the formula is entered

Since we want to compute the values of f(x) for the other values of x as well, we can copy the formula in the yellow cell as follows: 1. Select the yellow cell in the above table. Press <CTRL>c to copy. 2. Select the rest of the f(x) column. Press <CTRL>v to paste. Note that the cell references automatically change to the x-value directly to the left of the y-value. Once you do this your table will look like the following: x 1 2 3 4 5 f(x) -3 0 15 48 105

Click into these cells to see how the formulas are entered

Copyright (c) 2003 R.Narasimhan

Page 3 of 25

Formatting and Printing


Saving files Once you have done some work in your worksheet, you will want to save it first: SAVE by going to the File menu and selecting Save As (if this is a new file) or Save (if you are resaving to an existing file). A dialog box will appear and it is self explanatory. Formatting pages You will also want to format your work. Excel has many ways to help you beautify your work, and it would fill many pages to describe all the possibilities. Some basic page formatting will be done in the Page Setup option under the File menu. Check it out

Pull up the Page Setup option and set margins, headers, footers, etc.

Previewing and Printing You will next want to preview your work, so you bring up Print Preview under the File menu. Check it Use Print Preview to preview your work after page setup. out When you are ready to print, choose the Print option under the File menu Formatting data and tables But what about formatting your data and tables... Once again, the possibilities are endless! The second row of icons in the tools bar are all devoted to helping you format your data etc. Check it out

Point your mouse at each of the icons in the second row of the toolbar to see what it does.

Check it out

Type some text in a cell, select the cell, and click on some of the formatting icons.

With all these bells and whistles, it is easy to get carried away and produce very busy looking documents. Keep your formatting simple. Highlight the information you want. Do not use too many fonts and too many sizes of letters. Inserting Rows, columns, worksheets To insert rows and columns, select the insertion point and go to Insert in the menu bar. To insert a new worksheet, simply choose Insert -> Worksheet More Formatting...

Copyright (c) 2003 R.Narasimhan

Page 4 of 25

You will often want to increase width of a column. This is easy - position your mouse cursor at the very top of the column line that you want to widen. You will see a small picture like <--||--> Use your mouse to widen the cell. To wrap text within a cell, go to Format menu, choose Cells option . Go to the alignment tab and check the Wrap text box. These are some basic formatting operations which you will use often. Consult a general Excel guide for a more extensive review.

Copyright (c) 2003 R.Narasimhan

Page 5 of 25

Tables in Excel
In order to use the graphing features of Excel, you will need to generate tables of x and y values first. In this section, you will learn to easily generate equally spaced entries for use as x-values. Example 1 Let us generate a table of values from -2 to 3 in increments of 0.5. We could of course do this by hand but that would be laborious. Let us have Excel automatically generate this table by using the Fill feature. Solution -2 1. Let the first x-value begin in the blue cell at left. 2. Select the blue cell with the mouse. 3. In the menu bar, go to Edit -> Fill -> Series You will get the following dialog box.

4. You usually want your list in columns; so check the columns box for "Series in" section. The type is "linear" since we want equally spaced points. Step value is set to 0.5 since our increments are in 0.5. Stop value is set to 3, since that is where we terminate. Click OK 5. On your left you should now see a filled column of values from -2 to 3 in increments of 0.5, like the one below. -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3

Copyright (c) 2003 R.Narasimhan

Page 6 of 25

Shortcut If you are filling a column or row of equally spaced values, you can type in the first two values of the series in two adjacent cells, highlight the two cells, and drag the values down by moving your mouse to a cross hair at the lower right hand corner of the selected cells. A table of x and y values Example 2 Suppose we want to generate x and y values in a table. For example, find f(x)=3x-2 for the x-values given in the table above. Solution Make a table with x and f(x) column headings. Fill the x-column as directed in Example 1. x -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 f(x) -8 Note: the table was formatted with borders using the formatting icons in the rightmost section of the second toolbar

Next, we need to fill in values for f(x). As you know, Excel only understands cell references. Therefore, the first y-value will have the formula =3*d61-2 Click into the yellow cell and see how the formula is entered in the cell entry box right below the toolbars. We next fill the entire f(x) column by simply copying and pasting the formula in the yellow cell: 1. Select the yellow cell in the above table. Press <CTRL>c to copy. 2. Select the rest of the f(x) column. Press <CTRL>v to paste. Note that the cell references automatically change to the x-value directly to the left of the y-value.

Copyright (c) 2003 R.Narasimhan

Page 7 of 25

Copyright (c) 2003 R.Narasimhan

Page 8 of 25

ype in the first two d drag the values down by f the selected cells.

Copyright (c) 2003 R.Narasimhan

Page 9 of 25

Graphs of Functions

Graphing a single function To graph functions in Excel, you must first create a table of data with the information about the x and y values. You then use Chart Wizard to create the plot. The following example will take you through the process step by step. Click for help Example 1: Let us graph the function f(x)=2x^2+x. on Tables We first create a table of x and y values. The y-values are given by f(x). x -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 f(x) 6 3 1 0 0 1 3 6 10

Next, select the entire table. A special macro called "grapher" has been written to plot the table of values. Press the "grapher" button to the right side of the table. You should see a graph similar to the one below. (The grapher button does not appear in printouts of worksheets.) You can also access grapher anywhere in this workbook by pressing <CTRL>g
f(x) 12 10 8 6 4 2 0 -2 0

f(x)

-3

-2

-1

Click out of the graph that you created. You can also click back into it and move, resize or delete it. Practice a little with your graph. Check it out Modify the above table to graph the function f (x) = 3x 2 + 4 with the same set of x-values. Make sure you change all the entries in the y-column. You can copy the formula from the first y-column cell, then select the rest of the column and paste the formula using <CTRL>V

Copyright (c) 2003 R.Narasimhan

Page 10 of 25

Remarks

Notice that you have to specify the x-range of values in order to create your table and then the graph. You must pick a suitable x-range so that the salient features of the graph are captured. This may take a few trials before you get a suitable range of x-values.

Graphing more than one function To graph more than one function on the same plot with the same x-range of values, simply create a table with multiple column headings, one for each function. The next example illustrates this. Example 2 Solution Graph f(x)=x^2 and g(x)=x^3 on the interval [-2,2]. We create the following table with x-spacing of 0.5. Note that f(x) and g(x) each have a separate column. x -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 f(x) 4 2.25 1 0.25 0 0.25 1 2.25 4 g(x) -8 -3.375 -1 -0.125 0 0.125 1 3.375 8

Invoke the grapher by pressing <CTRL>g. You will see a graph like the one below.

10 5 0 -3 -2 -1 -5 -10 0 1 2 3
f(x) g(x)

Check it out

Graph the functions f(x)=x^3 and g(x)=3x+1 on the same graph. Use x values from -3 to 3 with x-spacing=0.5. This example is on p.61.

Changing options in the graph You can change the scale of the x and y-axes by clicking into the graph and double clicking into the axes you wish to customize. The options that are possible are too numerous to mention here. The best way is to play around with the dialog boxes. Similarly, you can change the colors of the lines that are graphed by clicking graph and double clicking the lines. Have fun exploring!!

Copyright (c) 2003 R.Narasimhan

Page 11 of 25

Graphs of Rational Functions


To graph functions in Excel, you must first create a table of data with the information about the x and y values. You then use Chart Wizard to create the plot. The following example will take you through the process step by step. Unlike the previous example, however, you must be careful when working with functions which may not be defined for certain values of x. Click for help Example 1: Let us graph the function f(x)=1/(x-1) on Tables We first create a table of x and y values. The y-values are given by f(x). This function is not defined at x=1, and so that space for the y-value is left blank. x -1 -0.5 0 0.5 1 1.5 2 2.5 3 f(x) -0.5 -0.66667 -1 -2 2 1 0.666667 0.5

Next, select the entire table. A special macro called "grapher" has been written to plot the table of values. Press the "grapher" button to the right side of the table. You should see a graph similar to the one below. (The grapher button does not appear in printouts of worksheets.) You can also access grapher anywhere in this workbook by pressing <CTRL>g

f(x) 2.5 2 1.5 1 0.5 0 -1 -0.5 0 -1 -1.5 -2 -2.5

-2

f(x)

If you need a closer look at the graph near x=1, you need to generate a new table

Copyright (c) 2003 R.Narasimhan

Page 12 of 25

from, say, 0 to 2 in increments of 0.1. x 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 f(x) -1 -1.11111 -1.25 -1.42857 -1.66667 -2 -2.5 -3.33333 -5 -10 10 5 3.333333 2.5 2 1.666667 1.428571 1.25 1.111111 1

f(x)
15 10 5 0 0 -5 -10 -15 1 2 3
f(x)

Select the above table and press <CTRL>g to invoke the grapher and you should get a graph similar to the one above.

Copyright (c) 2003 R.Narasimhan

Page 13 of 25

Finding Zeros of a Function with Goal Seek


Finding x-intercept of a line To find the x-value where a function is zero, you can use a feature of Excel called Goal Seek. The next example will tell you how to use Goal Seek. Example 1 Let the profit function for a company be given by p(x) = 200x - 4000, where x denotes the number of items produced. The manufacturer wants to know how many items to produce to break even. That is, she wants to know when the profit will be zero. Solution First we make a table with x and the formula for p(x): Click into the cell to see x 10 p(x) -2000

Change the value of x and see what happens to p(x). Now, we want to find the value of x such that p(x) = 0. Since this is a linear equation, there will be only one such value. To do this, go to Tools -> Goal Seek. You will get the following dialog box:

Note: the boxes on the left are just pictures! You need to go to the Tools menu and start Goal Seek to get the real thing.

In the Set Cell box, click the yellow box which stands for profit. In the To Value box, type in 0. Hence, you should see the following:

Next, you want to fill in the last box called By changing cell. This is the x-value. Therefore, click into the blue cell, and the dialog box will automatically record its cell reference. Your completed box should look like the following:

Copyright (c) 2003 R.Narasimhan

Page 14 of 25

Click OK, and you will see the following box.

Click OK and the cell values in the blue and yellow boxes for x and p(x) will be changed accordingly. Check it out Scroll up to see what solution Goal Seek gave you. You should get a value of x=20 to make p(x)=0. This means that the company must make at least 20 products before realizing a positive amount of profit. Redo the problem by hand and recheck the solution. Exercise What is the break-even point if p(x) = 300x-8800?

Copyright (c) 2003 R.Narasimhan

Page 15 of 25

Finding zeros of a parabola You know from algebra that a parabola could have 0,1 or 2 x-intercepts. Also, Goal Seek will return only one x-intercept at a time. Which one it returns depends on the initial value of x which is already in the box when you start Goal Seek. In the previous example, we knew there would only be one x-intercept, and since the function was linear, it did not matter what value x had when starting. Therefore, it is advisable to graph the function before starting Goal Seek. You can then set the initial value for x close to the x-intercept you are interested in. We will illustrate this in the next example.

Example 2 Solution

Find the zeros of the function

f(x) = x^2-6x+7 .

We first make a table of values and then graph the function using the grapher macro. x 0 1 2 3 4 5 6 f(x) 7 2 -1 -2 -1 2 7

Click for help on Tables

Now select the entire boxed region above and press <CTRL>g to start the grapher macro. You will get a graph like the following: f(x) 8 6 4 2 0 -2 0 -4

f(x)

We see that there is one x-intercept near 2 and another near 4. We can start Goal Seek in the following table with the starting value of x=2.

f(x)

Copyright (c) 2003 R.Narasimhan

Page 16 of 25

-1

Invoke Goal Seek from Tools-> Goal Seek, and follow the directions given in the previous example. The box should look like the following after you entered all pertinent data.

Click OK and you should get the following window.

The x-intercept near 2 is approximately 1.585816. Note that Goal Seek gives an approximate answer. The y-value is very small but not quite zero. Check it out Find the x-intercept near 4 using Goal Seek. Your answer should be 4.414

Note: The grapher macro will work only within this workbook. To use it for your problems, insert a new worksheet within this workbook by choosing Insert -> Worksheet in the menu bar. You can then have access to the grapher macro by pressing <CTRL>g

Copyright (c) 2003 R.Narasimhan

Page 17 of 25

Finding Intersections of Graphs of Functions with Goal Seek


Before starting this worksheet, make sure you review the worksheet on finding zeros.

Click for help on


Finding zeros

We can use Goal Seek to find the intersection points of graphs of two functions. The next example will show you how. Example Suppose you want to determine the intersection of the graphs of the functions f(x)=x^3 and g(x)=3x+1. Solution We first create a table of values for f(x) and g(x) as shown in the worksheet for graphs of functions. X-values range from -3 to 3 with an x-spacing of 0.5. x -3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 f(x) -27 -15.625 -8 -3.375 -1 -0.125 0 0.125 1 3.375 8 15.625 27 g(x) -8 -6.5 -5 -3.5 -2 -0.5 1 2.5 4 5.5 7 8.5 10

Graph the boxed region above by selecting it with the mouse and pressing <CTRL>g to invoke the grapher. You will get a graph similar to the one below.

30 20 10 0 -4 -2 -10 -20 -30 0 2 4


f(x) g(x)

There are three points of intersection: one near x=-2, another near x=0, and the third near x=2. We can now call Goal Seek. Remember that Goal Seek can find the zeros only one at a time.

Copyright (c) 2003 R.Narasimhan

Page 18 of 25

The following table has been set up to use Goal Seek. Note that there is a new column titled "f(x)-g(x)". The intersection points are those where f(x)-g(x)=0. This is equivalent to the statement f(x)=g(x). Goal Seek will give an error if you try to set value of f(x) equal to g(x). That is why we must use f(x)-g(x) as the Set Cell reference. First Intersection Point: Since this intersection point is near x=-2, the starting value of x will be -2 x -2 f(x) -8 g(x) -5 f(x)-g(x) -3

Follow the same steps as in the worksheet Zeros of Functions to call Goal Seek. We set the yellow colored cell to zero by changing the x-value in the blue cell. Your box should look like the following.

Goal Seek Help

Click OK and you will get one of the intersection points in the blue box. The approximate answer is -1.53. You should get this answer. Second Intersection Point: Since this intersection point is near x=0, the starting value of x will be 0. x 0 f(x) 0 g(x) 1 f(x)-g(x) -1

Invoke Goal Seek as above. Fill in all cell references. Your answer should be approximately -0.35. Check it out Use the procedure outlined above, find the third intersection point. It should be approximately 1.88.

Copyright (c) 2003 R.Narasimhan

Page 19 of 25

Linear Regression
Linear regression is a procedure where we fit a linear function to a set of data which seem to exhibit a linear relationship. It uses all the data points, not just two. Hence, all the points in the data set may not necessarily pass through the line. Let us illustrate how to find the line of best fit using the functions in Excel. Example 1 The following table lists data showing the price P of a one-day adult admission to Disney World for years since 1993. Fit a regression line to this set of data. x: yrs. P: price since of adult 1993 ticket 0 34 1 36 2 37 3 40.81 4 42.14 5 44.52

Year 1993 1994 1995 1996 1997 1998 Solution

We first make a scatterplot of the data. Step A: Scatterplot 1. Select the x and the P columns above, including the column headings. 2. Click on the Chart Wizard icon. You should see the following

Copyright (c) 2003 R.Narasimhan

Page 20 of 25

3. Select the XY Scatter for chart type. Select the dots only for chart sub-type. See the figure below.

4. Click the Next button. You will see the following

5. Click the Next button. You will get a screen with options. Simply press

Copyright (c) 2003 R.Narasimhan

Page 21 of 25

the Next button. 6. You will now at Step 4. Click the box that says to include the chart in this worksheet. Then press the Finish button. Congratulations! You have finished your scatterplot. It should look like the following.

P: price of adult ticket 50

40
30 20 10 0 0 2 4 6
P: price of adult ticket

Step B: Inserting the regression line 1. Single-click any one of the data points in the scatterplot you created. All points will be highlighted. 2. In the menu bar choose Chart -> Add Trendline. You see the following. Choose the linear box.

3. Click into the options tab and check the box that says "display equation". Click OK. You chart will be similar to the one below.

Copyright (c) 2003 R.Narasimhan

Page 22 of 25

You can click into the equation box and move it to place it where you can read it better.
P: price of adult ticket y = 2.138x + 33.733 50 45 40 35 30 25 20 15 10 5 0 0 2 4 6

P: price of adult ticket Linear (P: price of adult ticket)

We are finished and the equation is y = 2.138x + 33.733. Check it out Use the equation above to predict the ticket price in 2000.

Copyright (c) 2003 R.Narasimhan

Page 23 of 25

Polynomial Regression
Not all data sets possess a linear relationship. Some may be better fit through a quadratic, cubic, or even a quartic. Polynomial regression is easy to perform in Excel. The next example shows you how. Example The following chart gives the age and average number of live births per 1000 women. We would like to fit a quadratic and cubic function to this set of data and see which function fits the data better. # live births per 1000 women 34 86.5 111.1 113.9 84.5 35.4 6.8

Age 16 18.5 22 27 32 37 42 Solution

Fitting the quadratic function You essential follow the same steps as in the Linear Regression worksheet. Step A Follow all items in Step A of linear regression worksheet

Step B 1. Single-click any one of the data points in the scatterplot you created. All points will be highlighted. 2. In the menu bar choose Chart -> Add Trendline. You see the following. Choose the polynomial box with Order 2 for the drop down box.

3. Click into the options tab and check the box that says "display equation".

Copyright (c) 2003 R.Narasimhan

Page 24 of 25

Click OK. You chart will be similar to the one below. You can click into the equation box and move it to place it where you can read it better.

# live births per 1000 women y = -0.4868x2 + 25.95x - 238.49 120 100 80 60 40 20 0 -20 0
# live births per 1000 women Poly. (# live births per 1000 women)

20

40

60

The equation is y=-0.4868x^2 + 25.95x - 238.49 Fitting the quadratic function Follow Step A as above. In Step B, part 2, change polynomial order to 3 for a cubic. Then follow the same steps as before. Check it out Find the best cubic for this set of data. Your final graph should be similar to the following.

150 100 50 0 0 20

# live births per 1000 women y = 0.0314x3 - 3.2196x2 + 101.18x - 886.93


# live births per 1000 women Poly. (# live births per 1000 women)

40

60

We see that the cubic function is a better fit for the data that was given.

Copyright (c) 2003 R.Narasimhan

Page 25 of 25

Vous aimerez peut-être aussi