• No results found

CSC102B Excel TUTORIAL

N/A
N/A
Protected

Academic year: 2021

Share "CSC102B Excel TUTORIAL"

Copied!
107
0
0

Loading.... (view fulltext now)

Full text

(1)

COVER PAGE

CSC102B

Excel

TUTORIAL

©2003 and beyond, Lawrence Morales
(2)
(3)

TABLE OF CONTENTS

COVER PAGE ... 1

TABLE OF CONTENTS ... 3

BASIC EXCEL FACTS AND USAGE... 5

BASIC INTRODUCTIONS TO A SPREADSHEET... 5

ENTERING DATA... 6

EDITING CELL CONTENTS... 8

Changing Cell Formats... 8

Changing Row and Column Sizes ... 13

Changing Cell Contents ... 14

WORKING WITH FORMULAS... 14

COPYING FORMULAS... 15

ABSOLUTE REFERENCES... 19

SORTING DATA... 21

BASIC MATHEMATICS COMPUTATIONS ... 29

BASIC MATHEMATICAL FUNCTIONS... 29

Addition... 29

Subtraction... 30

Multiplication... 31

Division... 31

Powers and Exponents ... 32

The Natural Base, e... 33

Square Roots ... 34

The Natural Logarithm ... 35

The Value of π... 35

Rounding... 35

Rounding Up and Rounding Down ... 36

BASIC STATISTICAL FUNCTIONS... 37

Averages and Means ... 37

Sums... 37

Minimums... 38

Maximums... 38

The Range ... 38

DATABASES ... 39

BASIC INTRODUCTION TO DATABASES... 39

THE DCOUNTCOMMAND... 40

THE DAVERAGE,DSUM,DMIN,DMAXCOMMANDS... 44

SPECIAL EXCEL FUNCTIONS... 46

THE COUNT COMMAND... 46 THE COUNTIF COMMAND... 47 THE RAND COMMAND... 49 THE RANDBETWEEN COMMAND... 50 THE IF COMMAND... 51 THE VLOOKUP COMMAND... 57 THE HLOOKUP COMMAND... 59 THE INDEX COMMAND... 60

OPTIONAL:HOW IBUILT THE PHONE LOG FILE... 63

GRAPHING ... 64

BASIC GRAPHING... 64

(4)

GRAPHING HISTOGRAMS... 83

Bins and Midpoints ... 86

Frequency Command ... 89

Formatting the Histogram ... 90

TRENDLINES ... 98

(5)

Basic Excel Facts and Usage

Basic Introductions to a Spreadsheet

A spreadsheet is a software tool that allows you to work with data (mainly numerical) in very complex and helpful ways. In MATH116 and MATH&148, Excel will be used extensively to complete the projects in each of the course. Hence, it is crucial that you have a basic understanding of how spreadsheets work. Here is a basic screen shot of Excel. Please take time to read the callouts to learn some basic spreadsheet vocabulary.

Clicking on a tab on the Ribbon brings up groups of commands related to each other.

This region is called the

Ribbon.

The Address Box tells you what cell is currently active. You can enter in a cell address to go to directly to a cell, or use it to give a cell a specific name.

This is the formula bar where you enter and edit formulas.

Each of these boxes is called a “Cell.” Cells contain, numbers, text, formulas, or even pictures. A cell’s address is given by the intersection of the column letter and the row number. This particular cell’s address is B3. When you click on or move to a cell, its border will become highlighted, as shown here.

These tabs select Sheets that you can work in. The current sheet being worked in is in bold letters. This class will often use files with several sheets included so pay attention to whether or not these are labeled or named to indicate more than one sheet exists.

(6)

A spreadsheet may be used to quickly process numerical data, like the simple sales tax sheet shown below:

Or, they could be used to simulate complex random sampling situations for complicated and intricate mathematically based problems, such as those we will encounter in MATH116 and MATH&148.

Entering Data

Entering data into a spreadsheet is as simple as clicking once on a cell and entering the data. You can also use the arrow keys on your keyboard to navigate to a cell. The active cell will be

highlighted and its address will appear in the Address Box. If you have not opened up Excel yet, please do so now by opening the file, Blank.xls. Practice moving around the cells if you are new to a spreadsheet. (In this tutorial, any text that is blue and underlined is a link to an existing file. To open the link, click on it. If that does not work, try to hold down the Ctrl button on your keyboard while you click once on a link.)

The simplest kind of data to input is text and numbers.

Practice

Open Navigate to Cell A1 and type in the words “Tax Rate” followed by the Enter key. In Cell B1, type in the number .0865 (which corresponds to 8.65%). Continue to edit your worksheet until it looks like this…

(7)

Your entry into cell B2 may not look like a percent when you entered in .0865. To covert a cell to percent form, choose the cell and the click on the percent button on the toolbar:

In cells A4, A5, etc, enter in a series of numbers. If you want, you can just copy the numbers you see above. You will probably notice that the numbers you enter are not in dollar format. To format a group of cells in dollar form, move your mouse to the starting cell (A4 in this example) and hold the mouse button down while you drag to the last cell you want to format. It should look like this:

You can then format all of the highlighted cells by clicking on the Dollar format button, shown below:

(8)

Editing Cell Contents

To edit or change the contents of a cell, navigate to that cell. You will notice that the Formula bar changes to reflect the contents of the active cell. To edit the contents of that cell, simply use your mouse button to click in side the Formula bar and edit it as you like. Try in now if you

like…change the value of Cell A7, for example, from 8 to 3.

Changing Cell Formats

There are a variety of different formatting changes you can make to a cell. Here’s a quick rundown of important formatting tools. (Your tool bar may look a little different than the one shown here, but the buttons all do the same thing.) For more information, read on in this section:

Format as money Format as percent Change font size

Change font color

Change cell alignment Merge two or more cells. Change font and styles Change cell border

(9)

You can make text Bold, Italicized, or Underlined using the formatting buttons shown below:

You can also center text within a cell, or align it to the right or left of a cell with these buttons:

One handy feature of Excel allows you to merge two or more cells into one larger cell. This is helpful when you are formatting spreadsheet so that they look more professional. For example, in the sheet below, Cells A1, B1 and C1 have been merged into one large cell:

To merge cells, use the mouse to click and drag all the cells you want to merge. Then click the Merge button, as shown below:

(10)

To change the font or size of a cell’s contents, use the font formatting tools, shown below:

You can also change the color of the text or data inside a cell. Simply use the Font Color button, as shown below:

Another nice feature is the ability to add solid borders to cells so that when the sheet is printed, the borders show up. (By default, the grey cell borders you see while working in a spreadsheet do not print.) Borders can be added using the border tool:

(11)

As you can see, there are a variety of border options available. Experiment with them to see how they work…they are pretty straightforward.

Finally, you will often want to format each cell in terms of decimal places, dollar signs, date

