Excel – Chapter 2: Formulas, Functions, Formatting Not responsible for material from p 137 to end of chapter Project from this chapter (Specs on p EX 84-5): The Silver Dollar Stock Club: a group that invests money contributed by members. Create an easy-to-read worksheet that summarizes the club’s investments. For each stock, the worksheet is to include stock name stock symbol data acquired number of shares initial price per share initial cost current price per share current value gain/loss percent gain/loss Also include for each column totals average highest value lowest value Formulas for calculations: initial cost = (number of shares) * (initial price per share) current value = (number of shares) * (current price per share) gain or loss = (current value) – (initial cost) percent gain or loss = (gain or loss) / (initial cost) totals for initial cost, current value, and gain/loss use the AVERAGE function to determine the average for the number of shares, initial price per share, initial cost per share, current piece per share, current value, and gain/loss Use the MAX and MIN functions to determine the highest and lowest values for the number of shares, initial price per share, initial cost per share, current piece per share, current value, gain/loss, and percent gain/loss Creating the worksheet I’ve entered the data for you. Copy the workbook from public/fox/ExcelChap2Data.xlsx and save to your computer or USB drive. Note that in some of the column heading cells, data uses several lines. To make that happen, press ALTENTER where you want the line break. Usually, the height of the row will automatically expand to display all the lines. If it doesn’t, drag the row divider (or double-click it), just like you do the column divider to make a column wider. Formulas Remember that formulas must start with an = (equals sign) to let Excel know it should do a calculation. As part of a formula, you can use the following: Operators (in order of precedence) - negation % percentage ^ exponentiation * multiplication / division + addition - subtraction Precedence means in what order the calculations will be done. For instance in the formula =3+4*2 the multiplication is done first, then the addition, because the multiplication operator has a higher precedence than the addition operator, and in the formula =3*2^3 two is raised to the third power before the multiplication is done, because the exponent operator has a higher precedence than the multiplication operator. Using cell names in formulas In addition to using literal numbers in formulas, you can use cell names. Excel will then take the values in the cells and use them in the formulas. If the values in the cells change, the results of the formulas are updated. You can type in the names of the cells at the keyboard, or you can click on the cells to enter them as part of a formula. For example, you might type exactly the following at the keyboard: =d4*c4 and press the enter key, or you might type in the equals sign click on cell d4 type in the multiplication sign click on cell c4 press enter Either technique will have the same results. Entering formulas for this project 1. Initial cost (column F): the initial cost is found by multiplying the number of shares (column D) times the initial price per share (Column E) a. Click in cell F4 to select it b. Enter the formula =d4*e4 either by typing it or by using the point and click method c. Press Enter d. Because we want to use this same formula for each of the stocks, we can use the fill handle to copy the formula. i. Click in cell F4 ii. Grab the Fill Handle (the small solid rectangle at the bottom right of the cell) iii. Drag the Fill Handle down to cell F12 iv. Click outside the selection to de-select it e. To total the column i. Click in cell F13 ii. Click the AutoSum button ( on the Home tab of the ribbon iii. Press Enter. 2. Current value (column H): the current value is found by multiplying the number of shares (column D) times the current price per share (column G) a. Click in cell H4 to select it b. Enter the formula =d4*g4 either by typing it or by using the point and click method c. Press Enter d. Because we want to use this same formula for each of the stocks, we can use the fill handle to copy the formula. i. Click in cell H4 ii. Grab the Fill Handle (the small solid rectangle at the bottom right of the cell) iii. Drag the Fill Handle down to cell H12 iv. Click outside the selection to de-select it e. To total the column i. Click in cell H13 ii. Click the AutoSum button ( on the Home tab of the ribbon iii. Press Enter. 3. Gain/Loss (column I): the gain or loss is found by subtracting the current value (column H) minus the initial cost (column F) a. Click in cell I4 to select it b. Enter the formula =h4-f4 either by typing it or by using the point and click method c. Press Enter d. Because we want to use this same formula for each of the stocks, we can use the fill handle to copy the formula. i. Click in cell I4 ii. Grab the Fill Handle (the small solid rectangle at the bottom right of the cell) iii. Drag the Fill Handle down to cell I12 iv. Click outside the selection to de-select it e. To total the column i. Click in cell I13 ii. Click the AutoSum button ( on the Home tab of the ribbon iii. Press Enter. 4. Percent of gain or loss (column J): the percent of gain or loss is found by dividing the gain or loss (column I) by the initial cost (column F) a. Click in cell J4 to select it b. Enter the formula =i4/f4 either by typing it or by using the point and click method c. Press Enter d. Because we want to use this same formula for each of the stocks, we can use the fill handle to copy the formula. i. Click in cell J4 ii. Grab the Fill Handle (the small solid rectangle at the bottom right of the cell) iii. Drag the Fill Handle down to cell J13 iv. Click outside the selection to de-select it e. Do not total this column; we’ve already found the gain/loss percentage of the entire set of stocks in cell J13. Formulas using functions A function is a pre-written calculation, where somebody else has already done the work of figuring out how to do the particular calculation. You can use them as part of a formula, or as the entire formula. For instance, you have already used the function SUM. Some other examples of functions are SQRT which calculates the square root of a number and PMT which calculates the payment on a loan at a certain interest rate for a certain period of time. There are many other functions available. The format of a function is the equals sign, then the function name, then parentheses with the values inside the parentheses that the function needs to do its job. For instance, the sum function could be used like this =SUM(A4:A12) Functions generally require parameters or values to work on. These are included inside the parentheses, just like in the SUM function. The values can be actual numbers, or names of cells. There are several ways to enter functions. This project will demonstrate some of them. To find what functions are available, click the fx beside the formula bar. In the resulting dialog box, type in what you want to do in the search and click Go. The results will be possible functions to do what you’d like to do, and for each one a brief description. You can select one of them and click Help on this function for more information. Entering formulas for this project (continued) 1. Find the average of a range of numbers by using the AutoComplete list a. Click in cell D14 b. Type the equals sign, and start typing the word Average. As you type, an AutoComplete popup box appears with a list of functions that begin with the letters you are typing. Double-click Average in the list. The cell and the formula bar will display =AVERAGE( c. Without pressing Enter, click and drag across cells D4:D12. As you drag, the cell range is inserted in the formula. The cell and the formula bar will display =AVERAGE(D4:D12 d. Press the Enter key. Excel puts the closing parenthesis in place. Cell D14 will display 760, which is the average number of shares for the stocks. e. Click on cell D14 f. Grab the Fill Handle, and drag across to cell I14 to copy the formula to the other columns. Don’t include cell J14 because it is mathematically invalid to find the average of percent gain/loss. 2. Find the maximum value in a range of numbers by using the Insert Function box a. Click in cell D15 b. Click the Insert Function button (the fx beside the Formula bar). A dialog box will open. c. Type maximum in the Search box, and click Go. d. In the resulting list, click MAX. Notice that the description below the list box tell you a little about the function, and that there is a link Help on this function that you can click for more information and examples. e. Click OK. f. In the resulting Function Arguments box, type d4:d12 in the first text box, and click OK g. Cell D15 will display 990, which is the maximum value in the selected range. h. Click cell D15. Grab the Fill Handle and drag across to copy the formula into cells E15 to J15 3. Find the minimum value in a range of numbers by using the Sum Menu a. Click in cell D16 b. Click the dropdown arrow beside the AutoSum button on the Home tab (don’t click the AutoSum button itself, click the arrow) c. In the dropdown menu, click Min. Do not press the Enter key. The cell and formula bar display =MIN(D14:D15). d. In this case, the cell range Excel assumed is incorrect. Click and drag through cells D4:D12. The range you just selected will replace the range within the parentheses. The cell and formula bar will display =MIN(D4:D15) e. Press the Enter key. Cell D16 will display 380, which is the minimum value in the selected range. f. Click cell D16. Grab the Fill Handle and drag across to copy the formula into cells E16 to J16 Formatting the project 1. Change the worksheet Theme to Concourse a. Click the Themes button in the Page Layout tab of the ribbon (the button is at the far left) b. Click Concourse as the worksheet theme 2. Format the titles a. Select the range A1:J1 and click the Merge and Center button on the Home tab of the ribbon. b. Select the range A2:J2 and click the Merge and Center button. c. Select the range A1:A2 (the merged cells) i. Click the Cell Styles button on the Home tab of the ribbon ii. Click the Title cell style iii. Click the dropdown arrow beside the Fill Color button on the Home tab. iv. Click Turquoise Accent 1, lighter 60% (column 5, row 3) from the gallery v. Click the Borders button on the Home tab vi. In the dropdown Border list, click Thick Box Border d. Select cell A2 and click the Decrease Font Size button on the Home tab 3. Format column headings and total rows a. Select the range A3:J3 and apply the Heading 3 cell style b. Select the range A13:J13 and apply the Total cell style c. Select the range A14:A16 and click the Bold button on the Home tab. 4. Format the other text cells a. Select the range B4:B12 and click the Center button on the Home tab b. Select the range C4:C12 i. Click the Number Dialog Box Launcher (the small arrow in the bottom right corner of the Number group in the Home tab) ii. In the dialog box, click the Number tab and the Date Category iii. In the Type list, click 3/14/01, click OK 5. Format the numbers a. Select the range E4:I4, click the Accounting Style button on the Home tab b. Apply the Accounting Style to the range F13:I13 c. Apply the Accounting Style to the range E14:I16 d. Apply the Comma Style to the range E5:I12 e. Increase the number of decimal places of the stock prices i. ii. iii. iv. v. vi. vii. Click on E4 to select it Hold down the ctrl key and click G4 to select it also Click the Increase Decimal button in the Number group of the Home tab Select the range E5:E12 Hold down the ctrl key and select the range G5:G12 Click the Increase Decimal button (Note: you have to do the first row separately from the rest because otherwise the first row formatting would be copied to the other cells) f. Select the range J4:J16 i. Apply the Percent Style ii. Click the Increase Decimal button twice 6. Apply Conditional Formatting (Conditional Formatting applies a specified formatting to a cell only when it meets a specified condition) a. Select J4:J12 b. Click the Conditional Formatting button in the Styles group of the Home tab c. Click New Rule… d. Click Format only cells that contain in the Select a Rule Type area e. In the Edit the Rule Description area, click the box arrow in the second box and select less than. f. In the rightmost box, type 0 (zero) g. Click the Format… button h. In the Format Cells dialog box, click the Fill tab i. Click the light red color in column 6, row 2 j. Click OK to close the Format Cells dialog box k. Click OK to close the New Formatting Rule dialog box Changing column widths and row heights By default, columns are measured in the number of characters wide they are, and rows are measured by the number of points high they are (a point is 1/72 of an inch). There are three techniques to change column widths and row heights Move your mouse over the column or row boundary at the edge of the worksheet until it becomes a double-headed arrow, then either drag or double click the column or row boundary Right click a column or row heading. Choose Column Width or Row Height from the popup menu, then in the resulting box, type in the desired number. With a cell in the row or column selected, click on the Format button in the Cells group of the Home tab. Select Column Width or Row Height from the list, and type in the desired number. Changing the column widths and row heights of this project 1. Right-click the heading of Column A, select Column Width, and type in 14.11; click OK 2. Double-click the boundaries of Column B and Column C to get the best fit 3. Click in a cell in Column D, click the Format button in the Cells group of the Home tab; select Column Width; type 6; and click OK 4. Click in the heading of Column G to select it. Hold down the ctrl key and click the heading of Column G. Still holding down the ctrl key, click the heading of Column J. Click and drag the boundary of any of the selected columns until the tool tip indicates the width is 9.00. 5. Using the same technique, set the width of Columns F, H, and I to 12.67. 6. Set the Row Height of Row 1 to 60 7. Set the Row Height of Row 14 to 26.25