27
CSCI 130 Introduction to Engineering Computing Spring 2010 Lab Workshop #2 Purpose : · practice many of the common operations of the Microsoft Excel 2007 spreadsheet program · create formulas and use common Excel functions · set up a typical engineering calculation and complete a few "what-if" exercises with it 1. Start up Excel 2007 from Windows Vista by clicking on Start then Microsoft Office Excel 2007. 2. Moving the Selected Cell (the highlighted one) 2.1 Experiment with the arrow keys to move the selected cell around. Do not hold them down too long because they will auto-repeat and take you too far. Select another cell by moving the mouse pointer to it and clicking. 2.2 Try the Ctrl-Home key combination. It should return the selected cell to A1. Use the PgDn and PgUp keys: they move the window down and up about 20 rows at a time. 2.3 Experiment with the sliders on the right and lower border of the screen. Click on either side of the slider and it will move one screen in that direction. Drag the slider (hold down the mouse button and move the slider) to move greater distances. Clicking on the arrow buttons at either extreme of the slider track will move the view one cell at a time. 2.4 Set the END mode (an End Mode flag should appear at the bottom left of the screen) with the End key. Note that this is a toggle (press End again and the END mode flag goes off). Set it on and try a ¯ key. With an empty spreadsheet, the current cell should go to the lower extreme. How many rows are there? ________ What power of 2 is this number? ____ Also, note that once the END mode is "used", it is automatically toggled off. Press the Ctrl-Home key combination to go back to cell A1. Now, set END again and try a ® key. The current cell should now be in column IV [This is not a Roman numeral IV! Notice how the columns are lettered.]. Go back to A1 with just the Home key. The Home key stays in the current row and goes to the extreme left (column A); while the Ctrl-Home combination returns the selected cell to A1. Figure out how many columns there are. How many? __________

Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

Embed Size (px)

Citation preview

Page 1: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Introduction to Engineering Computing Spring 2010

Lab Workshop #2

Purpose: · practice many of the common operations of theMicrosoft Excel 2007 spreadsheet program

· create formulas and use common Excel functions· set up a typical engineering calculation and complete

a few "what-if" exercises with it

1. Start up Excel 2007 from Windows Vista by clicking on Start then Microsoft Office Excel 2007.

2. Moving the Selected Cell (the highlighted one)

2.1 Experiment with the arrow keys to move the selected cell around. Do not hold them down too long because they will auto-repeat and take you too far. Select another cell by moving the mouse pointer to it and clicking.

2.2 Try the Ctrl-Home key combination. It should return the selected cell to A1. Use the PgDn and PgUp keys: they move the window down and up about 20 rows at a time.

2.3 Experiment with the sliders on the right and lower border of the screen. Click on either side of the slider and it will move one screen in that direction. Drag the slider (hold down the mouse button and move the slider) to move greater distances. Clicking on the arrow buttons at either extreme of the slider track will move the view one cell at a time.

2.4 Set the END mode (an End Mode flag should appear at the bottom left of the screen) with the End key. Note that this is a toggle (press End again and the END mode flag goes off). Set it on and try a ¯ key. With an empty spreadsheet, the current cell should go to the lower extreme.

How many rows are there? ________ What power of 2 is this number? ____

Also, note that once the END mode is "used", it is automatically toggled off. Press the Ctrl-Home key combination to go back to cell A1. Now, set END again and try a ® key. The current cell should now be in column IV [This is not a Roman numeral IV! Notice how the columns are lettered.]. Go back to A1 with just the Home key. The Home key stays in the current row and goes to the extreme left (column A); while the Ctrl-Home combination returns the selected cell to A1.

Figure out how many columns there are. How many? __________

2.5 There is another way to make big moves on empty cells in the spreadsheet. Try Ctrl-¯. That should take you to the bottom. Return to the A1 cell with Ctrl-Home. Now try Ctrl-® then Ctrl- .

2.6 Now try the GoTo key: it is F5. Type cell address G15 and the selected cell should jump within the current window to that cell. Try F5 again. Type BT7777 and the current cell should jump there, making that cell visible within the window. Return to A1.

2.7 Another way to do this is to type a cell address directly into the Name Box just above the column A label. Try that.

There are many ways to move the selected cell around. These are most of them.

Page 2: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 2

3. Making cell selections

3.1 Copy the file SelectionPractice.xlsx from the Share\Lab02 folder on the K: drive to your Lab02 folder under the Students/username directory.

