HO-13: MATHEMATICAL AND STATISTICAL FUNCTIONS After completing this exercise you will be able to: Insert and use in-built Mathematical Functions. Better understand the structure of functions and their arguments. Spreadsheet Functions All spreadsheet packages contain a range of functions (mathematical, statistical, information, database, logical, etc) which you can use in your worksheets. You are already familiar with one of the most common mathematical functions, SUM, which you have already used in earlier ho-exercises, and as you know, returns the sum of a series of values. SUM(values) 1. Open your ho-exercise workbook and insert a new worksheet called ho13. 2. Enter the numbers 2475.23456, 2573.275, 2213.576, 2648.901 and 2165.9861 in cells B3:B7. 3. Format the cells so that the data looks like it is in a table. 4. Select cell B8 and click on the Insert Function button on the Formula Toolbar (note you have previously used the AutoSum button to sum numbers). 5. This reveals the Insert Function dialogue box, in which functions are sorted into categories, the most recently used functions are listed first. 6. Select Math & Trig as the function category and select ok: bpho13.doc Page 1 of 5
7. This reveals the Function Arguments dialogue box, in which you enter the cell references that you want to sum. Select ok and the sum of the values in cells B3:B7 should be returned in cell B8: 8. Note that although a value is displayed in cell B8 (for the sum of the 5 values) the number is merely rounded to the nearest decimal place for display purposes only. Experiment with increasing and decreasing the column width to see what happens to the values displayed. 9. If the width of column B is set to AutoFit the value in cell B8 is displayed to the correct number of decimal places. This is the value that would be used in any calculation should the B8 form part of a formula in another cell: 10. There are many more mathematical functions in Excel that you can include in your worksheets. You will explore using some of these are explored in later ho-exercises. The ROUND Function - Math & Trig =ROUND(value,x) where x = a number between -15 and +15. This sets the precision of the number to x decimal points. 11. Move to cell C2 and enter a column heading: Round. 12. Next move to cell C3 and enter the formula =ROUND (B3,0). 13. In cell C4 and enter the formula =ROUND(B4,2). Continue with cells C5:C7 entering the following formulas: C5=ROUND(B5,-1), C6=ROUND(B6,1), C7=ROUND(B7,3). 14. Look at the values that have been returned in cells C3:C7 (see below), do you understand what the ROUND function has done? bpho13.doc Page 2 of 5
15. Note: the key issue is that the ROUND function affects the actual value not just the value that is displayed in the cell. When you are clear in your mind add a cell comment to C2 that explains what the round function does. ROUNDUP(value,x) and ROUNDDOWN (value,x) - Math & Trig where x = a number between -15 and +15. This sets the precision of the number to x decimal points. ROUNDUP rounds a number up to the nearest specified decimal place. ROUNDOWN rounds the number down to the nearest decimal place. 16. Move to cell E3 and enter the formula =ROUNDUP(B3,0). 17. Continue adding the following formulas in cells E4:E7, cell E4=ROUNDUP(B4,2), E5=ROUNDUP(B5,-1), E6=ROUNDUP(B6,1), E7=ROUNDUP(B7,3). 18. Move to cell F3 and enter the formula =ROUNDDOWN(B3,0). 19. Continue adding the following formulas in cells F4:F7, cell F4=ROUNDDOWN(B4,2), F5=ROUNDDOWN(B5,-1), F6=ROUNDDOWN(B6,1), F7=ROUNDDOWN(B7,3). 20. Look at the values that have been returned in cells E3:F7, do you understand how the ROUNDUP and ROUNDOWN functions work: 21. Can you think of a situation when you would need to make use of these functions? For example, as part of the final assignment you have to prepare a forecast for the number of members joining the wine club and you can only have 'whole' people, not fractions of people joining as new members, so one of the ROUND functions needs to be used to ensure that the formula returns a whole number. ABS(number) - Math & Trig Returns the absolute value of a number, ie. a number without its sign. 22. Select cell B15 and enter the value -32.567. Next move to cell C15 and enter the formula =ABS(B11). Note the result, again checking that you understand how the function works. bpho13.doc Page 3 of 5
TRUNC(number) - Math & Trig Truncates a number to an integer by removing the decimal, or fractional, part of the number. 23. Select cell B17 and enter the formula =TRUNC(B3). 24. Move to cells B18:B20 and enter the following formulas B18=B2*2.1, B19=TRUNC(B2*2.1) and B20=TRUNC(2.1)*E2 25. Compare the results of the calculations, again making sure you that understand what is going on: AVERAGE(values) - Statistical Returns the average of a series of values. 26. Move to cell B9 and enter the formula =AVERAGE(B3:B7) 27. It is also possible to nest functions within other functions, for example to roundup the average of cells B3:B7 to zero decimal places, you need to enter the following formula = ROUNDUP(AVERAGE(B3:B7),0). Try entering this in cell C9: 28. Again look at the values returned in the cells - making sure that you understand what is going on. MAX(values) - Statistical Returns the maximum value in a series of values. 29. Move to cell B10 and enter the formula =MAX(B3:B7). 30. Look at the value returned in cell B10 check you understand how the function works? MIN(values) - Statistical Returns the minimum value in a series of values. 31. Move to cell B11 and enter the formula =MIN(B3:B7). 32. Look at the value returned in cell B11 check you understand what is going on? bpho13.doc Page 4 of 5
MEDIAN(values) - Statistical Returns the number in the middle of a series of values. 33. Move to cell B12 and enter the formula =MEDIAN(B3:B7). 34. Look at the value returned in cell B12 check you understand what is going on? COUNT(range) - Statistical Counts the number of cells that contain numbers and numbers within the list of arguments. Used to determine the number of entries in a number filed in a range or array of numbers. 35. Move to cell B13 and enter the formula =COUNT(B3:B7). 36. Look at the value returned in cell B13 check you understand what is going on? COUNTA(range) - Statistical Counts the number of cells that are not empty. Used to count the number of cells that contain data in a range or array of numbers. COUNTBLANK(range) - Statistical Counts the number of cells in a specified range that are empty and do not contain any data. 37. Move to cell B22 and enter the following formula =COUNTA(B3:B21). 38. Then move to cell B23 and enter the formula =COUNTBLANK(B3:B21). 39. Compare the values returned in cells B22 and B23 and check that you understand what is going on? FURTHER READING AND RESOURCES Excel Formulas: http://spreadsheets.about.com/od/excelformulas/a/formula_hub.htm Excel Formulas and Functions: http://www.brainbell.com/tutorials/excel- 2007/Formulas-and-Functions/ Using Functions in Excel 2007: http://www.dummies.com/how-to/content/usingfunctions-in-excel-2007-formulas.html Excel 2007 Functions: http://oit.montclair.edu/documentationpdf/excel_2007_using_functions.pdf bpho13.doc Page 5 of 5