formats, percentage format, etc. To format a cell in a particular way, click on the cell(s) you want to change and then RIGHT click on the cell with your mouse. Choose the “Format Cells…” command and you’ll get a box like this.

(12)

The “Number” tab will allow you to specify what kind of data is in that cell or cells. For example, if you want a number, click on “Number” in the “Category” list:

(13)

The new window will allow you to specify how many decimal places to display and change other formats. (This screen will not round the data, only change what is seen on the screen!).

The other tabs will allow you to change the fonts, borders, etc. However, it’s usually best to keep things simple, as this generally means it’s easier to read.

Changing Row and Column Sizes

Changing the size of rows or columns is simple. Move your mouse to the vertical bars that separate each column (or row) until the arrow cursor changes and looks like this:

(14)

Shortcut: If you want to make a column or row automatically size itself to fit its contents, click once on the row or column label (the numbers 1,2,3,… or the letters A, B, C,…) and then

DOUBLE−CLICK on the vertical bar directly to the right or below the column or row you want to resize.

Changing Cell Contents

There are a variety of different

Working with Formulas

Working with simple formulas in Excel is as easy as using an “=” sign and typing in the formula correctly. One of the most common calculations is to take numbers in two or more different cells and compute with them.

Practice

Open the file called Formulas.xls. Make sure you are on the Sheet called “Copy Down” before proceeding. You will see two columns of numbers. In Cell C2, type in the word “Sum.”

We are going to add the two numbers in each row and put the result in Column C. In Cell C3 type the following:

=A3+B3

followed by the Enter key. You should see the number 13 appear in Cell C3.

Note that Cell C3 tell Excel to take whatever is in Cell A3 and add it to whatever is in Cell B3. This is helpful because if were to change the contents of either A3 or B3, the result would automatically change in C3. Try it…change A3 and/or B3 to make sure it works.

(15)

Practice

Let’s continue to modify the file called Formulas.xls. In Cell D2, type the word “Product”. In Cell D3, type the following formula:

=A3*B3

followed by the Enter key. You should see the number 30 appear in D3. This is the product of the first two numbers on our list.

Copying Formulas

In the previous Practice problems, we’ve managed to compute the sum and product of two numbers. If we want to duplicate that set of calculations for all of the rows present, we certainly do not want to have to type formulas into every cell. Instead, we will copy or duplicate the formulas down the columns in one short set of steps.

Example

Let’s continue to modify the file called Formulas.xls. At this point, it should look like this:

We are going to copy the formula in Cell C3 all the way down to the end of the list of numbers we have. To do this first click once in Cell C3 and hold the mouse down while you carefully drag to the end of the list. Your screen should look something like this:

(16)

Now, while you hold the Ctrl button down on the keyboard, hit the D key. This is called a

CtrlD command. When you do so, the Cells in Column C should fill themselves in as below:

Now here is the best part! Click on any of these new cells, such as C4 and look at the formula bar. You will notice that the original formula you entered into C3 has been copied but it has been automatically altered to reflect the fact that you are now adding numbers in Row 4. Excel is smart enough to adjust these new formulas for you so that you get the results you were actually looking to get.

The original references to A3 and B3 that we entered into Cells C3 and D3 are called

relative references. This means that should we copy the formulas in these cells to other cells, Excel will assume that we want to copy the formulas so that they adjust, relative to the original formula.

(17)

Practice

Copy the formula in Cell D3 down to include all the numbers with rows in them. Make sure each new entry really is the product of the numbers in Columns A and B.

Example

We can also copy a cell’s formula to the right with the CtrlR (Control Right) command. In the Sheet called “Copy Right” in the file Formulas.xls, you will notice numbers in rows, rather than in columns. Please examine the formulas in Cells B4 and B5.

Now, click on Cell B4 and then hold the mouse button down while you drag over to Cell F4. Use the keyboard to type a CtrlR command (This means hold the Ctrl button down while you type the letter R.) The formulas should be copied and the calculations down for you so that the file looks like this:

Practice

Copy the formula in Cell B5 to the right to multiply all the column pairs of numbers.

The Copy Handle

There is one other way to copy formulas to the right, left, down, or up from a cell that already has a formula in it. In the Sheet called “Copy Handle” in the file Formulas.xls, you will see a set up as follows:

Click on Cell E4 to see the formula =E3+5. When you click on the cell, you should notice a small, square handle in the lower right corner of the cell:

(18)

The Copy Handle

I’ll call this the “Copy Handle.” If you click on this handle and hold the mouse button down while you drag over to cell I4, Excel will copy the formula of E4 across the row. Try it! You can also click on E4 and drag the Copy Handle down Column E. Try it!

Finally, you can drag the Copy Handle in Cell E3 to the left and it will copy the formula to the left. I’ve doe this and here is what my sheet looks like now:

You can now click on any cell with a number/formula in it and drag right, left, or down to fill in formulas. As a matter of fact, you can do it very efficiently. For example, select the range of cells A4 to I4 as shown below:

Note that this entire range has one Copy Handle associated with it. Grab this handle and drag down to Cell I9 (or thereabouts) and watch all of the rows fill in nicely:

(19)

This provides a quick and easy way to copy your relative formulas all over a sheet and not have to type each on in by hand.

Absolute References

Sometimes, you don’t want your formulas copied in a relative way. There may be a particular cell that you always want to be part of a formula. Excel uses absolute references to accomplish this and it uses the $ sign inside a Cell address to make the address absolute.

For example, if you always wanted Cell A2 to be used in a calculation, you would need to type in $A$2 to tell Excel this is an absolute reference. Let’s see how this would work:

Example

Open the Sheet called “Shipping” in the file Formulas.xls. The goal of this example is to add the Shipping Fee of $8.95 in Cell A2 to every relevant row of the “Total with Shipping” Column.

To do this, we enter the following into Cell B8:

=A8+$A$2

(20)

Note that we can change the shipping amount in A2 and all the cells in Column B will update.

Example

Edit the sheet “Shipping” so that in Column C, the “Total with S&H” of each cell adds the “Order Amount” to the Shipping Fee in A2 and the Handling Fee in Cell A5. Try to use Copy Down for practice.

(21)

There are other variations on using absolute references. For example, you may want a cell to compute with a particular row but allow the column to be relative (and therefore change) or vice versa. Here are the three possibilities for absolute or partially absolute references.

Example Type Comment

$A$2 True absolute reference Forces computation with Cell A2

$A2 Partial absolute reference Forces computation with Column A but allows the row number to change relative to the formula.

A$2 Partial absolute reference Forces computation with Row2 but allows the Column to change relative to the formula. Note: If you are editing a formula, using the F4 key will cycle you through different kinds of absolute references. Just make sure the reference you want to change has the edit cursor immediately to the left of the reference in the Formula Bar.

Sorting Data

Sorting data sometimes makes it easier to see what is going on. Open the file Employees.xls to see a series of Sheets with data in them.

The Sheet called “Employees” is a simple list of Employee ID numbers. To sort these in ascending or descending order, we use the Sort & Filter button on the toolbar.