3.2 Open the file in Excel 2007. Do this by clicking on the Office button in the upper left hand corner, and then selecting Open. You should see the Open window. There, you will need to browse to thefile and click the Open button.

The worksheet shown belowshould appear.

3.3 Selection jumps

Select cell B2. Place your cursor at the bottom of the cell.

Double-click and observe that the selected cell jumps to the bottom of the block of filled cells.

Place your cursor at the top of cell B7 and double-click. The selected cell should jump back to B2.

Of course, it would have been very easy just to click on the B7 cell to select it, and not double-click on the lower boundary of B2. But that is not always the case.

Select cell B10. Double-click on its lower boundary. Which cell is now selected?

__________________

Again, double-click on the upper boundary of that cell, and the selected cell should jump back to B10. You can also double-click on the sides of the selected cell to jump to the right or left within a block of filled cells. Try this by clicking the right boundary of cell B10 and then the left boundary of cell E10.

Select cell B7 and double-click on the lower cell boundary. Note what happens. Double-click again on the lower boundary of B9. Observe again. Double-click on the lower boundary of cell B10. That should look familiar. And, finally, double-click on the lower boundary of cell B759. What happens there, and why is it different from double-clicking on the lower boundary of cell B7?

_____________________________________________________________________________

Page 3: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 3

It is common in working with spreadsheets to encounter large blocks of data. You need to learn efficient ways to move around those blocks. Double-clicking on the cell boundary is one of those.

Select cell B2 again. You already know that if you press the key, the selected cell will move to B3. Instead, hold down the Ctrl key and press the key. You should see a jump of the selected cell to B7. Try the Ctrl- combination and the selected cell should jump back to B2. Ctrl- and Ctrl- will work as you probably expect.

Starting with cell B2 again, execute repeated Ctrl- combinations and observe. Then, reverse everything with Ctrl-. Describe below any differences between the Ctrl-arrow technique and the double-click on the boundary technique.

_____________________________________________________________________________

_____________________________________________________________________________

_____________________________________________________________________________

3.4 Selecting blocks

Click back on our favorite cell B2. If we want to select a block of cells, for example, B2:B7, a typical way to do that would be to “drag out” the block with the mouse. You practiced that in the last lab. Practice it again.

As you might suspect, there are alternates to dragging out a range. To see why alternate methods might be useful, select cell B10. Now, drag out the entire range colored green. You will generally find that way of doing it tedious, even if you are quite proficient at it.

Click again on cell B2. Now, we will extend our double-click on the boundary of the cell technique to block selections. Hold down the Shift key and double-click on the lower boundary of cell B2. You should see the B2:B7 range selected. Click on the B7 cell, then, with the Shift key pressed, double-click on the upper boundary of the cell. What difference do you notice between the select-down and select-up techniques?

_____________________________________________________________________________

_____________________________________________________________________________

There is not that much advantage to this latter technique compared to the “drag out” technique here. But, click on cell B10 and try the select-down method there. That is a very efficient way to select a long column of data.

We can also extend the Ctrl-arrow technique in a similar way by adding the Shift key to it.

Click on cell B10. Hold down both Ctrl and Shift and press the key. That should select B10:B759. Now, try Ctrl-Shift- and you should get the full block B10:E759 that has a green background. That is much more efficient than trying to drag out the range.

Press Ctrl-Home. We will now introduce two quick techniques for block selection. Select a cell in the green block, such as D15. Hold down the Ctrl button and press the asterisk (*) key1. You should see the entire green block selected. Now, that was quick!

1 Note: On a full keyboard, there is a separate * key above the numeric keypad to the right. Alternately, you can use the * above the 8 by holding Ctrl and Shift and pressing the 8 key.

Page 4: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 4

Select cell D15 again. This time, try the Ctrl-A key combination. Again, the entire block should be selected, but what is the difference between this technique and the prior one?

_____________________________________________________________________________Take note that, if you have a table with headings, these two techniques will select the entire table including the headings. If you don’t want the headings, you should use one of the prior selection techniques.

We’re getting there, only a couple other details to cover.

Select cell B10 (again!). Use the Ctrl-Shift- technique. You should have selected B10:B759, and the lower end of the selection is visible. Most often, after making such a selection, you want to have the upper end of the selection within view. How to do this?

A first, common technique would be to use the vertical “slider” on the right side of the spreadsheet window. You can “grab” this with the mouse and drag it straight to the top. Try that.

We will introduce another technique just below, but first a review exercise from Lab #1.

