Quantitative Techniques: Laboratory 1 Excel: from basics to macros Work through this at your own speed. If you are already an expert user of Excel it should not take you very long. Open the version of Excel you find on the computer desktop. Get hold of the spreadsheet QTLab1Excel.xls. This should be available by navigating the internet to http://www.city.staff.ac.uk/j.s.cubbin. (During the class I will probably transfer it to the T: drive on the network so you can load it directly from there.) Before you do anything else save it to floppy or your hard drive. (Note: if you open it directly from the web page it will probably use a stripped down version of Excel which does not have all the features we will need.) Basics: moving about Go to cell D9 Sheet1 of the spreadsheet Starting each time from D9, What do the following keyboard combinations do? a) Shift + b) Home c) Shift+ Home d) Shift + End, (followed by) Shift + (Keep Shift key depressed) e) Control + f) Shift + CTRL + g) Ctrl + Shift +, Ctrl+Shift+ h) Shift + Spacebar i) CTRL + Spacebar Do any key combinations do the same as any others but more efficiently? …….. If I now go to B5, how can I Select the block of data between B5 and D13 using only the above keys? Answer.......................................................................................... Experiment with combinations of Shift, Ctrl, and PgUp and PgDn until you are sure what each combination will do. Double click on the tab at the bottom of Sheet1 and rename it Hands&Feet. Move the cursor between the headings of column C and D to increase the width of column C so the columns fit. These are just a few of the keyboard shortcuts. You can find out more from Excel Help. Naming and graphing groups of data Select the block from A5 to D13 and label it Block1 by pressing Insert, Name, Define. (Insert is found on the Menu bar at the top of the window.) In the top of the dialog box type “Block1”. To make sure you have the correct set of data defined as this block click on the icon to the right of Refers to…. and select the appropriate block using the keys you have just been practising with. 1 Label the rows of data as follows: Insert, Name, Label, Add Label Range…B6:B13 Create line graphs of the data in Block1 using its name to define the data source. (If you have not done this before, here is one way: Click on the graphics Icon. Choose line graph as the type. Click on Next. Type Block1 where it asks for Range. Data are in columns. Carry on through the wizard adding a chart title and axis names if you wish.) Then do the same for the block below it. What do you notice about the two graphs? Answer.......................................................................................... What is the significance of the underlining below a letter of each menu item? Answer.......................................................................................... (Hint: try pressing Alt and the letter at the same time. You will find this usef Standard formulae Excel has a series of standard formula which can be inspected by clicking on the fx button. What does the formula in G15 do? Answer.......................................................................................... Look at the formula in C7. The standard formula Rand() generates a random number uniformly distributed between 0 and 1. What does the formula in G17 do? In C7? Answer.......................................................................................... “Freezing” a random number. The random numbers are recalculated every time the spreadsheet is updated. This can be inconvenient when working with random numbers, and makes some people feel sea sick! To keep a particular set of random numbers, Copy the selection to where you want to keep it using Edit, Paste Special, Values. Your favourite trick Most people us only about 2% of the capabilities of software like Excel. But people have their favourite tricks that other people don’t know about. Do you have one to share with the rest of the group? Answer.......................................................................................... Additional material for homework if necessary: More advanced stuff: Producing a histogram This will demonstrate the use of the random number generator, and frequency distribution function. 1. Create a new spreadsheet and save with a name such as First histogram. 2. In Cell A1 type “=RAND()” (without the quotes) What number do you get? Is it the same as the person next to you? 3. Then copy this formula down as far as A1000. 4. Now copy it on to itself using Edit, Paste Special, Value 2 5. Now create a set of bins to put a frequency distribution in cells C2 to C12 as follows 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Now use Tools, Data analysis, histogram to produce a frequency table with A1 to A1000 as the data and C2 to C12 as the bins or interval limits. If you did not specify graphical output now generate a histogram from the frequencies using Excel’s graphing capabilities. Insert suitable titles at the top and on each axis. What do you expect the frequencies to be? Is the shape of the histogram as you would expect? 3