First, click on Column A so that the entire column is selected. (Click on the box with the A at the top of the column.) Your column should look like this:

(22)

Now click on the Sort & Filter button and then choose and the employee number will be sorted in ascending order. Clicking on the Sort Down button will sort them in descending order.

Usually, however, you will want to sort more complicated data. Select the Sheet called “Sales Records” to see data on the employees’ sales records and their time employed at the company.

(23)

Example

We want to sort these records by their Employee number once again, but if we simply sort what is in Column A, then the records will not match the data that is Columns B and C. To make sure that all the data is sorted correctly, we first need to select all the rows to be sorted. Move your mouse to the left side of the screen until the arrow is over the “1” in the box that identifies Row 1. If you do this correctly, the normal cursor arrow will turn into a heavier arrow pointed to the right that looks like this:

Click once on the mouse button and drag it down to Row 22, and then release the mouse button. Your screen should look like this:

All rows should be highlighted. Now you can use the Sort Up or Sort Down Button to sort by Employee number. Note: Excel will automatically sort the data according the column on the very left of whatever is highlighted. You can also shift to the Data portion of the Ribbon and use the Sort buttons there as well:

(24)

If you want to sort by Sales amount, you’ll need to use the Sort command in the Data tab of the Ribbon:

Example

Let’s sort the Employee data now by Sales. Once again, use the row labels to highlight Rows 1 to 22. Click on the Sort button in the Data group (see picture above) and you’ll get this box:

If the “My data has headers” box is checked, then Excel looks at the first row of the data that is highlighted and treats that as the one that has headers, or descriptors in it. When it sorts the data, it will leave the header row at the top (as you would want) and sorts everything below the header row.

This box allows you to specify what to sort by first. The default is the left−most column, but we can select Sales instead, as below:

(25)

Doing this and clicking OK will sort by Sales from smallest to largest values:

Again, it is vital that all rows and columns be selected so that when the data is sorted, the Employee number is properly matched up with that person’s sales total and years on the job.

Example

Let’s sort by Years on the job first (ascending), and then by sales (descending). After selecting all rows, we choose the Sort button and then configure our Sort box as follows. First, select years on the job as the first sorting criterion:

(26)

Then, we add a level of sorting so we can also sort by Sales. To do this, click the “Add Level” button:

(27)

When we click OK, we get the following:

This allows us a view of the data that is perhaps very helpful if we are a manager trying to determine who the most effective salespeople are.

Practice

(28)

Answer: The first few rows should look like this: (check all the way across the row to make sure you have it sorted correctly.)

Practice

Open the file ClassData.xls and sort all records by Exam 2 (descending).

Answer: The first few rows should look like this: (check all the way across the row to make sure you have it sorted correctly.)

Practice

Open the file ClassData.xls and sort all records by Exam 1 (descending) THEN Exam 2 (descending) THEN by Exam 3 (descending).

Answer: The first few rows should look like this: (check all the way across the row to make sure you have it sorted correctly.)

(29)

Basic Mathematics Computations

There are several special mathematical computations you will need to be able to do in Excel. This part of the tutorial covers many of these.

The first thing to be aware of when doing any computations in Excel is that you will usually need to start the contents of a cell with the “=” sign in order for Excel to recognize the formula

computations.

Basic Mathematical Functions

Addition

To add two or more numbers, use the + symbol, as you would normally. Example

To add 5+3+2 type the following into a cell

=5+3+2

When you hit the Enter key, the cell will change to a 10.

If you want to add numbers that are located in different cells, you need to type in the cell addresses for each number to be added to the result.

Example

Suppose you wanted to add the values that are in cells A1, A5, and B6 (see below), and you wanted to place the result in cell C1.

(30)

Type the formula =A1+A5+B6 in this cell

In cell C1, type the following:

=A1+A5+B6

When you hit the Enter key, cell C1 will display 24.

There is a nice shortcut to typing cell references that can save time. Instead of typing the cell reference, use the mouse to point and click at the cell you want entered into the equation. In this example, you can do the following:

Type =

Use the mouse to click once on cell A1 Type +

Use the mouse to click once on cell A5 Type +

Use the mouse to click once on cell B6 Hit the Enter key

Practice

Open the file called BasicMath.xls and use it to add cells A8, B2, and B7. Try to use both methods described above.

Answer: 17

Subtraction

To subtract numbers, use the − symbol, as you probably suspected. Example

To compute 20+3−5−8, you would type:

=20+3

5

8

The result will be 10, as it should be.

Practice

(31)

Answer: 46.

Multiplication

To multiply numbers, use the * symbol, which is Shift8 on the keyboard. Example

To compute2×3×4, you would type:

=2*3*4

followed by the Enter key.

Practice

Open the file called BasicMath.xls and use it to compute the result of 3*A4*B12 Answer: 210

Example

If you want to use the distributive property of multiplication, you will need to use parentheses. To compute 5(3+2−8+7), you would type:

=5*(3+2

8+7)

Notice that you need the * between the 5 and the left parenthesis. Excel will display an error message without it.

Practice

Open the file called BasicMath.xls and use it to compute the result of 4(6−A10+B5+3).

Answer: 40

Division

To divide two numbers, use the / symbol on the keyboard. Example

To divide 8 32

, which is the same as 32÷8, type:

=32/8

followed by the Enter key. Example

You need to be very careful with division and the order of operations. For example, if you want to compute

4 8 3+

, you must tell Excel that the 3+8 are to be added before being divided by 4. Hence, to compute this, you would type:

(32)

=(3+8)/4

followed by the Enter key. The result will be 2.75, which is correct. Note that if you were to type the following;

=3+8/4

then Excel would actually compute 4 8

3+ , which is 5, a totally different (and wrong) result.

Practice Compute 7 7 6 4 3 7 6 5+ + + + + + . Answer: Approximately 5.428571 Practice

Open the file called BasicMath.xls and use it to compute the result of

12 9 5 2 3 A B B A + + + Answer: 2.25

Powers and Exponents

If you want to raise numbers to powers, then you need to use the ^ symbol, which is Shift6 on the keyboard. If you familiar with a TI graphing calculator, this symbol is the same symbol you used to compute with powers.

Example

To compute 24, you would type:

=2^4

to get a result of 16 Example

To compute

(

2+5

)

3, you would type:

=(2+5)^3

to get a result of 343. Example

To compute 4

(

2+3

)

(2+1), you would type:

=4*(2+3)^(2+1)

to get a result of 500. Note that if the power is complicated, you may need to use parentheses to make sure the proper exponent is applied.

Practice Compute 54. Answer: 625

(33)

Practice Compute 3. 35 . 2 Answer: 12.97788 Practice Compute 7+2

(

4−3−5

)

3 Answer: −121 Practice

Open the file called BasicMath.xls and use it to compute the result of 5(B1−A3)5

Answer: -15625

The Natural Base, e