Select the range B2:C7. You will notice that B2 is the “active cell” within the selection – it is not shaded. Press the Tab key, and you should see the active cell move within the selection. Take it to the end of the selection and beyond. What happens?

_____________________________________________________________________________

Try the BackTab (Shift-Tab) key and observe its behavior. You will also note that the movement of the active cell is across rows first then up or down columns.

OK, go back and select cell B10 and use Ctrl-Shift-. Now, press the Tab key once and then the BackTab. What you have done is move the active cell down one cell and then back up. That sounds like a nonsense combination, but the side effect has been to bring the top of the selection back into view. This is a neat, useful technique to know about.

Finally, for this section, you will learn how to make multiple selections that are disconnected or not contiguous one from the other.

Select cell E2 and drag out the range E2:G4. Now, let’s say we want to add a range to this selection that is not connected to it. The key to this now is to hold down the Ctrl key. Do this and drag out the range F6:G7. What you have should look like the following.

If you want, you can continue to add other cells or other ranges of cells to the selection by continuing to hold down the Ctrl key.

Notice that the active cell is in the upper left hand corner of the most recent range selected. You can move the active cell amongst the ranges using the Tab and BackTab keys.

A first way this technique is useful is to select a number of different cells or ranges of cells and then adjust their format all at once.

A second, important use for this technique is to select certain columns (or rows) for graphing, leaving out other columns (or rows) in an overall block of data. Let’s try that with the green block.

Page 5: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 5

We’re going to select columns B, D and E, leaving out column C. Select cell B10 (ever done that before?). Select the entire B column of data using Ctrl-Shift-. Bring the view back to the top using Tab and BackTab. Hold the Ctrl key down (and don’t let up until we tell you!). Click on cell D10. Add the Shift key, then press then . That completes the selection, but return the view to the top with Tab and BackTab. Which cell is the active cell?

_____________________________________________________________________________

These three selected columns might now be used to create a graph.

It is likely that many of these techniques are new to you; yet you may have used Excel for some time now and have built up certain habits in the way you use it. It will be easier for you to stay with your olde ways and not adapt to newer, more efficient techniques. The only way you can break through that barrier is to practice. We suggest that, later on, you return to this lab to practice. Many veterans of CSCI 130 “blow away” other students, faculty, employers by how efficient they are with Excel. They hear comments like “How did you do that?!” or “Where did you learn how to do that so fast?!” or “Can you teach me how to do that?” Learn well, and you will hear such comments down the road.

Carry on!

4. Ribbon Operations

4.1 The ribbon tabs, groups and individual command buttons can be accessed using the keyboard or the mouse. Here you’ll try both.

Access the main menu from the keyboard by pressing the Alt key. You can select a menu item by pressing the key letter shown by it. When you press a letter along the top of the ribbon, that ribbon's items appear below. Key letters appear for those items. Try2 Alt A W G, and you will see the Goal Seek dialog pop up.

You can also operate the menus with the mouse. This is more common, although it is generally slower than using key letters3. Repeat the Goal Seek selection by clicking Data / What-If Analysis / Goal Seek.

Context-sensitive menus (floating in the Excel window) will appear when you click the mouse's right button. This is an important technique for accessing appropriate menu items quickly.

4.2 As with many other software packages, Excel has a context-sensitive help facility. You can try it out at any point in this exercise, or at other times, by pressing the F1 key. You will find it especially helpful when you get to a menu option you don't understand or are searching for a feature which you think Excel might have. You can also access the help system through the blue

question mark in the circle at the far right of the ribbon.

4.3 Many of you may be more familiar with a previous version of Excel, such as Excel 2003. If so, Excel 2007 takes some getting used to. One of the tools that is helpful for making the transition from 2003 to 2007 is accessed from Help (F1) Getting Help Interactive: Excel 2003 to Excel 2007 command reference guide. This opens up a window in a web browser where you can issue a set of Excel 2003 commands and the way of accomplishing that in Excel 2007 will be shown to you in animation. Try this. Click on Tools Goal Seek on the Excel 2003 window and watch it animate how that is done in Excel 2007.

That covers basic ribbon operation. Excel has a menu system with many, many choices. This may appear complex to you, as a beginning user, but later on you will appreciate the power that comes

2 Don’t press the arrow keys here. The is just there to indicate the sequence.3 Excel “super-users” use the keyboard more frequently than the mouse and cruise at “warp speed.”

Page 6: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 6

