Introduction to Microsoft Excel Business Computer Applications What is it?: Spreadsheets Basics • Spreadsheet is a computerized ledger • Divided into Rows and Columns • Excel is a “spreadsheet” which holds different kinds of information • It performs calculations with mathematical and statistical functions • It presents your information in a variety of ways, with visually interesting charts and graphs • Constants - entries that do not change • Formulas - combination of constants and functions • Spreadsheet is generic term; Worksheet is an Excel term • Workbook contains one or more worksheets Why to Study it? Why to Study it? Absolute vs. Relative references Copying formulas does not always work This formula calculates first-quarter sales as a percentage of total year sales. Not surprisingly, it divides the number in cell B4 ($1,000) by the number in cell F4 ($4,100). However, when you pull the extension handle to copy the formula for Quarters 2,3, and 4, you don’t get the results you want. Press the Page Down key several times to see what happens. #DIV/0! means Excel is trying to tell you that you have asked it to divide by 0 -- an operation for which there is no answer. Why is this happening? Formula references To understand why this may be so, consider what the above formula is really saying. To Excel, B4/F4 actually translates as “when I’m sitting in cell B5, divide the number that is one row above me by the number that is four columns to my right and one row up.” In other words, the formula as written tells Excel to make a calculation relative to the cursor’s current position. Remember: the cursor always tells to Excel its current location (note B5 in the name box above). What you need to do for the formula to copy correctly is to tell Excel always to use the $4,100 (i.e., the contents of cell F4) -- no matter where you copy the formula. To do this, you need to make the reference to cell F4 an absolute reference rather than a relative reference. Use Page Down to see how to do this. Use the F4 key for absolute references The screen above shows the formula corrected so that it will give the desired results after it is copied. To convert a relative reference to an absolute reference while building a formula, press the F4 key immediately after clicking on the desired location with the cursor (in this case, the immediately after selecting the cell that has $4,100 in it). The formula changes to show a $ in front of both the column and the row for that location. You will notice that if you continue to press the F4 key, the command toggles to set the column, then the row, then both as absolute references. Trivia: Excel uses the $ to indicate absolute references because in the early days of spreadsheets PC keyboards had so few keys that software designers had to find multiple uses for each symbol. The company that first did this now out of business, but the $ stuck. Use the F4 key for absolute references This screen shows the result after you copy a formula that is correctly referenced. Use the Page Down key to walk through the steps. When you’re done, use Page Down to see a sequence that shows setting the absolute reference. Setting an absolute reference The F4 key has been pressed to right here to lock this location as an absolute reference. This time, all the copied formulas refer correctly to the $4,100 because that location has been set in the original formula as an absolute reference. You can check the results by looking at the copied formulas. They all refer to $F$4. Using Functions in Excel • Use spreadsheets in decision making; use Goal Seek and Scenario Manager to evaluate multiple conditions • Use financial functions (PMT, etc.) • Use fill handle and AutoFill capability • Use pointing to create a formula • Statistical Functions — MAX, MIN, AVERAGE, COUNT • Use functions over arithmetic expressions • Decision making functions (IF and VLOOKUP (vertical lookup)) Excel Built-In Functions SUM AVERAGE SIN IF AND COUNT COUNTIF Many More … (look at Help and fx) SUM(number1, number 2,…) • Example =SUM(3, 2) equals 5 • If cells A2:E2 contain 5, 15, 30, 40, and 50: =SUM(A2:C2) equals 50 =SUM(B2:E2, 15) equals 150 AVERAGE(number 1, number 2,…) • Examples If A1:A5 is named Scores and contains the numbers 10, 7, 9, 27, and 2, then: =AVERAGE(A1:A5) equals 11 =AVERAGE(Scores) equals 11 =SUM(A1:A5)/COUNT(A1:A5) equals 11 SIN(number) • IMPORTANT NOTE: – Angle (number) must be provided in radians If your argument is in degrees, multiply it by PI()/180 to convert it to radians. =SIN(PI()) equals 1.22E-16, which is approx. 0 =SIN(PI()/2) equals 1 =SIN(30*PI()/180) equals 0.5, the sine of 30 degrees COUNT • COUNT counts the number of cells that contain numbers & numbers within the list of arguments. • Value 1, 2,…, are 1 to 30 arguments that can contain or refer to a variety of different types of data, but only numbers are counted. • Ex., If cells A1:A17 contain some data, then =COUNT(A1:A17) equals 17 =COUNT(A6:A17) equals 12 COUNTIF(range,criteria) Counts the number of cells within a range that meet the given criteria. Suppose A3:A6 contain "apples", "oranges", "peaches", "apples", respectively: COUNTIF(A3:A6,"apples") equals 2 Suppose B3:B6 contain 32, 54, 75, 86, respectively: COUNTIF(B3:B6,">55") equals 2 (A4:A130,1) (A4:A130,2) (A4:A130,3) (A4:A130,4) (A4:A130,5) =COUNTIF(A4:A130,1) =D4/D9*100 Some Useful Functions • IF • TIME functions Conditional Functions • Conditional functions allow the software to perform conditional tests and evaluate a condition in your worksheet. Depending on whether the condition is true or false, different values will be returned to the cells. • =IF is the most important conditional function If =IF(condition, action if true, action if false) This tests the “condition” to determine if specific results or cell contents are true or false. If the result of the test is true, the “action if true” is executed. If the result is false, the “action if false” portion contains another set of instructions to execute. The instructions to be executed can return cell contents that are labels as well as values. Logical Operators • To perform conditional tests, logical operators are required. = < > <= >= <> Equal Less than Greater than Less than or Equal to Greater than or Equal to Not Equal Logical Functions And(logical1, logical2) Returns true if each condition is true Or(logical1, logical2) Returns true if either condition is true Not(logical) Returns true if the condition is false True() Always returns true False() Always returns false Examples =IF(A5>20, B5, 0) means that if the value in A5 is greater than 20, use the value in B5. Otherwise assign the number 0. =IF(AND(B11<>0,G11=1),10,0) means that if the value in B11 is not equal to 0 and the value in G11 is equal to 1, assign the number 10. Otherwise, assign the number 0. =IF(OR(E13=“Profit”,F15>G15),”Surplus”,”Deficit”) means that if either E13 contains the word “Profit” or the contents of F15 are greater than or equal to the contents of G15, assign the label “Surplus”. Otherwise, assign the label “Deficit”. VLOOKUP Function • Searches for a value in the leftmost column of a table, and then returns a value in the same row from a column you specify in the table. Use VLOOKUP instead of HLOOKUP when your comparison values are located in a column to the left of the data you want to find. Syntax: =VLOOKUP(lookup_value,table_array, col_index_num,range_lookup) – If range_lookup is TRUE, the values in the first column of table_array must be placed in ascending order: ..., -2, -1, 0, 1, 2, ..., A-Z, FALSE, TRUE; otherwise VLOOKUP may not give the correct value. If range_lookup is FALSE, table_array does not need to be sorted. VLOOKUP Function (cont’d) • Example: On the preceding worksheet, where the range A4:C12 is named Range: – – – – VLOOKUP(1,Range,2) equals 2.17 VLOOKUP(1,Range,3,TRUE) equals 100 VLOOKUP(.746,Range,3,FALSE) equals 200 VLOOKUP(0.1,Range,2,TRUE) equals #N/A, because 0.1 is less than the smallest value in column A – VLOOKUP(2,Range,2,TRUE) equals 1.71 Functions within functions • You can use functions within functions. Consider the expression =ROUND(AVERAGE(A1:A100),1). – This expression would first compute the average of all the values from cell A1 through A100 and then round that result to 1 digit to the right of the decimal point Open the Insert Function dialog box • To get help from Excel to insert a function, first click the cell in which you wish to insert the function. • Click the Insert Function button. This action will open the Insert Function dialog box. • If you do not see the Insert Function button, you may need to select the appropriate toolbar or add the button to an existing toolbar. Examine the Insert Function dialog box This dialog box appears when you click the Insert Function button. It can assist you in defining your function. Circular reference Situation when some parameter in the formula refers to the formula itself For example, in cell C5 the following formula is entered: VLOOKUP(C5, F2:G15, 2, TRUE) The address C5 refers to the formula itself. In this case it is a wrong way of writing the formula. In some cases circular references may be used for creating recursive (recurrent) functions. Financial Function descriptions This chart shows some commonly used financial functions and a description of what they do. Excel's financial functions • Financial functions are very useful to calculate information about loans. • Common functions are FV, IPMT, PMT, PPMT and PV. • All these financial functions will use similar arguments that differ based upon which function you are using. – Think of the arguments as members of an equation – The arguments represent the values of the equation that are known and the function provides the solution for a single variable, or unknown, value Use the financial functions • The FV function calculates the future value of an investment based on periodic, constant payments and a constant interest rate per period. • The IPMT function provides the interest payment portion of the overall periodic loan payment. • The PMT function calculates the entire periodic payment of the loan. • The PPMT function calculates just the principal payment portion of the overall periodic payment. • The PV function calculates the present value of an investment. Use the financial functions (cont’d) • NPER Determines the number of payments needed for an investment to grow or pay back a loan • RATE Determines the effective interest rate Use the Insert Function dialog box to enter function arguments This figure depicts how you would enter argument values for the PMT function using the Insert Function dialog box. Annuity - Dictionary Definition • An annual allowance or income; also, the right to receive such an allowance or the duty of paying it. (First definition in Britannica World Language edition of Funk & Wagnalls Standard Dictionary, 1966) • We allow the payments to be more frequent than yearly Loans and annuities • A typical loan is an annuity: Why? The borrower promises to pay a fixed amount every period. • When we retire we want to set up a pension. We give a bank some money. In return the bank promises to pay us a fixed payment every month for a given number of years. We can treat this as a loan: – We loaned the bank the money. – The bank promises to pay us back with a regular payment. Simple and Compound Interest • Simple interest: Interest is not paid on interest • Compound interest: Interest is paid on interest • Compounding per year: Number of times interest is paid or charged each year Example of savings account Initial amt Year 0 1 2 3 4 5 6 7 8 $2,000 Rate 10% Years 8 Simple interest Compound interest Interest Balance Interest Balance $2,000 $2,000 $200 $2,200 $200 $2,200 $200 $2,400 $220 $2,420 $200 $2,600 $242 $2,662 $200 $2,800 $266 $2,928 $200 $3,000 $293 $3,221 $200 $3,200 $322 $3,543 $200 $3,400 $354 $3,897 $200 $3,600 $390 $4,287 Example of loan You borrow $2000 at 12% annual interest compounded monthly. What is your payment if you pay off the loan in 6 months? Interest rate (APR) Years Principal Payments 12% per year 0.5 $2,000.00 $345.10 Example: Repayment Schedule Month 0 1 2 3 4 5 6 The repayment schedule Old balance Interest Payment New Balance $2,000.00 $2,000.00 $20.00 $345.10 $1,674.90 $1,674.90 $16.75 $345.10 $1,346.56 $1,346.56 $13.47 $345.10 $1,014.92 $1,014.92 $10.15 $345.10 $679.98 $679.98 $6.80 $345.10 $341.68 $341.68 $3.42 $345.10 $0.00 Standard arguments • rate: Interest rate (in decimal) per period • nper: Number of periods • pmt: Regular payment More standard arguments • pv: Present value: The amount the series of future payments is worth now. The beginning value. • fv: Future value: The amount the series of future payments will be worth in the future. The final value. • type 0 = payment at end of period (default) 1 = payment at beginning PMT( ) Payments • Returns the periodic payment for an annuity or loan • PMT(rate, nper, pv, fv, type) • The first 3 (red) arguments are required • Example : 12% interest compounded monthly, 3 years, borrow $6021.50 • Monthly payment = -PMT(.12/12, 3*12, 6021.50) =200.00 PMT( ) Example • Ms JustRetired has $200,000 to invest at 10% annual interest. Her goal is to have $100,000 left after 5 years. If she makes equal withdrawals each year for 5 years, how much can she withdraw each year? • PMT(rate, nper, pv, fv, type) = PMT(0.10, 5, -200000, +100000) = $36,380 PV( ) Present Value • Returns the present value of an investment. The present value is the total amount that a series of future payments is worth now. That is, it is the beginning value of the investment or loan. • PV(rate, nper, pmt, fv, type) PV( ) Example • A person promises to pay you $200 per month for 3 years. If you assume 12% interest compounded monthly, what is this annuity worth today? • How much can you borrow at 12% annual interest compounded monthly and repay in 3 years paying $200 per month? • = -PV(0.12/12, 3*12, 200) = 6021.50 FV( ) Future Value • Returns the future (final) value of an investment. The future value is the total amount including interest that series of payments will be worth. • How much money will there be in your account if you make regular payments for a period of time? • FV(rate, nper, pmt, pv, type) FV( ) Examples • You will make $200 a month payments into a 12% annual interest payable monthly account. How much will you have after 3 years? • = -FV(0.12/12, 3*12, 200) = 8615.38 • You will put $1000 in your account that pays 5% annually compounded monthly. You will add $100 to the account every month. How much will you have after 10 years? • = -FV(0.05/12, 10*12, 100, 1000) = 17175.24 NPER( ) Number payments needed for an investment • Returns the number of periods for an investment based on periodic, constant payments and a constant interest rate • NPER(rate, pmt, pv, fv, type) Example: • Each month you put $200 into bank account. Assuming a 12% annual interest rate payable monthly, how many years will you need to save before you have $8615.38 in the account? • = NPER( 0.01, 200, 0, -8615.38)/12 = 3 RATE( ) Effective interest rate • Returns the interest rate per period of an annuity • Gives the effective interest rate given the number of periods, the periodic payment, final value and initial value • RATE(nper, pmt, pv, fv, type) Example: • You bought $1,000 of shares in a mutual fund initially and then $100 more each month. After 10 years, your shares are worth $17,175.24. What was the effective interest rate? (Assume the interest is compounded monthly and paid at the end of the month.) • =RATE(12*10, 100, 1000, -17175.24, 0)*12 The Mortgage Worksheet Date Functions =Date coverts a date into a date number. Excel can represent any given date as a serial number equal to the number of days from Dec. 31, 1899 to the date in question. =DATE(year number, month number, day number) Enter the date into a cell (F5) with the =Date function. Then enter the Report date with the =Date function into another cell (L6). The difference between these dates (in number of days) can be calculated with the formula =L6-F5. Commonly used date functions Since dates are stored as integers, you can subtract one date from another to see how many days there are separating the two dates. The figure below provides additional details about the common date functions in Excel. The TODAY and NOW functions • The TODAY and NOW functions always display the current date and time. • You will not normally see the time portion unless you have formatted the cell to display it. • If you use the TODAY or NOW function in a cell, the date in the cell is updated to reflect the current date and time of your computer each time you open the workbook. Custom functions • Some functions can be implemented in Visual Basic. Gaining Proficiency: Formatting © Oleg Vlasov, KIMEP, Fall 2002 Excel Worksheet Modifying the Worksheet • Insert command Modifying the Worksheet • Delete command Modifying the Worksheet • Page Setup command and dialog box Excel Formatting • • • • • • Column widths Row Heights Numeric Format Alignment Fonts Borders, Patterns, and Shading Types of Numeric Formats General Number Currency Accounting Date Time Percentage Fraction Scientific Text Special Custom Comments • Right click on the cell & select Insert comment. • You may edit or delete the comment by right clicking on the cell & selecting your choice. Y Y Y N 790,343 1,934,349 2,103,049 1,785,323 695,034 1,793,090 Tanya Goette: 2,001,304 This store looks 1,593,032 really great! 263,448 483,587 420,610 357,065 Format Cells Command