One of the most important bases we apply exponents to is e, the natural base. The value of e is about 2.72, but Excel knows its exact value, provided you use the EXP() command. If you just use the letter “e” in the formula, Excel will not recognize it as the natural base.

Example

To compute e1, which is of course just e, you would type:

=EXP(1)

to get the value of e to however many decimal places Excel is set to display in that cell. Example

To compute e5, you would type:

=EXP(5)

to get a value of 148.4132.

Example

To compute e(1+2.35), you would type:

=EXP(1+2.35)

(34)

Practice

Compute e5.45−3.26. Don’t forget to use parentheses around the exponent part. Answer: 8.935213.

Practice Compute 2(3 7)

1

e . Don’t forget to use parentheses around the exponent part. Answer: 0.135335.

If you did not get this, check your entry to make sure it looks like this:

=EXP((1/2)*(3-7))

Make sure you recognize how and why each of the set of parentheses is being used.

Square Roots

The most common root you will need in this course is the square root. To compute a square root, you can do one of two things: (1) You can raise the base to the power of ½. Recall that taking a square root is the same as raising a number to the power of ½. (2) You can use the SQRT()

command.

Example

To compute 18 , you can type one of the following:

=18^(1/2)

OR

=SQRT(18)

Notice that in the fist case, parentheses are needed around the ½. This is important! Also, in the second case, parentheses are needed around whatever is inside the square root symbol. Example

To compute 5+20, you can type one of the following:

=(5+20)^(1/2)

OR

=SQRT(5+20)

Either one gives you a result of 5. Practice

Compute the value of 12+36−15 Answer: 5.744563

Practice

Compute the value of 38+2 5+18 Answer: 15.75608

(35)

The Natural Logarithm

This course will require that you do limited computations with logarithms. The logarithm we will use is the natural logarithm, which is symbolized by ln. Excel can compute these easily using the

LN command. Example

To compute the value of ln(10), you would type:

=LN(10)

to get a value of 2.302585. Note once again that parentheses are needed. Whatever you are taking the logarithm of needs to be in parentheses.

Example

To compute ln(5−8+2×9), you would type:

=ln(5

8+2*9)

to get a value of 2.70805.

Practice

Compute the value of ln(44.5) Answer: 3.795489.

Practice

Open the file called BasicMath.xls and use it to compute the result of 5−ln(B5+A3)

Answer: 2.227411.

The Value of π

The value of π can be easily computed in Excel. Simply type =PI() into a cell or any part of a formula and the value of π will be invoked. Note that the parentheses are necessary.

Rounding

When you want to round numbers, the ROUND command is used. The syntax is:

=ROUND(value, rounding_parameter)

where value is the number to be rounding, and rounding_parameter is the number of places to round to.

Example

To round cell A5 to the nearest hundredth (2 decimal places to the right of the decimal point), you would enter:

(36)

Example

To round cell A5 to the nearest tenth (1 decimal place to the right of the decimal point), you would enter:

=ROUND(A5,1)

Example

To round cell B10 to the nearest integer (0 places to the right of the decimal point), you would enter:

=ROUND(B10,0)

Example

To round cell C1 to the nearest ones place, you would enter:

=ROUND(C1,

1)

Note that the rounding parameter is −1, indicating you are rounding to one place to the LEFT of the decimal place.

Practice

The file SalesTax.xls has a random list of sales prices. In the column titled “Sales Tax,” compute the sales tax on each item, using the ROUND command to round the tax amount to the nearest penny. Use absolute references to insure that you use the constant tax rate in Cell B1. Then fill in the “Total Due” column, which is the sum of the Price and Sales Tax. When you are done, you should be able to change the value of the tax rate in Cell B1 and see all your other values change accordingly.

Note that the ROUND command rounds to the nearest place value. That is, it may round up or round down, depending on the value. If you want to strictly round up the next place or down to the previous place, then the following commands are used.

Rounding Up and Rounding Down

To round up, we use the ROUNDUP command, which has a similar syntax to ROUND. The difference is that it will round a value UP. To round down, we use the ROUNDDOWN command, which has a similar syntax to ROUND. The difference is that it will round a value DOWN

Example

To round the value 345.8768 UP to the thousandths place (3 decimal places), we would enter:

=ROUNDUP(345.8768,3)

to get a value of 345.877. This is also what you would get if you use the ROUND command. However….

(37)

Example

To round the value 345.8768 DOWN to the thousandths place (3 decimal places), we would enter:

=ROUNDDOWN(345.8768,3)

to get a value of 345.876. This is not what you would get if you use the ROUND command since this command does not round to the nearest or up, but down to the previous place specified.

Basic Statistical Functions

Averages and Means

To find the average, or the mean, of a group of numbers, we use the AVERAGE command. The syntax is:

=AVERAGE(cell_range)

Example

To find the average of the numbers in cells A1 to A50, we would enter:

=AVERAGE(A1:A50)

This is pretty much straightforward. If you have numbers in more than one column, like from Cell A1 to Cell C20, then you would type:

=AVERAGE(A1:C20)

Practice

Open the file SalesTax.xls and find the average of the Prices listed in Column A. Place your value in Cell A20.

Answer: $16.52

Sums

To find the sum of a list of numbers, we use the SUM command:

=SUM(cell_range)

Example

To find the sum of the numbers in the block of data from Cell B20 to Cell T55, we would type:

=SUM(B20:T55)

Practice

Open the file SalesTax.xls and find the sum of the Prices listed in Column A. Place your value in Cell A21.

(38)

Minimums

To find the minimum number in a list of a block of cells, we use the MIN command:

=MIN(cell-_range)

Example

To find the sum of the numbers in the block of data from Cell B20 to Cell T55, we would type:

=MIN(B20:T55)

Practice

Open the file GPA.xls and find the minimum GPA listed. Answer: 0.53

Maximums

To find the maximum number in a list of a block of cells, we use the MAX command:

=MAX(cell_range)

Example

To find the sum of the numbers in the block of data from Cell B20 to Cell T55, we would type:

=MAX(B20:T55)

Practice

Open the file GPA.xls and find the maximum GPA listed. Answer: 4.0

The Range

The range of a set of numbers is simply the maximum in the list minus the minimum in the list. There are two ways to compute the range, therefore. Either (a) compute the MIN and MAX separately and then subtract them in a third cell. Or (b) use one command to do it in one cell using the a command like =MAX(cell_range)−MIN(cell_range). Just make sure the cell ranges used in each of the MIN and MAX command are the same.

(39)

Databases

Basic Introduction to Databases

A database is a large collection of data and records. For example, open the file Chrysler.xls to see a database that represents the cars sold at a local Chrysler Dealership in the recent past. There are literally hundreds of records.

Each row represents a different record. In this case, each record represents one individual sale of a car. Each record in a database is made up of several fields. The fields are the different parts of the record. In Chrysler.xls, the fields are Car Number, Style, Color, Sale Price, SalesPerson. Each of these fields has different kinds of values that are possible. For example, the Sale Price field must take on a number ($) while the Color field takes on text values (such as Red, Blue, etc.)