along with the menu system. Certain menu options have hot key combinations which select them directly. You will probably find it convenient to memorize a few of the common hot keys to make things go faster. We will introduce these as we go along.You practiced some additional ribbon/menu operations in Lab #1. You should keep those in mind and review them as necessary.

For now, close the SelectionPractice workbook ( or click on the lower X in

the upper right hand corner ) and open a new, blank workbook

( ).

5. Entry of Numerical Quantities, Labels, and Formulas

5.1 Move the selected cell to B2. You should note that B2 appears at the left of the formula bar entry line in the "Name Box" just above the spreadsheet column labels. Type 12.34 and note how these characters now appear in the entry area and in the cell itself. The cursor should be blinking in the B2 cell.

In Excel 2007, entry and editing are shown in the entry line and the cell itself. It is possible to use the BackSpace key to make corrections without leaving Enter mode [see the Status bar, lower left of screen]. Back over the 4 and the 3, and type 56 instead. Now press the Enter key. The B2 cell should display 12.56 and the selected cell automatically moves down to B3.

You can use the Office Button to configure many of Excel’s operating characteristics to your own liking. For example, make the following change:

Click on the Office Button and the Excel Options button at the bottom of the window. Click on the Advanced selection on the left, and you should see an x in the box labeled After pressing Enter, move Selection with Down in the selection box. Click on this x to remove it; then click on OK. Now, when you press the Enter key after typing something into a cell, the selected cell won’t move down4. Leave it that way for the rest of this exercise.

5.2 Move the selected cell down one with the ¯ key, to B3, and type 24.93, but instead of pressing the Enter key, try the ¯ key. This should cause the value to be entered and the selected cell to move down. Now, type -13.55 and press the ¯ key twice. The current cell should now be B6 with one blank cell above. Move one cell to the left, to A6.

Notes about numbers:

1) You need not type a decimal point if there is no fractional part in a number.2) It is possible to enter (and display) numbers in scientific "E" notation, e.g. 6.023E23.3) Excel stores all numerical quantities in a real format with ~15 significant digits, the same as

double precision in other software packages and programming languages.

4 Later on in the course, you will find that modifying this option is really important. That happens when we get on to VBA program development.

Page 7: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 7

5.3 With the selected cell as A6, type Sum and press Enter. Note that the word Sum is entered "left justified" in the cell and appears in the entry line too. It is useful to know how to right-justify or center a label. This can be done easily by clicking on the Align Right or Center icon buttons in the Alignment frame of the Home ribbon. If you are not sure which these are, leave the mouse pointer on a button for a second or so, and a tooltip will appear to identify the purpose of the button.

What happens when you enter a label that is too wide for the cell? Try it in A6.

__________________________________________________________________

Move the selected cell to B6 and enter a number. What happens to your long label?

__________________________________________________________________

Return to A6, type Sum again and move the selected cell back to B6.

5.4 Now you will enter a formula in cell B6. Excel recognizes a formula when it begins with an = sign. Enter the following formula:

=b2+b3+b4 (followed by the Enter key)

The formula, as typed, should be shown in the entry area, but the result of the formula, the sum of the quantities in those three cells, should appear in the selected cell. The result should be 23.94.

Re-enter the formula, but use pointing this time. Don't press the Enter key until you're finished. Start with the = again, then move the key so that the cell with the moving dashed boundary goes to cell B2. The mode indicator in the lower left of the screen should show Point, and the address B2 should appear automatically in your formula in the cell and on the entry line. Now, type another +. Note how the highlight returns to the selected cell and the mode indicator is now Entry. Point again, but to cell B3 this time, type a +, point to cell B4, and finish the formula with the Enter key. You should have the same result as before. Pointing is often more convenient than direct typing of cell addresses.

A third way to enter the formula is using the mouse to point. Start with the = sign again, then click on cell B2. The address B2 should appear in your formula. Now, type another + and then click on cell B3. Finally, type another + sign and click on B4 followed by the Enter key. Again, the result should be the same as before.

Move the current cell to B2. Enter 12.34 there, and you should see the Sum cell update automatically. That is the nature of a spreadsheet: all cells will be updated whenever a single change is made—this will happen automatically unless you change the "calculation mode" of Excel to manual.

Formulas in Excel are constructed with most of the same rules which apply to expressions in computer languages like C and Fortran. The symbols and precedence of arithmetic operators are

· negation (unary -)· exponentiation (^)· multiply and divide (* and /)· addition and subtraction (- and +)

with parentheses used to enforce a particular order of calculation. For the moment, you will use cell addresses, like B2, in your formulas. Later you will create cell names which are like variable names in other programming languages.

