Professional Documents
Culture Documents
Microsoft Excel
Page 1
2. 3.
4.
5.
6. 7.
If you do not know the above you should get the Form 6 Manual and revise this work.
Page 2
sum rows
use copy/paste special to copy the format of this table to create the table below. sum columns
wrap the text within this cell enter formulae to calculate the coin value for each item in the table above
sum columns
add rows
Page 3
AND Function
To have a true result all expressions must equate to TRUE. Below is a simple example to check whether the car will start or not. To keep it simple we are only considering two factors, petrol and the state of the battery.
The function used in column C is: =AND(A2=yes,B2=OK) For the result to be true A2 must be Yes and B2 must be OK, any of the other three possible combinations will give a FALSE result. Enter the data into columns A and B and the AND function into Cell C2. Fill this down and convince yourself that ANDs really do work. Here is an example of how the AND function can be applied to numeric data. This AND function checks to see if both tests are greater than or equal to the pass mark, which is in this case is 50. The function used is: =AND(A3>=B$1,B3>=B$1) Enter the data below and check that you are able to get the same result.
OR Function
To have a true result the expression must equate to TRUE. Opposite is a simple example to decide whether you will buy a new car. To keep it simple we are only considering two factors, Sold Old Car or Have a Bank Loan. The function used is: =OR(A2=Yes,B2=Yes) Enter the data below and check that you are able to get the same result. Here is an example of how the OR function can be applied to numeric data. This OR function checks to see if either one or other of the marks is greater than or equal to the pass mark, which is in this case is 50. The function used is: =OR(A3>=B$1,B3>=B$1)
Page 4
Enter the data below and check that you are able to get the same result.
Take the previous AND example and add to it the IF function. This is how the function will look: =IF(AND(A3>=B$1,B3>=B$1),"Pass","Resit") Enter the function and check your answer with the one shown below.
Take the previous OR example and add to it the IF function. This is how the function will look: =IF(OR(A3>=B$1,B3>=B$1),"Pass","Resit") Enter the function and check your answer with the one shown opposite.
Page 5
You are to: a) Enter the data into the cells in columns A to E b) Enter IF/AND function into cell F4 c) Enter IF/OR function into cell G4 d) Enter the IF/OR/AND function into cell H4 e) Fill the formulae down. f) Check to see if your results are the same as those shown opposite. The Comfortable Coach Company runs buses from Christchurch to Invercargill. They give a 20% concession to: Children under 12 Adults over 64 Disabled people
You are to: 1. enter a formula into cell D11 to calculate the fare to Ashburton. 2. This formula must have the correct combination of relative and absolute cell addresses to fill across and down without having to alter the formula. It must also refer to cells B4, B5 that are the conditions for fare reduction and E3 as this refers to the percentage fare reduction allowed.
Page 6
The names of those tested are shown above. Type in the data above and enter a formula into Cell E4 to indicate, based on these tests, whether the applicants would be suitable or not. Fill the formula down the column and check your answers with those in column E opposite.
Page 7
Simple single IF
Below is a table the lists a choice of computer components to make up a basic personal computer. The purpose of the spreadsheet is to allow you to choose the components you wish to incorporate into your system and return the final purchase price of the complete system. By entering a "Y" into each category the price for the chosen component is returned in column D
Instructions:
1. 2. 3. 4. 5. 6. 7. 8. Enter the headings and data into the spreadsheet. Centre the heading, "Colin's Custom Computer Company" across columns A to E. Enter the appropriate IF formula into cell E3. Fill this formula down to E28 Sum column E, in cell E30. Calculate GST (12.5%) on the total in E30. Add total exclusive GST to the GST payable to give the final purchase price in E32. To check your work choose the same items shown in the example opposite to see if your results are the same. 9. You should also check your work by doing the same calculation another way. Eg using a calculator.
Page 8
So far we have dealt with simple Ifs that return two possible values based on a Boolean test. Assume you wish to convert a test mark into a simple Pass/Fail result. The Diagram opposite shows how a single If statement returns "Pass" if a mark entered is greater or equal to fifty and "Fail" for any mark lower than fifty. =IF(A3>=50,"Pass","Fail")
> Y e s
5 0 N o " F a il"
Nested If's
" P
a s s "
These are simply single If's strung together to give multiple binary decisions. Suppose you wish convert test marks into grades A to E where:
> Y " A " Y " B " Y " C " Y " D " Y " E " e s = N > e s 8 5 o = N > 6 5 o = 5 0 N o > e s = N > e s 4 0 o = 0 N o " N
Greater than or equal to 85 Greater than or equal to 65 Greater than or equal to 50 Greater than or equal to 40 Greater than or equal to 0 Otherwise The structure diagram opposite shows graphically how a number of simple binary decisions are used to separate a grade out into the categories A, B, C, D, E shown in the table above. Unfortunately spreadsheet If's, when nested become rather long and clumsy. Simply, the ELSE part of the IF becomes the start of another IF Statement. At the finish make sure there are an equal number of closing brackets to opening brackets The words o t V a lid " Yes and No can be substituted for True and False
A B C D E Not Valid
e s
In the example the branch "Not Valid" only applies to numbers less than zero. 1. Open a new work sheet and type in the data headings and marks shown opposite. 2. Enter the formula below into cell B3 3. Fill the down. formula
Page 9
=IF(A3>=85,"A",IF(A3>=65,"B",IF(A3>=50,"C",IF(A3>=40,"D",IF(A3>=0,"E","Not Valid"))))))))
Page 10
IS functions
Is functions are used for testing the type of a value or reference. Is functions check the type of value and return TRUE or FALSE depending on the outcome. For example, the ISBLANK function returns the logical value TRUE if value is a reference to an empty cell; otherwise it returns FALSE. The following nine functions are available: Value is the value you want tested. Value can be a blank (empty cell), error, logical, text, number, or reference value, or a name referring to any of these, that you want to test
Value refers to an empty cell. Value refers to any error value except #N/A. Value refers to any error value (#N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!). Value refers to a logical value. Value refers to the #N/A (value not available) error value. Value refers to any item that is not text. (Note that this function returns TRUE if value refers to a blank cell.) Value refers to a number. Value refers to a reference. Value refers to text.
Validating Number
These functions are useful for validating data you enter into a spreadsheet. A common error would be to type the letter O instead of zero when entering a number.
Enter the example below and type an O rather than a zero.
=IF(ISTEXT(A2),"Enter a number",A2)
Adding Validation to the Grades Exercise The data entry errors that could be made are: not entering a number at all entering text instead of a number entering a negative number entering a number greater than 100 entering a number less than zero Change the formula in Grades problem to that shown below.
=IF(ISBLANK(A3),"Enter value",IF(OR(ISTEXT(A3),A3>100,A3<0),"Not Valid",IF(A3>=85,"A", IF(A3>=65,"B",IF(A3>=50,"C",IF(A3>=40,"D",IF(A3>=0,"E")))))))
Validation Exercise
In the example to the right below the iserror function is used to avoid the #DIV/0! Before data has been entered into a spreadsheet template. 1. Enter the data into the spreadsheet as shown below and then enter the appropriate formula to calculate BMI which is Weight(kg)/Height(m)2 2. Use and IF(IsError( formulae to avoid the #DIV/0! in column D
Page 11
FV (Future Value)
Future Value calculates the value of an investment after a given period of time. It assumes that payments and interest rates do not alter. The syntax is: FV(Rate, Nper, PMT, PV, Type)
Rate
This is the interest paid. Most interest is on a yearly basis, however payments may be made monthly. In this case the interest must be divided by 12. Eg. If the interest rate is 8% yearly then the monthly interest = 8%/12
Nper
This is the number of periods the payment is spread over. If payment is made monthly and the investment is over 5 years then the number of periods will = 5 x 12
Pmt
This is the payment made that includes principal and interest. Any money paid out has a negative value. Assume the payment is $200 dollars then pmt will be 200
Pv
This is the present value. This could be the value of an initial deposit. Eg $2000. If PV is not entered its default is zero. This is money paid in therefore it too is a negative value of -2000
Type
This has values 1 and 0. 0 indicates the end of the pay period, whilst 1 indicates the beginning of pay the period. Zero is the more usual and is the default value if nothing is entered.
Example
Fred wants to save up to buy another car so he invests $2000.00 dollars at 8% interest rate for two years. He is going to pay in $200 each month. =FV(8%/12, 2*12, -200, -2000,0) Result is $7,532.41
Page 12
Rate
Is the interest rate per period. Eg. month.
Pmt
Is the payment made each period; it cannot change. Typically, pmt contains principal and interest.
Pv
Is the present value, or the lump-sum amount that a series of future payments is worth now.
Fv
Is the future value, or a cash balance you want to have after the last payment is made. If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0).
Type
Is the number 0 or 1 and indicates when payments are due. 0 = end of period, 1= beginning of the period. Example: Jayne has taken out a reducing loan for $6,000 and the interest rate is 7%. How long is it until she has nothing to pay if she pays $80 each month. =NPER(7%/12, -80,6000) Result is 98.92126 months or =NPER(7%/12, -80,6000)/12 Result is 8.243438 years Note: The last two parameters are not required as both their default values are 0. When the loan is paid off and at the end of the period.
Rate
Is the interest rate per period.
Per
Is the period you have chosen to find the interest and must be in the range 1 to nper.
Nper
Is the total number of payment periods in an annuity.
Page 13
Pv
Is the present value, or the lump-sum amount that a series of future payments is worth right now. Fv Is the future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0). Type Is the number 0 or 1 and indicates when payments are due. If type is omitted, it is assumed to be 0. Example The following formula calculates the interest due in the first month of a three-year $8000 loan at 10 percent annual interest: IPMT(0.1/12, 1, 36, 8000) equals -$66.67
PMT
Syntax =IPMT(rate,nper,pv,fv,type) Is the payment that is made each period to pay off a loan. Payment will consist of interest and capital repayments. Rate This is the interest rate paid each period. This is usually given for a year, therefore if payments are monthly then the interest will be divided by 12. Eg. 8% for a year would be 8%/12 for each month. Nper The number of periods you have to pay. (For example, if you get a four-year car loan and make monthly payments, your loan has 4x12 (or 48) periods. You would enter 48 into the formula for Nper. Pv Is the present value or amount of the loan. The amount of money borrowed. Fv The future value of the loan (this will be 0 if you intend to pay the loan off), Type Type of payment to be made (this is 0 if your payments begin at the end of the month you get the loan; 1 if the payments begin immediately when you get the loan -- 0 is the most common option here). Example: You take out a loan for $120,000 to buy a house. The interest rate is to be 9% and the loan is to be paid off in 25 years. How much do you need to pay each month.
=PMT(9%/12,25*12,120000) Result is -$1,007.04 per month.
Page 14
Below is a table of repayments for a loan using the two formulae. PMT and IPMT. PMT calculates the total payment for each period IPMT calculates the interest portion of each payments Principal repayment is calculated by subtracting the IPMT value from the PMT value.
Page 15
Lookup Function
Using Excel you can look up a table containing the information you want and return a value in the same position in another table. For example: George needs to know how many days there are in each month so he can calculate his income as he works out his spreadsheet. To achieve this he has made two columns containing the months of the year, and how many days in the month. Do the following: 1. In cell A1 type in Jan and drag down until you have the first six months. 2. In cell B1 type in the number of days for each month. 3. Now for this function to operate you must sort the months alphabetically so click on cell A1 and click the Sort button (The first column must always be sorted). Note that the second column also changes to stay the same as the first once they are sorted. 4. Below the Monthly table, create the spreadsheet shown
5. In B11 we are going to place the Look Up formula that will read the month from B10 (Jan), then look up the table (A1:A6) and display the days from (B1:B6). 6. Click in B11 and find the Look Up Function using the Function 7. Type in the values shown in the three windows. We are going to look up B10, read the month in that cell, then find the month in the range A1:A6. 8. The number of days will be found in the range B1:B6. 9. Click OK if the Formula result = 31, otherwise check your input and correct. 10. If you drag the formula from B11 to G11 the values will change as the cell references are Relative. You must make them all Absolute except for B10 . How will you do that? 11. Create the Daily Income fields as well and save as Look-Up exercise. Button.
Page 16
10. Save you work book under the name B Rental Cars.
Page 17
To display
Use this for mat cod e m mm mmm mmmm mmmmm d dd ddd dddd yy yyyy
To display
Use this format code h hh m mm s ss h AM/PM h:mm am/pm h:mm:ss a/p [h]:mm [mm]:ss [ss] h:mm:ss.00
Months as 1-12 Months as 01-12 Months as Jan-Dec Months as January-December Months as the first letter of the month Days as 1-31 Days as 01-31 Days as Sun-Sat Days as Sunday-Saturday Years as 00-99 Years as 1900-9999
Hours as 0-23 Hours as 00-23 Minutes as 0-59 Minutes as 00-59 Seconds as 0-59 Seconds as 00-59 Hours as 4 AM Time as 4:36 pm Time as 4:36:03 p Elapsed time in hours; for example, 25.02 Elapsed time in minutes; for example, 63:46 Elapsed time in seconds Fractions of a second
Page 18
If the format contains an AM or PM, the hour is based on the 12-hour clock, where "AM," "am," "A," or "a" indicates times from midnight until noon, and "PM," "pm," "P," or "p" indicates times from noon until midnight. Otherwise, the hour is based on the 24-hour clock. The "m" or "mm" must appear immediately after the "h" or "hh" format code or immediately before the "ss" code, or Microsoft Excel displays the month instead of the minutes. With date and time functions, you can analyse and work with date and time values in formulas. For example, if you need to use the current date in a formula, use the TODAY worksheet function, which returns the current date based on your computer's system clock.
Date Datevalue Day Days360 Edate Eomonth Hour Minute Month Networkdays Now Second Time Timevalue Today Weekday Workday Year Yearfrac Returns the serial number of a particular date Converts a date in the form of text to a serial number Converts a serial number to a day of the month Calculates the number of days between two dates based on a 360-day year Returns the serial number of the date that is the indicated number of months before or after the start date Returns the serial number of the last day of the month before or after a specified number of months Converts a serial number to an hour Converts a serial number to a minute Converts a serial number to a month Returns the number of whole workdays between two dates Returns the serial number of the current date and time Converts a serial number to a second Returns the serial number of a particular time Converts a time in the form of text to a serial number Returns the serial number of today's date Converts a serial number to a day of the week Returns the serial number of the date before or after a specified number of workdays Converts a serial number to a year Returns the year fraction representing the number of whole days between start_date and end_date
Page 19
E2
Page 20
Extra Exercises
Run the macro again to move the data to column E, and then create a second macro, called Return to return the column back to the original position. Using the Add operation under Paste Special, create a macro that adds the numbers in column C to a new column in F. Each time you run this macro the numbers in F will increase by the numbers in E.
Page 21
Once created the button can be edited to meet your needs. Use Change Button Image to select another picture, or more creatively use Edit Button Image to edit the picture on the button (Note that the Customise dialogue box must be open for you to get the menu shown opposite. These features are available for any button whenever the Customise window is open.
Page 22