These are the fields

These are the records.

Now suppose you wanted to ask questions like: “How many Red PT cruisers have we sold?” or “How many cars over $25,000 did Juan sell?” or “How many Concordes and Voyagers did we sell between $20,000 and $23,000?” Trying to do this would take a lot of time and hassle without special commands like DCOUNT.

When using database commands like these, we need to give the commands specific criteria with which to work. Hence the first thing to do when using these commands is to duplicate the Field headings above or to the side of the actual data so that we can enter specific criteria. For example, we can alter Chrysler.xls as follows: Insert 7 new blank lines above the data. (Select Rows 1 to 7 by clicking on the Row 1 label and drag down to Row 7, then choose Insert→Rows from the Menus.)

In cell A1, we will type “CRITERIA.” In cells A2 to E2, we will copy the original Field headings. Our modified worksheet will look like this:

(40)

We will call this the Criteria Area.

We will use cells A3 to E7 to fill in specific criteria. Usually 5 or six lines is enough, but if we need more, we can always insert new blank lines.

With the Criteria Area now available we can proceed.

The DCOUNT Command

The DCOUNT command simply counts the number of records in a database that meet stated criteria. We enter the criteria into the Criteria Area and then run the DCOUNT command. This command uses the syntax:

= DCOUNT(database,field,criteria)

where database is the range of cells where the database is located, field is unused, and criteria is the range of cells where you specify what criteria to match and therefore which records to count.

Example

Let’s count the number of Red PT Cruisers sold at this dealership. Using Chrysler.xls, we will modify the Criteria Area so the first line has Red in the Color column and PT Cruiser in the Style column. It is crucial that we enter the text in without any spelling errors, including any spaces that are needed. This is how our file should look…try it yourself as we move along:

Let’s use the Function Wizard to invoke the DCOUNT command since it’s easier than using the syntax.

(41)

First, click on a blank available cell where Excel can report the number of Red PT Cruisers. Make sure you pick a cell that is not in the Criteria Area or part of the database. Let’s label Cell G2 as “DCOUNT” first and then use Cell H2 as the cell where we will return DCOUNT results. Click on Cell H2.

We now use the DCOUNT command to count the number of Red PT Cruisers in the database. The format for DCOUNT is, as we saw above:

= DCOUNT(database,field,criteria)

In Cell H2, we enter the following command:

The range A7:E537 is our database. Notice it includes row 7 which has the field names of our database. Also notice that the field parameter is blank. We don’t need it here. Finally, the range A2:E3 is the criteria range and it includes the row with the field headers and the row where specify the two criteria. When you use the DCOUNT command, the row with the field headers MUST be included in BOTH the database range AND the criteria range.

Make sure that the “Criteria” box does not include any of the empty rows in the Criteria Area….if it does, it will count all 350 cars in the database.

Example

Let’s count the number of PT Cruisers sold at this dealership that are either Red or Black. To do this, we need to add another line in our Criteria Area as follows:

When there are two or more rows filled out in the Criteria Area, DCOUNT will look for records that match ANY of the criteria and then add them all up. That is, Excel will look for any Red PT Cruisers OR any Black PT Cruisers.

Because we changed the criteria, we also need to change the formula in Cell H2 to make sure it is updated. We could run the DCOUNT Function Wizard all over again, but here’s a nice shortcut that you can use any time you want to edit a function.

(42)

Click once on Cell H2. Then hit the F2 key on the top row of the keyboard. When you do, your screen should look like this:

Drag this handle to

change the active Criteria.

This is the Criteria range, highlighted in green This is the Database cell

range highlighted in blue

Notice two great things happen. First, the formula in H2 is displayed with colored fonts. The colors correspond to the colored boxes that are now outlined in blue and green. The database range is outlined in blue and the Criteria Area is outlined in green. If we want to include Row 4 in the Criteria Range, we can either edit A2:E3 so that it reads A2:E4, or we can simply point on the little square handle on the lower right corner of the green box (also the lower right corner of Cell E3 if you can’t see the color) and drag it until it expands to E4. When you do so, the screen will look like this:

Note that the formula and colored boxes stay synchronized. Very cool!. Now hit the Enter

key and the formula and Cell H2 will be updated. There are 17 PT cruisers sold that were either Red or Black.

Practice

How many Blue 300M’s were sold? Answer: 3

Practice

How many Voyagers did Juan sell? What about Maria? Answer: 12 and 8

(43)

Practice

How many Red Concordes did Bartoloa sell? Answer: 2

Practice

How many PT Cruisers or Crossfires were sold? Answer: 118

Practice

How many PT Cruisers or Crossfires were sold by Elias? Answer: 23

Practice Challenge

How many PT Cruisers or Crossfires were sold by Elias or Juan? Answer: 43 (Hint: You need four lines filled in your Criteria Area!)

Example

Now, what if we want to count the number of PT Cruisers sold for under $22,000? Our Criteria Area and results would look as follows:

Example

How many 300M’s were sold for $25,000 or more by Celia? Our Criteria Area and results would look as follows:

Example

How many Pacifica’s were sold for between $18,000 and $22,000? This is a different question! We want to count all cars that meet both the >18000 AND <22000 criteria so we can’t use two different rows in the Criteria Area. (That would count each inequality separately and then add them, which is not what we want.) Both of the Price criteria have to be in one row. To accomplish this, we need to insert another column to the Criteria Area and label it “Sale Price.” We’ll use Column F and enter our criteria, like below. If we make sure the

(44)

There were 14 Pacifica’s sold for between $18,000 and $22000.

Practice

How many Sebring’s were sold for more than $20,900? Answer: 19

Practice

How many Town&Country’s were sold for less than $25,000? Answer: 26

Practice

How many Black 300M’s were sold for more than $23,000? Answer: 6

Practice

How many Voyagers were sold for between $21,000 and $23,000? Answer: 11

Practice

How many Sebring’s or PT Cruisers were sold for between $15,000 and $18,000? Answer: 9

The DAVERAGE, DSUM, DMIN, DMAX Commands

If you have a database and you want to find the averages, sums, minimum or maximum values subject to given criteria, these commands are the ones to use. They all work very similar to each other, so we’ll only cover DAVERAGE here. You can explore the rest on your own.

DAVERAGE will find the average of some field in a database subject to your criteria. Practice

What is the average price of all PT Cruisers sold in Chrysler.xls? We change Cell G2 to say “DAVERAGE” and use Cell H2 to compute this average. Make sure your Criteria Area looks like this:

(45)

The command is as follows:

The basic command structure is:

=DAVERAGE(database,field, criteria)

Now, the field criteria IS needed. We specify D7 as the field because that is the field header for the Sale Price data.

Practice

What is the average price of all of the M300’s sold by either Maria or Celia? Answer: $23,861.78

(46)