Page 8: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 8

Page 9: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 9

5.5 Excel has many special functions that can be used alone or as part of a formula. Move the current cell to B6 again, and enter the formula

=sum(b2,b3,b4)

You should get the same value. Try a similar formula, but use a range address of cells instead of a list of individual cells:

=sum(b2:b4)

Same answer? It should be. Now, we will enter the same formula, but use pointing and dragging this time.

Start by typing =sum(

Then, using the key, point to cell B2. Anchor that cell [create a one-cell block] by pressing the period (.) key, and the B2 in the entry line should change to B2:B2. Now, press the ¯ key twice to outline the block down to B4 -- this block should be outlined with the moving dashed boundary and denoted as B2:B4. Finish the formula by typing the right parenthesis ) and pressing the Enter key.

Now, move to selected cell to B7 and start the formula

=average(

This time, you’ll use the mouse to select the block of cells. Using the mouse, move the cursor to cell B2, hold down the mouse button and drag out the B2:B4 block; then release the button. It should be entered automatically in the formula. Finish the formula by typing the right parenthesis, ) and the Enter key.

Does the answer look right? What is it? __________

Enter the following formulas in cells below B7 and write down your answers in the spaces provided:

=var(b2:b4) [sample variance] _________________

=stdev(b2:b4) [sample standard deviation] _________________

=min(b2:b4) [minimum] _________________

=max(b2:b4) [maximum] _________________

Make a few changes in the numbers in cells B2, B3, and B4, and see how the results of all the formulas are updated.

You have completed practice of entering numbers, labels, and formulas.

Page 10: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 10

6. Editing Cell Quantities.

6.1 It is possible, as you have seen, to change a formula by re-typing and re-entering it into the cell. This is not the most efficient way for long formulas or labels—in these cases you will want to use the Edit key, F2. Let's try a simple example.

Move the current cell to B6 again and press the F2 key. The mode indicator in the lower left of the screen should be Edit, and the formula should appear in the cell (it’s on the entry line too) with the cursor at the end of that line. Try the key—the cursor should move to the left across the line. You may notice that appropriate pairs of parentheses are emboldened as you move the cursor across the line. This is to help you make sure than the pairs are matched up correctly. When you are in Edit mode, the and ® keys do not move the current cell; they move the cursor for editing. Try the Home key and the End key. What do they do?

_____________________________________________________________________________

Move the cursor just before the character b of the B2 entry and press the Delete ( or Del ) key. Type b again. The cursor should be between the b and the 2. Press the BackSpace key—again type the b character. This is typical editing/word processing protocol. After having made changes, one enters the revised formula with the Enter key. The cursor can be anywhere on the line when you press the Enter key.

It is always possible to bail out of Edit mode with the Esc key, if the editing changes are not desired. You can also toggle back and forth between Edit mode and Enter mode with the F2 key.

Another common way to initiate the editing of a cell is merely to double-click directly on the cell. Try that.

6.2 Another common need is to erase the contents of a cell, a block of cells, or the entire spreadsheet. Move the selected cell to A6 where the label Sum is. You can erase the contents of this selected cell by pressing the Delete key.

Caution: If you move too fast and make a typographical error, it may be hard for you to figure out what happened to your spreadsheet! Excel allows you to back up one step with the Undo command (or the Ctrl-z combination). There is also an Undo button on the Quick Access toolbar at the top left of the window next to the Office Button. Find it and sketch what is looks like in the rectangle below.

Now, move to cell B7. Select the block of cells B7:B11 with the mouse and press the Delete key. Try the Ctrl-z combination to recover what you erased.

Excel will usually recover several steps, but it will only go back so far, and certain operations cannot be recovered; so, if you think you’ve made a mistake, stop and consider using Ctrl-z before you go on!

You now will erase the entire spreadsheet. Select all cells in the spreadsheet by clicking on the button at the upper left of the spreadsheet cells, between the 1 label and A labels.

That selects all cells in the spreadsheet. Then press the Delete key, and the spreadsheet is cleared.

Page 11: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 11

7. You will now explore two powerful features of Excel: creating data tables and graphing.

7.1 Move the selected cell to B2. You will create a column of evenly-spaced numbers using the Fill command. You’ll do this first using the menu and then again using the “fill handle.” First, enter a 0 (zero) in cell B2.

