BSBITU402A Develop and use complex spreadsheets Writer: Lynda Frost, Hunter Develop a linked spreadsheet solution: Readings Formulas and functions By completing this reading you will be able to build formulas incorporating absolute/relative cell referencing, arithmetic and math/statistical functions. Formulas to Perform Calculations Microsoft Excel interprets an entry beginning with an equals sign(=) as a formula. There are many different types of formulas you will use. They are broken down into two main types of formulas: Formulas which can contain Arithmetic operators, constants and cell references Functions Formulas containing functions (built-in calculation tools). =B1+B3*10% =SUM(B1:B3) Mathematical operators include: Priority Symbol Math Function 1 * Multiply 2 / Divide 3 + Addition 4 - Subtraction Cell Names A cell or a range of cells can be given a name which can be used instead of cell references. Some of the advantages to using names are: Easier identifier to use than cell references Reduces the risk of using an incorrect cell reference in a formula Enables you to move quickly to an area within the worksheet Can be used to reference across sheets There are two ways you can give individual cells or ranges of cells a name, they are: Defining the Name Creating a Name Once you have given a cell or cell range a name you can then use that name in formulas instead of typing in the cell reference. Understanding Absolute Cell Referencing When you use an absolute reference in a formula, it points to a set cell address which will not change, even if the formula is copied elsewhere in the worksheet. Page 1 of 9 BSBITU402A Develop and use complex spreadsheets Writer: Lynda Frost, Hunter For example... The formula in C6 is =B6*$C$3. The use of the $ signs in the cell reference for cell C3 indicate that the cell reference is absolute - the reference cell C3 will not change even when the formula is copied. Your spreadsheet application records the formula as: "Multiply the cell two to the left with cell C3" Therefore it can be copied down column C and into column F. Your spreadsheet application will automatically change the relative cell reference to "the cell two to the left" to suit the current location, but the absolute reference to "cell C3" will not be changed. Functions and Their Syntax Listed below are the functions you should already be familiar with. A formula constructed with a function has a specific structure called the syntax. Check your spreadsheet application to ensure you are familiar with the syntax of each of the functions below. SUM SUM is a mathematical function. The SUM function returns the sum of all its arguments. AVERAGE The AVERAGE function returns the average (or arithmetic mean) of its arguments. All numbers are summed then divided by the total number of values. Empty cells are not counted, however cells containing the value zero (0) are included. MIN The MIN function returns the smallest value in its argument. MAX The MAX function returns the largest value in its argument. COUNT The COUNT function counts the number of entries in its argument. Page 2 of 9 BSBITU402A Develop and use complex spreadsheets Writer: Lynda Frost, Hunter Dates and Times Microsoft Excel uses serial numbers to represent dates and times. In this way normal calculations such as additional and subtraction can be carried out using dates and times. Dates and times are displayed automatically in date format. To display the date as a serial number, you would need to format the cell as General. There are six functions used by MS Excel when dealing with date and time they are: Date DATE(year,month,day) The DATE function returns the serial number of a date - useful in formulas where the date arguments are the result of other calculations. Now NOW() The NOW function returns the serial number of the current date and time. The result is updated each time a recalculation is performed. Today TODAY() The TODAY function returns the serial number of the current date. Year Given a serial number, the YEAR function returns the year, eg 1999. YEAR(serial_number) Month MONTH(serial_number) Given a serial number, the MONTH function returns the number of the month as a value from 1 to 12. Day DAY(serial_number) Given a serial number, the DAY function returns the number of the day as a value from 1 to 31. Check your spreadsheet application to ensure you are familiar with the syntax for dates and times. Using Conditions in Functions The IF function is used to test the condition of a cell and return a result if the condition is true or another if it is false. The IF function contains three elements, divided by a comma. IF(logical_test, value_if_true, [value_if_false]) These three elements are entered into the three boxes in the Formula Palette. Page 3 of 9 BSBITU402A Develop and use complex spreadsheets Writer: Lynda Frost, Hunter The first box contains a logical test or comparison using = or < or > or a combination of these. The second box contains the value that is to appear in the cell if the comparison is true. Note: A text entry must be enclosed in quotes and to leave a blank entry type in two set of quotes, opening and closing. The third box contains the value that is to appear in the cell if the comparison is not true. Example Auzzie supermarket charges $2.50 to deliver groceries if the destination is inside a distance of 10 km but charges $5.00 if the distance is more than 10 km. Say you need to prepare a table which automatically puts in the correct Charge depending on the distance entered into the Distance in km column. Study the formula in the charge column that calculates the charge dependent on what is in the distance column. Page 4 of 9 BSBITU402A Develop and use complex spreadsheets Writer: Lynda Frost, Hunter (Darrah, I only want to include the table and the rows and columns – no application specific information .i.e. crop it! – actual file is also available if required.) Lookup values in an existing tables. There are two versions of the LOOKUP function. VLOOKUP and HLOOKUP - where V stands for vertical and H stands for horizontal. The Vertical Lookup function is used to search a table for a given value and then return a value from a corresponding column within the table. The HLOOKUP function works in a similar way but returns a value from a corresponding row. Check your application software to determine the correct syntax for both formulas. Example The example below shows a worksheet with both a VLOOKUP and HLOOKUP table within it. The table headed Pay Rate and Hourly Rate on the left calls for a vertical lookup and the table headed Pay and Tax calls for a horizontal lookup. You look down the column for one and across the columns for the other. Most lookups, however, involve the vertical type. Page 5 of 9 BSBITU402A Develop and use complex spreadsheets Writer: Lynda Frost, Hunter Using the PMT function to calculate mortgage repayments. There is a function in Microsoft Excel that will calculate your mortgage repayments. The PMT function provides a function that returns the payment for a loan based on periodic constant payments and constant interest rates. The function includes the following arguments: =PMT (rate, per, pv, fv, type) Refer to the online help in your spreadsheet application for detailed information on each of the arguments. Inserting one function within another function. A nested function is a function within another function. The example below uses an IF function and an AVERAGE function. The syntax of the example nested function is: =IF(AVERAGE(number1,number2...)logical_test,value_if_true,value_if_false) Page 6 of 9 BSBITU402A Develop and use complex spreadsheets Writer: Lynda Frost, Hunter Summary of the most commonly used functions In the tables below are the most commonly used functions. Financial Used to calculate and solve financial problems, eg to calculate cash flow, depreciation, interest rates etc. Future Value FV(rate,nper,pmt,pv,type) Calculates the future value of an investment Internal Rate of Return IRR(values,guess) Calculates the internal rate of return for a series of cash flows Net Present Value Calculates the net present value of an NPV(rate,value1,value2,....) investment based on a series of periodic cash flows and a discount rate. Periodic Payment PMT(rate,nper,pv,fv,type) Calculates the periodic payment for an annuity Date and Time Used to display and calculate the date and time Date DATE(year,month,day) Returns the serial number of a particular date Now NOW() Returns the serial number of the current date and time Today TODAY() Returns the serial number of today's date Logical Formulas with logical functions in them are used for testing and decision making AND AND(logical1,logical2,....) Returns TRUE if all the arguments are true IF IF(logical_test,value_if_true,value_if_false) Returns one value if true, another value if false Math and Trig Used to solve basic mathematical problems through to more complex problems Absolute ABS(number) Calculates the absolute value of a number Cosine COS(number) Calculates the cosine of a number Round ROUND(number,num_digits) Rounds a number to specific number of digits Sum SUM(number1,number2,.....) Adds the arguments Page 7 of 9 BSBITU402A Develop and use complex spreadsheets Writer: Lynda Frost, Hunter Statistical Used to gather statistical information about a series of data. Some of the statistical formulas used include AVERAGE, COUNT, MIN, MAX etc Average AVERAGE(number1,number2,..) Calculates the average of all the arguments Count COUNT(value1,value2,....) Counts the number of values in the arguments Maximum MAX(number1,number2,....) Calculates the maximum value in the arguments Minimum MIN(number1,number2,....) Calculates the minimum value in the arguments Standard Deviation STDEV(number1,number2,...) Estimates the standard deviation based on the arguments Lookup and Reference Formulas used to lookup and refer to values within a worksheet/workbook Horizontal Look Up HLOOKUP(lookup_value,table_array, Looks in the top row of an array and row_index_num,range_lookup) returns the value of the indicated cell. Vertical Look Up Looks in the first column of an array and VLOOKUP(lookup_value,table_array, moves across the row to return the value of col_index_num,range_lookup) a cell. Database Database functions perform calculations on a specific column within a specified database. They are also used to determine which records are included (criteria range) in a calculation. Database Sum Adds the numbers in the field column of DSUM(database,field,criteria) records in the database that match the criteria. Database Minimum DMIN(database,field,criteria) Database Maximum Calculates the maximum values in the field DMAX(database,field,criteria) column of records in the database that match the criteria. Calculates the minimum values in the field column of records in the database that match the criteria. Text Text functions are used to alter, change, trim text, or perform searches for text within a worksheet/workbook Lower LOWER(text) Displays text within a cell in lowercase. Proper PROPER(text) Displays text within a cell with the first letter of Page 8 of 9 BSBITU402A Develop and use complex spreadsheets Writer: Lynda Frost, Hunter each word capitalised. Information Information functions are primarily used to display information about a cell/range, whether the cell matches a value to the formatting of the cell Cell Information CELL(info_type,reference) Displays specific information about the current cell or a selected cell. Information INFO(type_text) Displays information about the Excel operating environment. For more information on these functions refer to the on-line help. Linking Files With linked cells, the original information remains stored in the source file. The destination file displays a representation of the linked information but stores only the location of the original data. The source file must remain available on your computer or network to maintain the link to the original data. The linked information is updated automatically if you change the original data in the source file. A linking formula can also contain an external reference, which is a reference to another document. Finally, a number of sheets can be linked together in order to produce a summary of all the linked sheets. Page 9 of 9