Special Excel Functions

The COUNT command

There are times when you have a long list of data and you want to quickly count how many items are in the list. The COUNT() command does this quickly.

Open the file Count.xls to see a sheet full of numbers. Note that some of the cells are empty so that the columns do not necessarily have the same number of entries in them. The syntax for the

COUNT command is:

=COUNT(cell_range)

The COUNT command counts the number of cells in a given range (specified by the cell range) that contain numbers within them.

Example

If you wanted to count the number of cells with numbers in the Red column, you would type in Cell A22:

=COUNT(A1:A21)

to get 20 for a result. Note that even though cell A1 is included in the range of cells to be considered, it is not counted because cell A1 does not have a number inside of it.

Example

If you wanted to count the number of cells with numbers in the Blue column, you would type in Cell B22:

=COUNT(B2:B21)

to get 17 as a result. Note that I did not include cell B1 in the cell range since I knew it would not be counted anyway.

Example

If you wanted to count the number of cells with numbers in BOTH the Grey and Black columns, you would type:

=COUNT(H1:I21)

(47)

Practice

Open the file called Count.xls and use the COUNT command to count the number of cells in the Pink column with numbers in it.

Answer: 18

Practice

Open the file called Count.xls and use the COUNT command to count the number of cells in the Green and Brown columns with numbers in them.

Answer: 18

Practice

Open the file called Count.xls and use the COUNT command to count the number of cells in ALL of the colored columns.

Answer: 164

The COUNTIF command

Sometimes, simply counting is too general. There are times you want to count the number of items that meet specific criteria. The COUNTIF command will do this for us. The syntax for the

command is:

=COUNTIF(range, criterion)

where the range specifies which cells to count and the criterion details what to look for. For example, the MachineJams.xls has a list of data a company has been recording for several months. The copy machine they lease has been jamming regularly, but the company they lease the machine from says nothing should be wrong with it, since it’s new. So, the company has recorded the number of times it jams per day to document their experience in case they need to insist that it be replaced. Each row represents a different day.

(48)

Example

Suppose you want to count the number of days during the first 14 days in which there were more than 10 jams per day. (It is possible to count these with your naked eye, but we will practice using the COUNTIF.) You would type the following:

=COUNTIF(B2:B15, “>10”)

to get a result of 7. Note that the criteria should be in quotes. (It’s an odd rule, but it exists nonetheless.)

Example

Suppose you want to count the number of days during the first 20 days in which there less than or equal to 6 jams per day. You would type:

=COUNTIF(B2:B21,"<=6")

to get a result of 6. Note that ≤ is typed as <= in Excel.

Example

Suppose you consider the data for ALL 156 days they recorded the jams and you want to know how many of those days there were more than 8 jams per day. You would type:

=COUNTIF(B2:B157,">8")

to get a result of 104.

Practice

Find the number of days within the first 30 days in which there were 10 or fewer jams. Answer: 16

Practice

Find the number of days within the days 20 to 90 (inclusive, meaning you include days 20 and 90) in which there were more than 15 jams.

Answer: 18

Practice

Find the number of days within the entire set of days in which the machine jammed exactly 20 times.

Answer: 12

The COUNTIF command can also count cells in which specific text appears. For example, the attendant on duty is recorded in the third column of the file Count.xls. We can ask how often any of those people were on duty.

(49)

Example

To find the number of times that Hector was the attendant during the first 60 days, we would type:

=COUNTIF(C2:C61,"=Hector")

to get a result of 14.

Practice

Find the number of times that each of Jane, Bob, and Mary are the attendants from Day 1 through (and including) Day 100.

Answer: Jane = 28; Bob = 20; Mary = 29

The RAND command

Sometimes it is helpful to have Excel generate random numbers for you. To generate a random number between 0 and 1, we use the RAND command.

Example

To generate a random number between 0 and 1 in a cell, simply type:

=RAND()

Note that you need the two parentheses after RAND with nothing in them. Weird, but necessary.

This command will continually change the number in that cell every time you do a new

computation, enter data into a new cell, or press the F9 key. Try it....press F9 over and over and you’ll see the number change.

If you need several random numbers in a column or row, simply copy right or copy down from a cell that has the RAND command inside of it. This will generate as many random numbers as you may need.

Sometimes, you don’t want the random numbers to constantly change. One way to fix their value is to select all the cells you want to fix and then copy all of data using CRTL-C on the keyboard. Then click on the first cell in the range (upper left corner if you’ve selected a block of cells) and then right click. If you choose “Paste Special…” you will see the following box appear:

(50)

You can also use the Paste button on the Ribbon to bring up the same box.

If you choose Values (in the box) or Paste Values (from the menu), then Excel will paste in the current random values as fixed numbers. Note that when you do this, all your randomization in those cells will go away for good.

The RANDBETWEEN command

While the RAND command returns numbers between 0 and 1, there are times when you want to generate numbers outside that range. The RANDBETWEEN command will generate random integers between any two integers that you specify. The syntax for the command is:

=RANDBETWEEN(bottom,top)

(51)

Example

Suppose you want to generate a random number between 1 and 100. Then you type: =

RANDBETWEEN

(1,100)

to get a random number. Note that like the RAND command, cells with this command in them will change with F9 or other entry into your spreadsheet.

The IF command

The IF command is one of the most useful tools you will encounter in Excel. It allows you to ask questions about data and then, based on the answers to those questions, return results that are desired. We will start with basic usage of the IF command and then expand it just a bit. The syntax for the IF command is:

=IF(condition, yes result, no result)

where condition is the question you ask, yes result is the value, result, or cell that is returned if the answer to the question/condition is yes, and no result is the value, result, or cell that is returned if the answer to the question is no.

Let’s start with some simple examples.

Example

Let’s go back to our copy machine example. In the file JamsPart2.xls, a new column has been added to indicate whether or not the number of daily jams is acceptable or not. The new file looks like this:

In the “Acceptable?” column, we will use the IF command to indicate whether or not the number of jams is acceptable. We will arbitrarily decide for this example that if the number of jams is less than 8, then that is acceptable, otherwise it is not. If it is acceptable, we will place a 1 in that row, if not then we will place a 0 in that row. Here is how you would issue that command in cell D2:

(52)

=IF(B2<8,1,0)

Once you have the formula entered into cell D2, you can use the Copy−Down command (CtrlD) so that it applies to all the rows on the sheet. When you do so, you get the following:

To save space, only the first few rows are shown.

Example

In the previous example, having 1’s and 0’s may not mean much to someone unfamiliar with the sheet, so let’s put “Yes” or “No” in the Column D instead. When you want to return text as a result rather than a number, then you put the text in quotes. Here’s how you would do it in this example:

=IF(B2<8,"Yes","No")

(53)

Example

There may be times when you want either of the Yes or No returns to be a blank cell with no text or numbers. To do this, you enter two quotation marks next to each other (“”). For example, let’s say we want a “Yes” to appear if the number of jams is below 8, but a blank cell otherwise. The command would be:

=IF(B2<8,"Yes","")

(54)

Practice

In the acceptable column, use the IF() command to place the works “Oh Yeah” if the number of jams is 10 or less and the words “No Way” otherwise:

Answer:

Example

Sometimes you want to return a cell value already in existence rather than a fixed value as in the examples above. This is easy. Let’s say you have a tax system where anyone making less than $35,000 per year pays 20% in taxes. Anyone making $35,000 or more pays 22% in taxes. (The U.S. system is a little different, with a staggered tax system, but this is a simple example.) What we want to do is calculate how much tax a person pays given their income and we want to do it for many individuals. The file Taxes.xls has data that looks like this:

(55)

In the “Total Taxes” column, we want to calculate how much tax each income would pay. In this example, we need to test whether or not the income is above $35,000. If it is, then we multiply that amount by 0.22. Otherwise, we multiply it by 0.20. Here is what the command in Cell B2 would look like. Make sure it seems reasonable to you:

=IF(A2<35000,A2*0.2,A2*0.22)

This will return the following results:

Note that the values that are returned can include cell references and numbers, as well as any computations that are needed.

Practice

Use the Taxes.xls file to fill in the “Total Taxes” column with the following tax structure. If you make $27,500 or less, you pay 12% in taxes. If you make more than $27,500, you pay 15.5% in taxes. Make sure you use the IF command.

(56)

Practice Challenge

Use the Taxes.xls file to fill in the “Total Taxes” column with the following tax structure: If you make $25,000 or less per year, you pay 15% on your income. If you make more than $25,000 per year, then you pay 18.5% of all income over $25,000 plus 15% of the first $25,000. Read that carefully. (This more like the U.S. tax system, where we have tax “brackets.”)

(57)

The VLOOKUP command

In some situations, you may have a large amount of data in two or more columns and your task is to look up values in one column and return a value from a different column (in the same row).

Example

The file CarSales.xls gives a list of 450 salespeople. Column A gives the salesperson’s ID number and Column B gives their sales for the month. As a manager, you want to lookup any salesperson by their ID number, type it into Cell D2, and have their sales total returned in Cell E2.

The VLOOKUP command will do this, but you have to be careful with the syntax. The form of the command is as follows:

VLOOKUP(lookup_value,table_array,col_index_num,range_lookup)

where lookup_value is the value you are looking up, table_array is the entire set of data from in which you are looking up values and returning values, and col_index_num is the column of data that gets returned once the lookup value has been located. We will not use the range_lookup parameter.

(58)

In our example, we want to look up the value in D2 somewhere in the table array that starts with cell A1 and extends down to cell B451. Upon finding the correct number, it should return the value in column 2 of the table array. So, our command would look like this:

=VLOOKUP(D2,A1:B451,2)

This gives the table array where all the data exists. You must make sure that both the data you are looking up and the data you are going to return are including in this array.

This gives the cell or value that you want to first lookup. VLOOKUP will look for this value in the array and then return whatever is in the

corresponding column that you specify later in the command.

The 2 indicates to take whatever value is in the second column of the table array.

Important Note: The data in the column that contains the values you are looking up must be sorted so they are in order. If they are not, then VLOOKUP will not work correctly.

Practice

The file Grades.xls is a list of 100 students, their cumulative GPA’s, and their academic status. A school counselor uses it to lookup GPA’s by student number. Modify this

spreadsheet so that Cell F2 returns the GPA for the Student ID number entered into Cell E2.

Practice

The file Grades.xls is a list of 100 students, their cumulative GPA’s, and their academic status. A school counselor uses it to lookup GPA’s by student number. Further modify this spreadsheet so that Cell G2 returns the academic Status for the Student ID number entered into Cell E2.

Practice

The file Grades.xls is a list of 100 students, their cumulative GPA’s, and their academic status. A school counselor uses it to lookup GPA’s by student number. Add the title “Probation?” to in Cell H1. Use the IF command to put a “Yes” in Cell H2 if the person’s GPA is below 2.0 and a “No” in Cell H2 if the GPA is 2.0 or greater.

(59)

The HLOOKUP command

In some situations, you may have a large amount of data in two or more rows and your task is to look up values in one row and return the value from a different row (in the same column). This command is almost exactly the same as VLOOKUP except that your data is organized differently.

Example

The file Stocks.xls is a list of prices for a new, popular stock. The Day row gives the number of days the stock has been selling on the NASDAQ. Part of the file looks like this:

Since there are over 200 prices, we don’t want to have to scroll to lookup a particular day’s stock price. The HLOOKUP command will do this for us. As you can see below, it’s syntax is almost identical to the VLOOKUP command.

=HLOOKUP(lookup_value,table_array,row_index_num,range_lookup)

To lookup a stock price in Stocks.xls, the command would be:

=HLOOKUP(B4,A1:IV2,2)

Make sure you open the file and understand how the command works. The command for the screen shot above is shown below:

Practice

The file Population.xls gives estimates for the U.S. population from 1790 and forward, as well as fabricated estimates for the percentage of the population that was female. Modify the file using the HLOOKUP command so that when a year is entered in to Cell A5, the correct and corresponding population and percents are returned in Cells A6 and A7.

(60)

The INDEX command

There is one more command that can help you look up values in a list of data. It’s more limited that HLOOKUP and VLOOKUP, but it can come in handy for some of our course projects.

Example

The file Index.xls has two columns of randomly-generated numbers. Open this file and repeatedly change the value of Cell E2, which is labeled Input. Also, look at the formula in Cell E3 to view the INDEX command. See if you can tell what is happening and then come back and continue to read.

You’ll notice that if you put a 6 in cell E2, it returns a value of 28. Note that there are several rows which have a 6 in the Random A column. The first one is Row 3, where 6 is associated with 40. Row 20 also has a 6 in the Random A column with a 26 in the Random B column. So the INDEX command does not do a lookup for the value of 6. Instead, it simply looks up whatever is in the 6th row of the specified array (in this case A1:B24) and returns whatever value is in Column 2 of the array. That’s why the command in E3 is:

=INDEX(A1:B24,E2,2)

This says to return whatever value is in the second column of the appropriate row. If this had been a 1, it would return the value in the first column.

This tells you the number of the row to look up.

This gives the array in which you look for data.

Note that if you type a 1 in Cell E2, Excel will return “Random B” in Cell E3. A picture of this is given below.

(61)

Practice

Modify the file Index.xls so that the Array in Cell E3 to be considered is only Cells A7 to B20. (This is a smaller array that the previous example. Also, the first row of the new array, which has the numbers 7 and 14 in it, will now become “Row 1” for the purposes of the INDEX command.) Type in the number 5 into Cell E2. What number do you get? Answer: You should get a 30, not a 28.

You may be wondering why you would use INDEX when you have VLOOKUP. Here is an example similar to what you may see in a class project where INDEX might be helpful.

Example