With B2 as the selected cell, click on the Fill button in the Editing group on the Home ribbon. Select the Series choice, and you should see a Series dialog box. Use the mouse to set the Columns option button (important!). Click in the Step Value field and type a value of 0.1. Do not press the Enter key. Then click in the field for Stop Value and type 10. Finally, click the OK button and cells B2:B102 should be filled with the numbers 0 through 10 in steps of 0.1. It’s easy to check out the bottom of the block of numbers by using the Ctrl- ¯ key combination and then the Ctrl- key combination.

Now, you’ll create the series again in a different way. First, select the entire B column by clicking on the B label at the top. Then, press the Delete key to clear the column’s cells.

Enter the numbers 0 and 0.1 in cells B2 and B3 respectively. Select both cells with the mouse by clicking on B2 and dragging to B3. Move the mouse cursor to the lower right corner of the

selection, on the small black rectangle there called the “fill handle” , and you should see the hollow plus sign cursor change to a narrower solid plus sign. Hold down the mouse button and drag down through cell B102, then release the button. The series should be established. You may have noted you had to pull the plus sign slightly below the spreadsheet area to drag down to cell B102 slowly. If you pull the plus sign too far down, the selection moves quite rapidly.

When to use the above two methods? For short series, the autofill technique is faster. For longer series, e.g., several hundred numbers, the Fill Series technique works best. The one you just did is in between—your choice.

You'll note that the various values are displayed with or without decimal fractions as required, even though they are stored internally to 15 significant figures. To improve the appearance of the column, it is possible to have all numbers appear in the same format. Let's do this.

Select the B2:B102 block of numbers Now, find the Increase Decimal icon button in the Number

group on the Home ribbon. It looks like . Click on this button once, and all the numbers should be formatted to one decimal fractional digit. Click on it again, and two decimal fractions are displayed. Click on the Decrease Decimal button to the right and the display will return to one decimal fraction. That’s about right.

7.2 Select cell C2. Enter the following formula using mouse-pointing exactly as directed.

=exp(-

click on cell B2(Note that B2 is entered automatically into the formula.)

/4)*sin(

click again on cell B2

) Enter

Page 12: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 12

The formula should now show at the top of the screen as

=exp(-B2/4)*sin(B2)

and the result shown in cell C2 should be 0.

Now you will observe a key feature of spreadsheet programs: relative copying. Make sure that cell C2 is selected. Position the mouse pointer on the fill handle and, holding the mouse button down, drag downward one cell. Release the button and your formula should have been copied down to cell C3. This is called a “drag copy.”

What is the numerical result in cell C3? _________________________

Move the highlight down to that cell. Look at the formula in the upper left corner of the screen. Compare it to the formula in cell C2. What do you observe has happened to the formula as a result of the copy operation?

__________________________________________________________________________

Now, position the mouse pointer on the fill handle of cell C3, but this time double-click. Your formula will be copied downward in the C column adjacent all the entries in the B column. Isn’t that special?

Yes No (circle one – you know which one)

Explain what you have in your two columns of numbers:

__________________________________________________________________________

Select the entire block of numbers in the C column. Use the Decrease Decimal (and Increase Decimal) icon buttons to format the displayed numbers to 3 digits to the right of the decimal point.

Enter labels in the B1 and C1 cells as x and f(x) respectively, and, with both cells B1 and C1 selected, press the Align Text Right button in the Alignment group of the Home ribbon.

7.3 It is easy to adjust the width of the columns to make your spreadsheet more presentable. One way to do this is a manual adjustment. Place the mouse cursor at the top of the spreadsheet between the B and C labels for the columns. The cursor should change form to show a vertical

bar with two opposing arrows . Hold down the mouse button and move the cursor right or left a bit. You should see the column width change and notice that the actual width is shown in a small window just above. Release the mouse button when you have a satisfactory width.

What value does that width have? ___________

Another way to do this is to let Excel choose the column width automatically. To do this, place the mouse cursor between two column labels in a similar way, but then just double-click.You can adjust row heights in a similar way.

Page 13: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 13

7.4 Let's produce a graph with your table of numbers. First, select columns B and C by placing the mouse cursor on the B column label and dragging right to include the C column label. Select the Insert ribbon and click on the Scatter chart selection and the Scatter with Straight Lines type, as shown to the right.

You should see a rudimentary chart displayed on top of the spreadsheet. It is almost always preferred to move a chart like this to its own chart sheet. To do that, right-click on the border of the chart. Click on Move chart... , then on the New Sheet option button, and OK.

Your graph should now be displayed. Isn't that special!

There are many changes you can make to charts to have them be more presentable. We'll only review a couple of them at this point.

Click on Layout on the menu and Gridlines. Then select Primary Vertical Gridlines and Major Gridlines.

Click once on the blue curve to select it, then right-click to get a context-sensitive menu and click on Format Data Series. Click on Line Color, Solid Line and change the color to black. Click the Close button.

Click on the numbers on the vertical axis, right-click and click on Format Axis. Under Horizontal Axis Crosses: , click on the option button for Axis crosses: and enter a value of -0.4. Click on close.

Select Layout, Axis Titles, Primary Horizontal Axis Title, and Title Below Axis. Type x and Enter. Again, select Axis Titles, Primary Vertical Axis Title, and Rotated Title. Type f(x) and Enter.

Click on the main chart title and change it to your name. Make a print-out of your chart by selecting the Office Button, Print and QuickPrint. Hand it in with your worksheet.

7.5 Now, you will save your spreadsheet and exit Excel 2007. You can click on the Save button just

to the right of the Office Button . You should see the Save As dialog box. Check to see whether the D: drive is showing in the Save in: field. If not, you may have to move up one or more levels and back down. Click in the File Name field and type the name Decay; then click on the OK button. Your spreadsheet workbook should be saved to the D: drive as file Decay.xlsx.

Note: for subsequent saves during an Excel work session, now that the correct drive is selected, when you click the Save button, the saved file will update automatically.

Close this workbook by selecting Close from the Office Button menu or by clicking the lower x in

the upper right corner .

Page 14: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 14

8. A few of the common mathematical functions provided by Excel are

SQRT(·) square root SIN(·) sine, · in radiansABS(·) absolute value COS(·) cosine, · in radiansLOG10(·) log base 10 TAN(·) tangent, · in radiansLN(·) natural log DEGREES(·) radians to degreesEXP(·) exponential RADIANS(·) degrees to radiansINT(·) integer portion PI() value of piRAND() random number ASIN(·) arcsineMOD(X,Y) remainder of X/Y ACOS(·) arccosineROUND(X,n) X rounded to n digits ATAN(·) 2-quad arctangent

ATAN2(·) 4-quad arctangent

There are hundreds of other functions including statistical, string, logical, financial, date & time, database, and a miscellaneous category of functions. We will use only a few of them in the coming weeks. All are described in on-line help.

8.1 Start with a blank spreadsheet. You can do this by clicking on the Office Button and then New icon. Enter your name in cell A1.

Consider the following engineering formulas which are used to determine the flow rate in a pipeline where the flow passes through a concentric orifice:

where Q : flow rate in m3/s

: area of orifice, m3

: orifice coefficient, dimensionless

: pressure drop across orifice, pascals (N/ m2)

: fluid density, kg/ m3

The orifice coefficient, , can be calculated from:

where b: ratio of orifice diameter to pipe diameter

Page 15: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 15

Now, you will create a spreadsheet which computes the flow rate based on the various parameter values. Let's consider water flowing in a 6-inch pipeline with a 2-inch-diameter orifice and a pressure drop of 100 inches of H2O.

Enter the basic data first:1) in cell B2, enter 2, the orifice diameter in inches2) in cell B3, enter 6.065, the actual inside diameter in inches of standard 6-inch pipe3) in cell B4, enter 100, the orifice pressure drop in inches of H2O4) in cell B5, enter 1000, the density of water in kg/m3

5) enter the title Basic Data in cell B1

Add labels for units in column C and labels for variable names in column A:1) in cells C2 and C3, enter the label inches

[You can copy one down to the other with the fill handle if you want.]2) in cell C4, enter the label inH2O3) in cell C5, enter the label kg/m3

4) in cell A2, enter the label Do

5) in cell A3, enter the label Dp

6) in cell A4, enter the label deltaP7) in cell A5, enter the label rho8) right align the labels in cells A2:A5

Now, the first three values are converted to SI units (metric) to be consistent for the rest of the calculations.

1) in cell D2 and D3, enter a formula to convert the inches in cell B2 and B3 to meters bymultiplying by 2.54 (cm/inch) and dividing by 100 (cm/m) [You can copy one down to theother with the fill handle, if you want.]

2) in cell D4, enter a formula to convert the inH2O in cell B4 to pascals (N/m2) by dividing by27.7 (inH2O/psi), dividing by 14.696 (psi/atm), and multiplying by 101325 (Pa/atm)

And, add the following labels to column E:1) in cells E2 and E3, enter the label meters2) in cell E4, enter the label pascals