The file CarIndex.xls is a list of the number of cars sold per day at a dealership during a one- year period. What we often need to do is randomly pick one of those days and then see how many cars were sold on that day. It’s like having 365 slips of paper (one for each day) and the number of cars sold on a day written on the papers. We put them into a big shoe box and then randomly pick one out, recording the number of cars sold. This is often called sampling and will play an important role in MATH&148. When you have hundreds, or even

thousands, of records to choose from, Excel’s INDEX command will allow you to do this. Look at the file:

(62)

In Cell E2, you can check to see that a random number between 1 and 365 has been generated. Do that now. Now, look at the contents of Cell E3. In this cell, the INDEX command has been used to select both columns A and B, Cell E3 is specified to contain the row number we are to look up, and the second column (Column B) is the data to be returned by Excel. If you press F9 repeatedly, you’ll see the equivalent of a new slip of paper being picked out of a shoe box (after the previous slip has been replaced).

Now, look at Sheet 2 of CarIndex.xls which has the same data as Sheet 1 does. Hit F9 a few times and you’ll notice it behaves just like Sheet 1 does. However, notice that the Random Number cell has been deleted. Look at the contents of Cell E3. You will notice that we have built the generation of the random number directly into the INDEX command:

=INDEX(A3:B367,RANDBETWEEN(1,365),2)

Instead of specifying a specific numerical value or cell reference as before, I’ve told Excel to generate a random number between 1 and 365 and to use that as the number of the row to look up. The second column still remains the one that gets returned. A picture of the formula bar is given below:

(63)

Practice

The file PhoneLog.xls gives a list of 750 phone calls tracked by a telemarketing company. The call number is logged along with the amount of sale made on that call. In Cell D2, use both the INDEX command and the RANDBETWEEN command to randomly pick one of the calls on the list and return the sale amount for that call.

Optional: How I Built the Phone Log File

Here’s how I built the PhoneLog.xls file for this example. You may find it interesting as it uses many of the commands in this section.

First, I entered 54869 (an arbitrary number) into Cell A2.

In Cell A3 I entered =A2+1 so that it would increment the number for me. I then copied Cell A3’s formula down so that 750 data points were generated.

In Cell B2 I entered the following: =IF(RAND()>0.7,RANDBETWEEN(15,300),0)

What this did was use RAND() to generate a number between 0 and 1. If that number was greater than 0.7, then I used RANDBETWEEN() to generate a sales amount between $15 and $300. If the initial random number was less than or equal to 0.7, then I recorded a sales value of $0. My thought process was that 70% of the phone calls would lead to no sales, while 30% would lead to sales.

I then copied Cell B2’s formula down so that 750 sales data points were generated.

I selected all the cells in columns A and B that had numbers in them (1500 in all) and copied them with CTRL-C.

I then clicked on Cell A2 and dida Paste Special...Values command so that all the ugly formulas were gone and only the numerical values remained.

(64)

Graphing

Basic Graphing

Graphing a large amount of data by hand is tedious and very prone to error. Excel will graph data quickly and easily.

Example

Fuller and coworkers (1997) estimated the Costs of a medium-sized cotton gin plant as shown in the file Cotton.xls. Open this file to view the data. To graph this data, we will use the Chart Wizard. Here are the steps you take to graph this data. Please do them as they are described below to make sure you get some practice.

Select the data: Use your mouse to drag and select all the data to be graphed. Include the heading row.

Start the Chart Wizard: Click on the Insert tab on the Ribbon:

Select the Chart Type: As you can see, you have many choices of graphs to choose from. In this course, we will mainly use Column, Line, and Scatter graphs. For this example, let’s choose the Scatter choice. We’ll use the first choice in the list, as shown below:

(65)

That will generate a graph that looks like this:

This is your first glimpse at what the data looks like. We can refine our picture.

Refine your Graph: There is, unfortunately, no uniform way to change all elements of the graph. However, RIGHT CLICK often is a good first step. Let’s do some examples so you can see what I mean.

(66)

If you RIGHT CLICK with the mouse inside the box, you’ll get a menu:

Although it does not appear above, there is often also a menu for changing the font style, size, color, etc. You can use this to change the title as you see fit. You can select “Edit Text” to be able to change the text as well. I’ll change some things around so it looks like this. Follow along and make the same changes to insure you know how to alter the graph.

(67)

Change the Graph’s Point Style: We can change the color/style of the points as well. LEFT click on one of the points. Then make sure the Ribbon is set to show the Design tab. It should look like this:

You can see boxes at the top that allow you to change the colors of the points. Also, you can see many more options by clicking on the drop-down arrow in the lower right corner,

(68)

This will bring up many options, only a few of which are shown below:

It’s easy to select one and change the look of the graph. We’ll go to read with shadows:

Change the Axes: We can also change the way the axes look. For example, RIGHT click on the vertical axis and then choose “Format Axis…” from the list.

(69)
(70)

There are numerous options and changes you can make, as you can see. One common change is to alter the Number settings. Select “Number” from the list on the left:

You can choose general numbers, currency, dates, etc. I’ve chosen the second option, “Number” which allows me to specify how many decimal places to show. Choosing 2 and then clicking the “Close” button produces a graph with a vertical axis showing two decimal places, as below:

(71)

Adding Labels to Axes: Sometimes, you will want to add descriptive labels to your axes. To do this, first LEFT click the graph and then choose “Layout” from the Ribbon.

This give you many new options, including Chart Titles, Axis Titles, Data Labels, etc. You can experiment with these options on your own. Here, we’ll just add an Axis Title to the horizontal axis. Choose “Axis Titles” button and then “Primary Horizontal Axis Title,” followed by “Title Below Axis.” It looks like this:

(72)

When you select this option, the graph will add an axis title.

(73)

You can also do this for the other axis as well.

Changing the Chart Type: The next big thing to change is the Chart Type. Let’s first suppose we want to add lines to connect the red dots. LEFT click on the graph and then choose the “Design” tab from the Ribbon.

Now choose the “Change Chart Type” button on the left:

(74)

All the different chart types are listed, so it’s easy to make a change. You can experiment and see how this data would look using different displays. For now, we’ll choose the second option on the XY (Scatter) list:

(75)

If the line is too think, we can RIGHT click on the line (not a point) and then choose “Format Data Series…” and then go to the “Line Style” section. Changing the “Width” to 2 produces a nicer look.

(76)
(77)

Following this same basic procedure, we can view this data as a bar chart. I’ve changed the chart type and the bar colors to blue in the picture below. Can you reproduce the picture?

Using these tips and tricks, you can make the graph look any way you want. Keep in mind that the way your reports look is often very important out in the business world. Therefore, you should strive to have professional-looking graphs in MATH116 and MATH&148.

Practice

In the file Retire.xls you will find a list of annual interest rates and dollar values. The “First Year Income” is the amount this particular retiree can expect to receive in her first year of retirement, given different rates of return on her inve

References

Related documents