Now, create names for the following cells as shown in the table below using the procedure described below the table:

Cell NameD2 DoD3 DpD4 deltaPB5 rho

Select cell D2. Just above the column A label, you should see D2 in the Name Box. Click on that, and the D2 jumps to the left and has a blue background. Type in the name Do and press the Enter key. Now, when the D2 cell is selected, the name Do will appear in that window to the left of the downward arrow. Repeat this procedure for cells D3, D4, and B5, and create the names shown in the table above.

This is a typical set-up for an engineering calculation: enter the basic data along with explanatory labels, make necessary units conversions with labels, create cell names similar to the variable names for the problem. The creation of the names is particularly important in spreadsheet problem solving.

Page 16: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 16

8.2 Create the auxiliary formulas which lead up to the final equation. The first two formulas are for the cross-sectional area of the orifice and the b ratio. The third is the equation shown above for the orifice coefficient, .

1) in cell B7, enter a formula which squares Do, multiplies by pi, and divides by 4[Note: enter PI() in the formula for the value of pi.]

2) in cell B8, create a formula for b by dividing Do by Dp

3) in cell B9, enter a formula to compute from b according to the equation above4) in cells A7, A8, and A9, enter the labels Ao, beta, and Co, and transfer those labels as

names to cells B7, B8, and B9, in the following way: First, select the block of cells toinclude A7,A8,A9 and B7,B8,B9, that is, block A7:B9. Next, select the Formulas tab, and in the Defined Names frame, click on Create from Selection. You should see a CreateNames from Selection dialog box. Make sure that only Left Column is checked, then clickon OK. This is a convenient way to create a set of names at once.

5) Place a label of m2 in cell C7. It is also possible to display the 2 in this label as a superscript. To do that, edit the C7 cell by pressing F2 or by just double-clicking on the cell. Either use the mouse to highlight the 2 or use the arrow keys in the following way: move the cursor with the arrow keys just to the left of the 2, hold down the Shift key, and press the right arrow key once. With the 2 highlighted, right-click and select Format Cells. Click on the Superscript box andthen the OK button. Your label should now read m2. Much nicer!! You can modify other units that way too.

8.3 Now enter the final formula for flow rate in cell B11 as follows, using the names you have defined directly in the formula:

=Ao*Co*SQRT(2*deltaP/rho)

The value you obtain is in m3/s ; so enter a label these units in cell C11. Enter the label Q in cell A11.

In cell D11, create a formula which converts B11 from m3 to gallons-per-minute, by multiplying by 1000 (liters/ m3), dividing by 28.316 (liter/ ft3), multiplying by 7.48 (gallons/ft 3), and multiplying by 60 (seconds/minute). Label the units in cell E11 as gpm.

8.4 This should all result in a neatly arranged spreadsheet with a resulting flow rate of about 137 gpm. If you do not get this result, go back through your cells and check your formulas. Ask your TA for help, if necessary.

Demonstrate your spreadsheet to your TA and have him/her initial here.

Page 17: Lab Workshop #13 - Colorado Mesa Universityorg.coloradomesa.edu/.../Labs/Lab02/Lab02.docx · Web viewLab Workshop #2 Purpose:practice many of the common operations of the Microsoft

CSCI 130 Lab Workshop #2 Page 17

Try a few different values of the parameters according to the table below and enter your results in the table below:

Do (inches) DP (inH2O) r (kg/m3) Q (gpm)

3 100 1000

2 200 1000

2 100 700

Try the following what-if experiment with your spreadsheet. What diameter would you make an orifice so that, with water (r=1000) flowing through a 6-inch pipe at a design DP of 150 inH2O, the flow rate would be 200 gpm?

Enter your result here: __________________ inches

Save your spreadsheet as K:\CSCI130\XXX\Students\username\Lab03\Orifice.xlsx using the Save icon button. Close the spreadsheet with the menu commands File and Close.

There are many other features (seemingly endless!) to Excel 2007. You will see some more of them in class demonstrations and lab exercises. You can explore some of the branches of the menu system to find others. Some of the features, such as matrix methods, optimization, and linear regression, may not seem important to you now, but will certainly be useful to you in later courses.

The most relevant way to make Excel a useful tool for you is to use it to solve problems that arise in your courses, like physics, chemistry, and their labs. Most students in CSCI 130 learn spreadsheet problem solving and make wide use of Excel in their courses. They have an advantage over students who do not know how to use them. We hope you will be able to make good use of this powerful tool.

End of Lab Workshop #2