103
1 Index Topic Page Number In syllabus, we have… 2007 Command List REFERENCE 1: Spreadsheet Functions CHAPTER 1: Concept and Terminology CHAPTER 2: Understanding Spreadsheet CHAPTER 3: More Exercise on “if” CHAPTER 4: Advance Techniques (In depth discussion) Exercise 1: Formula Operation I Exercise 2: Formula Operation II Exercise 3: Overall Revision Chapter 5: Macro - Basic Operation in Programming Quiz on Spreadsheet #1 Quiz on Spreadsheet #2 Quiz on Spreadsheet #3 Quiz on Spreadsheet #4 Quiz on Spreadsheet #5 Sample TAS Question on Spreadsheet 1 Sample TAS Question on Spreadsheet 2 Past Papers & Conventional Questions Keywords

Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

1

Index Topic Page Number In syllabus, we have…

2007 Command List

REFERENCE 1: Spreadsheet Functions

CHAPTER 1: Concept and Terminology

CHAPTER 2: Understanding Spreadsheet

CHAPTER 3: More Exercise on “if”

CHAPTER 4: Advance Techniques (In depth discussion)

Exercise 1: Formula Operation I

Exercise 2: Formula Operation II

Exercise 3: Overall Revision

Chapter 5: Macro - Basic Operation in Programming

Quiz on Spreadsheet #1

Quiz on Spreadsheet #2

Quiz on Spreadsheet #3

Quiz on Spreadsheet #4

Quiz on Spreadsheet #5

Sample TAS Question on Spreadsheet 1

Sample TAS Question on Spreadsheet 2

Past Papers & Conventional Questions

Keywords

Page 2: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

2

In syllabus, we have… The basic structure of a spreadsheet

• Students should have a clear understanding of the basic features of spreadsheets such as rows, columns, cell addresses and cell references, values, labels, formulas and charts, etc., and be able to apply them effectively in data analysis and data manipulation. They should demonstrate the abilities to format or edit a worksheet efficiently.

Data manipulation • Students should be able to use formulas, standard functions [1] and nested functions, together with mathematical, logical and relational operators (AND, OR, NOT), to solve problems.

• Students should be able to arrange data in order (sorting, multi-key sorting, etc), filter data using single or multiple criteria, link and manipulate data dynamically in multiple worksheets.

What-if analysis • Students should understand the use of spreadsheet in what-if analysis and appreciate how it is used to simulate some real world situations. They should be able to analyse and identify changes and trends so as to make informed judgment, decision and prediction when some values on the simulation are changed.

Pivot tables • Students should be able to create, edit and format a pivot table and a pivot chart efficiently using defined field names and appreciate the use of a pivot table as a powerful and interactive tool for data analysis.

• Students should be able to use functions such as sum, sub-total and average, etc., and know how to group and manipulate data within pivot tables for problem solving

• By varying different fields, students should be able to observe and analyse the inter-dependency of data so as to enhance their decision making and to produce meaningful predictions.

2007 Command List

Type Commands/constants/functions

Constants TRUE, FALSE

Operators +, −, *, /, <, >, =, <>, <=, >=

Functions AND, OR, NOT, IF

AVG, MAX, MIN, LARGE, SMALL, SUM, SUMIF, COUNT, COUNTIF,

RANK, FREQUENCY

DATE, NOW

CHAR, LEFT, LEN, LOWER, MID, RIGHT, UPPER, VALUE,

CONCATENATE

INT, MOD, ROUND, ROUNDUP, ROUNDDOWN, SQRT

CHOOSE, HLOOKUP, VLOOKUP, LOOKUP

ABS, INT, , QUOTIENT, RAND, , , , , ,

Page 3: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

3

CHAR, CODE, CONCATENATE, , , , , , , , , TEXT, TRIM, ,

, , COUNTA, COUNTBLANK, , , , , , , , , ,

,

FIND, , , , SEARCH

IF

REFERENCE 1: Spreadsheet Functions Math & Trigonometry Functions ABS (realnum) Returns the absolute value of a number.

e.g. ABS(2) equals 2

ABS(-2) equals 2 If A1 contains –16, then SQRT(ABS(A1)) equals 4

INT (realnum) Rounds a number down to the nearest integer.

e.g. INT(8.9) equals 8

INT(-8.9) equals –9

MOD (num, divisor) Returns the reminder from division.

e.g. MOD(3, 2) equals 1

MOD(-3, 2) equals 1

MOD(3, -2) equals –1

MOD(-3, -2) equals –1 Note: MOD(n, d) = n - d*INT(n/d)

QUOTIENT (numerator, denominator )

Returns the integer portion of a division. e.g. QUOTIENT(5,2) equals 2

QUOTIENT(4.5, 3.1) equals 1 QUOTIENT(-10,3) equals –3

RAND ( ) Returns a random number between 0 and 1.

Note:RAND()*(b-a)+a returns a number between a & b.

ROUND (num, digit) Returns a number to a specified number of digits.

e.g. ROUND(2.15, 1) equals 2.2

ROUND(2.149, 1) equals 2.1

ROUND(-1.475, 2) equals –1.48

ROUND(21.5, -1) equals 20

SQRT (num) Returns a positive square root.

e.g. SQRT(16) equals 4

SQRT(-16) equals #NUM!

SQRT(ABS(-16)) equals 4

Page 4: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

4

SUM (num1, num2, …) Adds its arguments.

e.g. 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

TRUNC(num, digit) Truncates a number to an integer by removing the fractional part of a

number. e.g. TRUNC(8.9) equals 8

TRUNC(-8.9) equals –8

Statistical Functions AVERAGE (num1, num2 , … ) Returns the average of its arguments.

e.g. 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

AVERAGE(A1:A5, 5) equals 10

COUNT (val1, val2, … ) Counts the number of cells with numeric/date value stored.

e.g.

COUNT(A1:A7) equals 3

COUNT(A4:A7) equals 2 COUNT(A1:A7, 2) equals 4

COUNTA (val1, val2, …) Counts the number of cells that are not empty. e.g. COUNTA(A1:A7) equals 5

COUNTA(A4:A7) equals 3

COUNTBLANK (range) Counts empty cells in a specified range of cells e.g. COUNTBLANK(A1:A7) equals 2

COUNTIF (range, criteria) Counts the number of cells within a range that meet the given criteria.

e.g. 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

LARGE (array, k) Returns the k-th largest value in a data set.

e.g. LARGE((3,4,5,2,3,4,5,6,4,7),3) equals 5

MAX (num1, num2, …) Returns the maximum value in a list of arguments

MIN (num1, num2, …) Returns the minimum value in a list of arguments

Page 5: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

5

RANK (num, ref, order) Returns the rank of a number. e.g. If A1:A5 contains 7, 3.5, 3.5, 1 and 2, then RANK(A2, A1:A5, 1) equals 3 RANK(A1, A1:A5, 1) equals 5 RANK(A1, A1:A5, 0) equals 1 Note: order = 0 or omitted means descending order order <> 0 means ascending order

SMALL (array, k) Returns the k-th smallest value in a data set. e.g. SMALL((3,4,5,2,3,4,5,6,4,7),4) equals 4

SUMIF (range, criteria, sumrange) Sums the numbers within a range that meet the given criteria. e.g. If A1:A4 stores 10, 20, 30, 40 and B1:B4 stores 70, 14, 21, 28, then

SUMIF(A1:A4,">16",B1:B4) equals 63

SUMPRODUCT (array1, array2, … )

Multiplies corresponding components in the given arrays and returns the sum of the product. e.g. SUMPRODUCT(A1:B3, D1:E3) = 156

(i.e. 3*2 + 4*7 + 8*6 + 6*7 + 1*5 + 9*3)

SUMSQ (num1, num2, … ) Returns the sum of the squares of the arguments. e.g. SUMSQ(3, 4) equals 25 (i.e. 3^2 + 4^2)

Text Functions CHAR (num) Returns the character specified by the code number.

e.g. CHAR(65) equals "A"

CHAR(33) equals "!"

CONCATENATE (text1, text2, …) Join several text strings into one text string.

e.g. CONCATENATE("Total ", "Value") = "Total Value" (Same as =“Total” & “ ” & “Value” )

EXACT (text1, text2) Check to see if two text are identical.

e.g. EXACT("word","word") equals TRUE

EXACT("Word","word") equals FALSE

EXACT("w ord","word") equals FALSE

FIND (clause, findform startno) Finds one text value with another. (case-sensitive).

e.g. FIND("M","Miriam McGovern") equals 1

FIND("m","Miriam McGovern") equals 6

FIND("M","Miriam McGovern",3) equals 8

If A2 stores “Ceramic Insulators #124-TD45-87", then

MID(A2,1,FIND(" #",A2,1)-1) returns "Ceramic Insulators"

ISBLANK (value) Check whether the content in a cell is blank or not.

e.g. ISBLANK(A1) equals TRUE if A1 is empty

LEFT (text, numchar) Returns the leftmost character or characters in a text string.

e.g LEFT("Sale Price", 4) equals "Sale"

If A1 contains "Sweden", then: LEFT(A1) equals "S"

LEN (text) Returns the number of characters in a text string.

e.g. LEN("Phoenix, AZ") equals 11 LEN("") equals 0

Page 6: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

6

LOWER (text) Converts all uppercase letters in a text string to lowercase.

e.g. LOWER("E. E. Cummings") equals "e. e. cummings" LOWER("Apt. 2B") equals "apt. 2b"

MID (text, start, numchar) Returns a specific number of characters from a text string, starting at the

position you specify.

e.g. MID("Fluid Flow", 1, 5) equals "Fluid"

MID("Fluid Flow", 7, 20) equals "Flow" MID("1234", 5, 5) equals "" (empty text)

PROPER (text) Capitalizes the first letter in a text string and any other letters in text that

follow any character other than a letter.

e.g. PROPER("this is a TITLE") equals "This Is A Title"

PROPER("2-cent's worth") equals "2-Cent'S Worth"

PROPER("76BudGet") equals "76Budget"

RIGHT (text, numchar) Returns the rightmost character or characters in a text string.

e.g. RIGHT("Sale Price", 5) equals "Price" RIGHT("Stock Number") equals "r"

SEARCH (Ftext, Wtext, startno) Returns the number of the character at which a specific character or text string is first found, reading from the left to the right. (case-insensitive) e.g. SEARCH(“e”, “statements”, 1) equals 5 SEARCH(“e”, “statements”, 6) equals 7

TRIM (text) Removes all spaces except for single spaces between words. e.g. TRIM(" First Quarter Earnings ") equals

"First Quarter Earnings"

UPPER (text) Converts text to uppercase.

e.g. UPPER("total") equals "TOTAL"

If E5 contains "yield", then UPPER(E5) equals "YIELD"

VALUE (text) Converts a text string that represents a number to a number.

e.g. VALUE("$1,000") equals 1,000

VALUE("16:48:00")-VALUE("12:00:00") equals "16:48:00"-"12:00:00"

equals 0.2, the serial number equivalent to 4 hours and 48 minutes. Note: You do not generally need to use the VALUE function in a formula

because Microsoft Excel automatically converts text to numbers as necessary.

Lookup & Reference Functions HLOOKUP (LKVal, Array, RowIdxNo) Refers to supplementary notes VLOOKUP (LKVal, Array, ColIdxNo) Refers to supplementary notes LOOKUP (LKVal, Array ) or LOOKUP (LKVal, LKVector, RTVector)

Refers to supplementary notes

Date & Time Functions NOW ( ) Returns the serial number of the current date and time.

e.g. If you are using the 1900 date system and your computer's built-in clock is

set to 12:30:00 P.M., 1-Jan-1987, then:

NOW() equals 31778.52083

Ten minutes later:

NOW() equals 31778.52778

Note: Microsoft Excel for Windows uses the 1900 date system, in

which serial numbers correspond to the dates January 1, 1900, through

December 31, 9999.

DATE (year, month, day) Returns the serial number of a particular date.

Page 7: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

7

Note: Year is a number from 1900 to 9999

Logical Functions IF (Condition, Tvalue, Fvalue) Specifies a logical test to perform.

e.g. IF(A10=100,SUM(B5:B15),"")

IF(B2>C2,"Over Budget","OK")

IF(AverageScore>69,"C",IF(AverageScore>59,"D","F"))))

TRUE ( ) Return the logical value of TRUE.

FALSE ( ) Return the logical value of FALSE.

Page 8: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

8

CHAPTER 1: Concept and Terminology

Spreadsheet basics

Electronic spreadsheets allow you to create worksheets like paper ledges. Automatic calculations, immediate updating, charting and data analysis tools are available in a spreadsheet program. An electronic spreadsheet file is a workbook. A workbook is a collection of worksheets. The worksheet is a grid of columns and rows. A cell is an intersection of a column and a row. Each cell has a label (cell address). You may enter text, numbers, mathematical formulas etc. in a cell.

Screen Layout

Adding and Renaming Worksheets

You may access other worksheet by just clicking on the worksheet tags next to the navigation bar.

Insert a worksheet Insert����Worksheet

Rename a worksheet: Click on the worksheet tag and enter the new name

The Standard Toolbar

The standard toolbar is similar to the one in Word. Only a few new items are added:

AutoSum Paste Function Sort Ascending

Sort Descending Chart Wizard

These items will be discussed in more details later.

Menu Bar

Formula Box

Cell Address

Active Cell

Formatting Toolbar Standard

Toolbar

Current Worksheet

Worksheet Navigation Bar

Cell E7

Row 7

Column E

Page 9: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

9

Spreadsheet Terminology Worksheet A worksheet is an electronic paper, which consists of rows and columns of cells. Worksheet is the

place where you enter your data and perform your calculations. There are basically 2 different types: data worksheet and macro worksheet.

Workbook A workbook is a collection of worksheets. Each worksheet is a "page" in the workbook.

An excel workbook Name Besides address, a cell can also have a name. The purpose of creating name for a cell is to

improve the readability of formulas or functions. Range One or more contiguous cells. For example, a range could be an entire row or column, or multiple

rows or columns. Once you have defined a range, you can perform operations on it. This is a powerful feature because it allows you to manipulate a set of cells with one expression.

Formula In spreadsheet applications, a formula is an expression that defines how one cell relates to other

cells. For example, you might define cell C5 (column C, row 5) with the formula =A4*D7 which means to multiply the value in cell A4 by the value in cell D7.

Functions A named section of a program that performs a specific task. In this sense, a function is a type of

procedure or routine. (Some programming languages make a distinction between a function, which returns a value, and a procedure, which performs some operation but does not return a value.) Excel comes with a prewritten set of functions that are kept in a library. You can also write your own functions to perform specialized tasks. The following table shows you some examples of built-in functions:

Function Usage SUM() Calculates the sum of a set of numbers TODAY() Returns today's date PMT() Calculates the periodic payment for an investment

Chart A chart is a graphical representation of data Macro The word "Macro" comes from Greek. It means large. In computer applications, macro is usually

used to mean a group of commands that are executed together.

The above information was extracted from PC Webopedia (http://www.webopedia.com) & ASCA Computer Graphics and Electronic Spreadsheet, 1st Ed, Golden Publications

Here are some techniques that would be shown in the lessons: Within cells 1. Change fonts (color, size, type face),

2. Change text direction 3. Change border, 4. Entering special symbols, 5. Toggle value display to formula display, 6. Change number presentation format (decimal, date, etc), 7. Copy, paste, paste special (value), 8. Multiple conditional formatting 9. Auto fill 10. Forming simple formula

Within a Worksheet 1. Sorting data 2. Filtering data 3. Freeze panes,

Page 10: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

10

4. Adjust column width, 5. Adjust Row height, 6. Merge cells,

Within a Workbook 1. Insert a new worksheet, 2. Rename a worksheet, 3. Delete a worksheet, 4. Move a worksheet, 5. Protect a worksheet, 6. Protect a workbook with a password, 7. Reference to cells in another worksheet 8. Name a range

View option Print option 1. Set print percentage

2. Print preview 3. Margin setting (header, footer) 4. Page orientation

Emphasis on this chapter: 1. Freeze panes:

If your worksheet is too large so that all contents cannot be shown on the screen and you want to refer to the headings while browsing the data, you can use the Freeze Panes feature.

2. Page setup

Print the worksheet on one page

Scale the worksheet

Page 11: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

11

Format Text:Clicking on this button after highlighting the text to change the font, size, and style.

Page Number:Inserting the page number of each page.

Total Number of Pages:Using this feature along with the page number to create strings such as "page 1 of 15".

Date:Adding the current date.

Time:Adding the current time.

File Name:Adding the name of the workbook file.

Tab Name:Adding the name of the worksheet's tab

Page 12: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

12

<End of Chapter 1> Understand Relative Address and Absolute address When copying a cell to another cell, the formula will be copied at the same time. However, the contents may or may not be changed. E.g. Finish the following formulas if it is copied by the cell of which the formula is “=C2” =C2 =C$2

Print gridlines dividing the cells

Choose a title column that will be printed on the left of each page

Choose a title row that will be printed at the top of each page

Select to print selection of cells highlighted on the worksheet, the active worksheet, or all the worksheets in the entire workbook

(i)

(ii)

Page 13: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

13

=$C2 =$C$2 Understanding the use of IF

It is used to determine an IF-THEN-ELSE situation. E.g. If a teacher wants to adjust the marks of students if the mark is equal or over 50, it will increase by 5%, if the mark is less than 50, it will give 50 marks. The formula would be like this: =IF(A1<50, 50, A1*(1+5%)) OR =IF(A1>=50, A1*(1+5%), 50)

Understanding the use of logical operator

In spreadsheet, sometimes, we will handle value like “TRUE” and “FALSE”. e.g. 1. 6 > 2 returns TRUE 2. -5 < -3 returns FALSE There are 3 logical operators, they are AND, OR, NOT. e.g. if A1=13, B1=20 (i) NOT(3>9) returns TRUE (ii) AND(A1>12, B1>12) returns TRUE (iii) OR(A1>B1, NOT(B1>13)) returns FALSE (iv) IF(AND(A1>10, OR(A1>20,B1<A1)), “YES”,”NO”) returns “NO”

(iii)

(iv)

Page 14: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

14

Supplementary 1: Understanding Menus and Toolbars

Menus and toolbars

Menus

You may personalize menus and toolbars to meet your personal needs.

View����Toolbars����Customize ����Options Tab.

Toolbars

Toolbars can be customized so that some frequently-used commands are shown while rarely-used commands are

hidden.

View����Toolbars����Customize ����Commands tab����Just drag the desired commands to any location on the standard or

formatting toolbars

To remove the command, drag it away from its location on the standard or formatting toolbars.

Page 15: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

15

CHAPTER 2: Understanding Spreadsheet What is spreadsheet?

A workbook consists of several worksheets, we call them spreadsheets. Spreadsheet is designed to solve some What-if situations. A spreadsheet is composed of a number of cells. Each cell will automatically recalculate all the formula if any cell is updated. Also, it provides a lot of built-in functions to do some complicated calculations. Also, it provides chart tools like chart wizards to create charts easily.

What is a What-if problem? A what-if problem involves some criteria and several variables. To adjust some variables, you can solve the problem. Here is a typical example: Criteria:

1. To save a total of $100,000 in 5 years. 2. The principle would be $15,000 a year.

Variables: 1. The time (in year) 2. The interest rate

The way to apply spreadsheet to solve this What-if problem: First, we assign the interest rate to 5%, then, we have A B C D E F

1 Time(year) Principal Interest Amount Interest rate

2 1 $ 15,000.0 $ 750.0 $ 15,750.0 5%

3 2 $ 30,750.0 $ 1,537.5 $ 32,287.5

4 3 $ 47,287.5 $ 2,364.4 $ 49,651.9

5 4 $ 64,651.9 $ 3,232.6 $ 67,884.5

6 5 $ 82,884.5 $ 4,144.2 $ 87,028.7 Obviously, 5% interest rate does not work, we try 10%, and the spreadsheet will recalculate all formula in the spreadsheet. A B C D E F

1 Time(year) Principal Interest Amount Interest rate

2 1 $ 15,000.0 $ 1,500.0 $ 16,500.0 10%

3 2 $ 31,500.0 $ 3,150.0 $ 34,650.0

4 3 $ 49,650.0 $ 4,965.0 $ 54,615.0

5 4 $ 69,615.0 $ 6,961.5 $ 76,576.5

6 5 $ 91,576.5 $ 9,157.7 $ 100,734.2 Now, we find that 10% is more suitable.

What type of data is stored?

There are three type of data that are stored in spreadsheet, they are label(text), value and formula. value: It can be integer or decimal number Label: It is text Formula: Usually, it involves some built-in functions. The following figure clearly shows that A1 to A6 (A1:A6) is The following figure clearly shows that B1 to B5 (B1:B5) is The following figure clearly shows that B6 is A B

1 Student1 56

2 Student2 82

3 Student3 91

4 Student4 44

A B

1 Student1 56

2 Student2 82

3 Student3 91

4 Student4 44

Page 16: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

16

5 Student5 33

6 Average 61.2

5 Student5 33

6 Average =AVERAGE(C2:C6)

The data presentation Although, 3 type of data(label, value, formula) are stored, there are different form of presentation. Enter the following data into a spreadsheet: A B

1 Name Mary Lui

2 Sex F

3 date of birth 30000

4 Weight 53.564

5 Payment 10000

A B

1 Name Mary Lui

2 Sex F

3 date of birth 18-Feb-82

4 Weight 53.6

5 Payment $ 10,000.00 Figure A Figure B

Note that although cells B3, B4 and B5 seems to be changed, the data in Figure A and Figure B has in fact no change, it is because the presentation format changed.

Format the cells You are supposed to have ability to format the cells and spreadsheet as the following figure does. A B C D E F

1 1st quarter 2nd quarter 3rd quarter 4th quarter

2 Mary

3 Johnny

4 Daisy

5 Dudy

6

Sale

s A

gen

t

Andy

*The following are some simple techniques that is demonstrated in the lessons: Forming Simple formula Open the worksheet simple_formula, there you will find the following: A B C D E F G

1 Class Name Test1 Test2 Test3 Exam Final

2 S2A AU SIU CHUNG 28 38 42 52

3 S2E AU YIN CHUNG 36 55 42 77

4 S1D AU YUK HING ABS 42 38 24

5 S4C CHAN CHAK LAM 78 68 90 93

6 S2D CHAN CHEUK YAN 86 102 107 94

7 S4B CHAN CHEUNG KI 24 22 46 62

8 S3D Chan chi fung 73 95 44 85

9 S1A CHAN CHI HO 20 32 31 44

10 S1E CHAN CHOR TING 53 72 50 53

11 S2E CHAN CHUN CHUNG 68 63 ABS 55

12 S3A CHAN CHUN FAI 83 86 84 91

13 Full Mark 100 110 120 100

14 Passing Mark

15 Passing Number

Page 17: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

17

16 Passing Percentage

17 Max Mark

18 Min Mark

19 Average Mark

20 Standard Deviation The weight of test1 to test3 and the exam are as follows:

Test1 Test2 Test3 Exam 10% 15% 15% 60%

Step1: Find the formula for G2 (note you need to note that the full mark of different tests are different. G2: Find the average, highest, lowest mark and standard deviation in column C. C17:

C18:

C19:

C29:

Step2: Find the passing mark in C14, the passing mark should be half of the full mark. C14: Step3: In C15, please find the number of passing students, you should use function “countif” and &. C15: Step4: Find the passing percentage in C16 C16: The functions you used in this section include: Max, min, average, std, count, countif, &

The function if and countif Copy the following table to a spreadsheet A B C D E

1 Test1 Test2 Exam Conduct

2 Mary 59 23 78

3 Johnny 60 22 34

4 Daisy 91 88 91

5 Dudy 55 52 54

6 Andy 38 46 22 The conduct is calculated according to the following scheme: If a student fails all tests and exam (less than 50 marks), his or her conduct would be E. If a student fails any two assessment (exam or test), his or her conduct would be D. If a student fails any one assessment (exam or test), his or her conduct would be C. If a student did not fail any assessment and his average score is less than or equal to 60, his or her conduct would be B. If a student did not fail any assessment and his average score is more than 60, his or her conduct would be A. What is the formula in E2? (hint: make use the functions, countif and if)

=IF(COUNTIF(C3:E3,"<50")=3,"E",IF(COUNTIF(C3:E3,"<50")=2,"D",IF(COUNTIF(C3:E3,"<50")=1,"C",IF(AVERAGE(C3:E3)>60,"A","B"))))

Sorting Use the above worksheet, sort the data according to the final mark in descending order. If the final marks are the

same, then sort it according to the class, also in ascending order. So, the first sorting key is

Page 18: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

18

The second sorting key is *Note to check the “header row” box. **Print the final version with your name and class number.

Absolute Address and Relative Address Absolute address: Address that would not be changed when moved. We would use the symbol “$” to fix the

address. For the address A3, determine which part has been fixed.

Address Status A3 Relative address

Column fixed

A$3 Row fixed

Absolute address

Here are some exercise: Original contents in B3 B3 move D10 (Use pencil)

$B5

C$3

=A2+B$2*$D4+$A$1

Open the worksheet multiple table. This question requires you to use just one formula (in B3) so that it can generate a multiple table. (This formula is copied to the other cells) A B C D E F G H I J

1 How to generate a multiplication table with just one formulae only?

2 1 2 3 4 5 6 7 8 9

3 1 1 2 3 4 5 6 7 8 9

4 2 2 4 6 8 10 12 14 16 18

5 3 3 6 9 12 15 18 21 24 27

6 4 4 8 12 16 20 24 28 32 36

7 5 5 10 15 20 25 30 35 40 45

8 6 6 12 18 24 30 36 42 48 54

9 7 7 14 21 28 35 42 49 56 63

10 8 8 16 24 32 40 48 56 64 72

11 9 9 18 27 36 45 54 63 72 81 B3:

String Operation Step1: Open the worksheet string_operation

Step2: You are going to produce a worksheet look like

Class Name Proper Surname name

S2A AU SIU CHUNG Au Siu Chung AU siu chung

S2E AU YIN CHUNG Au Yin Chung AU yin chung

S1D AU YUK HING Au Yuk Hing AU yuk hing

S4C CHAN CHAK LAM Chan Chak Lam CHAN chak lam

S2D CHAN CHEUK YAN Chan Cheuk Yan CHAN cheuk yan

S4B CHAN CHEUNG KI Chan Cheung Ki CHAN cheung ki The functions you are using are: UPPER, lower, Proper, Left, Right, Mid, len, find, search

Page 19: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

19

Step3: Finish column C. C2: Step4: To find the surname, we need to find the space “ “ first. We can find it by the function “find” or “search”.

Now, I want to find the position of the space in B2, what are the formulas? “find”: “search”: Step5: Use the function “Left” to find the surname of B2 and store it in D2. Remember to set the surname into

block letters. D2: Step6: Now, use the function “Mid” (function to cut a sub string) and “len” (function to find the length of the

string. E.g. len(“abc de”)=6) to extract the name and store it in E2. Remember set it into small letters. E2: In fact, you do not need to use the function len(). All you have to do is to set it to 100 and it is done. i.e. E2: Now, try to use the function “Right” instead of “Mid”. E2:

Transform from horizontal to vertical Open the worksheet transform

Try to use the function Hlookup to transform the cells in “BEFORE” to “AFTER”. The formula in H14 is

More on Vlookup and Hlookup Open the worksheet more on lookup

By using the information Personal Details, Product Details and Sales Records, finish the Sales Details by the function VLOOKUP. Here is an example of Vlookup. A B C D E F

1 1 PC case $ 250 2

2 2 mouse $ 35 2.1

3 3 keyboard $ 85 4

4 4 LCD Mon $2,200 2.9

5 1

6 0.9

7 1.1 At F1, if the formula is “=VLOOKUP(E1,$A$1:$C$4,3,0)”, then the output is 35. At F1, if the formula is “=VLOOKUP(E1,$A$1:$C$4,3,1)”, then the output is 35. At F1, if the formula is “=VLOOKUP(E1,$A$1:$C$4,3)”, then the output is 35. At F2, if the formula is “=VLOOKUP(E2,$A$1:$C$4,3,0)”, then the output is N/A. At F2, if the formula is “=VLOOKUP(E2,$A$1:$C$4,3,1)”, then the output is 35. At F2, if the formula is “=VLOOKUP(E2,$A$1:$C$4,3)”, then the output is 35. At F3, if the formula is “=VLOOKUP(E3,$A$1:$C$4,3,0)”, then the output is . At F3, if the formula is “=VLOOKUP(E3,$A$1:$C$4,3,1)”, then the output is . At F3, if the formula is “=VLOOKUP(E3,$A$1:$C$4,3)”, then the output is .

Page 20: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

20

At F4, if the formula is “=VLOOKUP(E4,$A$1:$C$4,3,0)”, then the output is . At F4, if the formula is “=VLOOKUP(E4,$A$1:$C$4,3,1)”, then the output is . At F4, if the formula is “=VLOOKUP(E4,$A$1:$C$4,3)”, then the output is .

Others Rename a worksheet Add / Delete a worksheet Freeze panes, Split a window Changing decimals Link between two excel files Formatting spreadsheet, i.e. date, number, etc. Auto fill – Customize auto fill Name a cell and name a range Revision String operation: UPPER, lower, Proper, Left, Right, Mid, len, find, search Vlookup, Hlookup, Absolute address ($), relative address Sorting, first sorting key, second sorting key Max, min, average, std, count, countif, & Advance functions COUNTIF Usage: =COUNTIF(range, criteria) A. Criteria Basic form: a value or a cell address, e.g. =COUNTIF(A1:A5,13), COUNTIF(B3:B19, C2) Advanced form: Operators like: =, >, <, >=, <=, <>

In this part, the conditions have to be enclosed by the marks “ ”. e.g. “>3”, “=Apples”, “<>oranges”, “=” & A1, “<> & B2 NOTE: =COUNTIF(A1:A10,44) is equal to =COUNTIF(A1:A10,”=44”)

B. Wildcards

Wildcards can be used in a criteria involving text: (?) represents any character at the specified position; (*) represents any combination of characters. e.g.

=COUNTIF(A1:A11,”???ie”) will return 2 (which are Annie and Marie)

=COUNTIF(A1:A11,”C*”) will return 2 (which are Cindy and Candy)

Example: Find the number of students with marks above the average: A B C D

1 Chemistry Test

2 No. Name Score

A

1 Annie

2 Candy

3 Wendy

4 Judy

5 Lucy

6 Bobby

7 Debbie

8 Mandy

9 Pency

10 Marie

11 Cindy

12

Page 21: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

21

3 1 Annie 63

4 2 Candy 64

5 3 Wendy 65

6 4 Judy 74

7 5 Lucy 71

8 6 Bobby 83

9 7 Debbie 23

10 8 Mandy 94

11 9 Pency 11

12 10 Marie 88

13 11 Cindy 77

14

15 Average 64.81818

16 #student above average 7

17

Write down the formula at the cell C16.

=COUNTIF(C3:C13, “>” & C15) or

=COUNTIF(C3:C13, “>” & AVERAGE(C3:C13))

Usage: =SUMIF(range, criteria, [sum_range])

In it we can see that this function can use two arguments or three arguments. Example: A B C D E

1 Category Quantity order

2 Category1 8 6

3 Category2 3 5

4 Category3 5 7

5 Category4 4 1

6 Category5 3 5

7 Category6 6 3

8 Category7 7 2

9 Category8 8 7

10 Category9 4 0

11 Category10 5 6

12

13 if quantity greater than B13, sum quantity 5 29

14 if quantity equal to B13, sum quantity 5 10

15 if quantity less than B13, sum order 5 11

16 if order > quantity, sum order

17

Cell C13, the formula is =SUMIF(C2:C11, “>” & B13)

Cell C14, the formula is =SUMIF(C2:C11,B13)

Cell D15, the formula is =SUMIF(C2:C11,”<” & B13, D2:D11)

To find the cell D16, the procedures would be

Set the formula in cell E2 to C2-D2, then, at cell D16 enter the formula

=SUMIF(E2:E11,”<0”, D2:D11)

Page 22: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

22

Example: A B C

1 Name Score

2 Annie 63

3 Candy 64

4 Wendy 65

5 Judy 74

6 Lucy 71

7 Bobby 83

8 Debbie 23

9 Mandy 94

10 Pency 11

11 Marie 88

12 Cindy 77

13

14 Total marks for name = "*e*" 250

15 Write down the formula in cell B14.

=SUMIF(A2:A12,"*e*",B2:B12)

Example: A B C D

1 Name Sex Score

2 Annie F 63

3 Candy F 64

4 Terry M 65

5 Judy F 74

6 Lucy F 71

7 Bobby M 83

8 Johnny M 23

9 Mandy F 94

10 Sunny M 11

11 Marie F 88

12 Cindy F 77

13

14 Average for boys 45.5

15 Average for girls 75.85714

16 Write down the formula in cell C14 and C15.

C14: =SUMIF(B2:B12,”M”, C2:C12)/COUNTIF(B2:B12,”M’)

C15: =SUMIF(B2:B12,”F”, C2:C12)/COUNTIF(B2:B12,”F’)

<End of Chapter 2>

Page 23: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

23

Class work: 1. The sales performances of six staff in the first quarter of 2006 are recorded in worksheet QUARTER1.

Another worksheet SUMMARY1 is created to store the name, the total sales amount in the first quarter rounded to the nearest 1000, and the rank (with 1 representing the highest total sales amount) of each staff.

In the worksheet QUARTER1 A B C D E

1 Name Jan Feb Mar

2 Amy 500 200 400

3 Judie 600 700 500

4 Candy 400 400 700

5 Lucy 300 500 400

6 Pency 600 500 350

7 Wendy 200 100 160

In the worksheet SUMMARY1, A B C D

1 Name Sum of Sales Rank

2

3

4

5

6

7

Formulas written in A2, B2 and C2 of SUMMARY1 are copied to cells A3 to A7, B3 to B7 and C3 to C7 respectively. Write down the formulas in A2, B2 and C2 of Summary1.

A2 : =QUARTER!A2

B2: = ROUND(SUM(QUARTER1!B2:D2),-3)

C2: = RANK(B2, B$2:B$7,0)

2. If you want to find the sum of the marks of the top 5 students and store it in cell D13, how will you get that?

1. First you should enter the number from 1 to 5 in the cells C2 to C6,

2. Enter the formula “=LARGE(B$2:B$12,C2)” in the cell D2 and then copied to D3 to D6.

3. Finally, you should enter the formula “=SUM(D2:D6)” in the cell B13.

Page 24: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

24

CHAPTER 3: More Exercise on “if” Download the data file, exercise_if.zip from my web site. 1. Open if_1.xls A B C D E F G H

1

2 John Mary Peter 1st 2

nd 3

rd

3 Eng 86 56 88

4 Chinese 92 61 71

5 Maths 77 90 82

6

7 Suppose that the marks of John, Mary and Peter will not be the same on any subject, column F, G and H are supposed to hold the name of the person who get the highest, the second and the lowest mark. i.e. F3 should be “Peter”. Use “if” and “max” to finish formula in F3. F3 Use “if” and “min” to finish formula in H3. H3 Use “if”, “max”, “min” and “and” to finish formula in G3. G3

2. Open if_1_b.xls A B C D E F G H

1

2 Element1 Element2 Element3 Min.(Except 0)

3 Test1 5 2 0

4 Test2 3 6 9

5 Test3 0 0 2

6 Test4 0 0 0

7 F1 are supposed to contain the minimum value (excluding 0) in the column B, C and D. But if there 3 zero in a row, then, the minimum value should be 0. Use the function “if”, “max”, “min”, “sum” to finish the formula in F3 F3 In fact, you can just use “if” and “large” to finish it, how is it? F3 In fact, you can just use “if” and “small” to finish it, how is it? F3

<End of More Exercise on if>

Page 25: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

25

CHAPTER 4: Advance Techniques (In depth discussion) Advance Techniques: To combine the contents of two (or more) cells: Task

1 The command we use is: A B C D E

1 1 2 12

2

3 ab 33 de

4

5

6 The cell C1 is in fact the combination of the contents of A1 and B1. The formula in C1 is Now, the cell D3 is used to contain the merged contents of A3, B3 and C3. Is there any data type conflict here? YES / NO What is the result in D3? What is the formula in D3?

Paste Special Task

2 After we copy some data from some area, we need to paste it into another area. But, sometimes, after you paste it, it will be different from the original data. We will illustrate this by the following example: Step1: Open the Excel file sample_data1.xls

A B C D E F G

1 Class Name Test1 Test2 Test3 Exam Final_mark

2 S1A CHENG TSZ PAN

3 S1A CHENG YIM HA

4 S1A CHEUNG HOI TUNG

5 S1A HO TSZ WAI

6 S1A KWONG PUI HUEN

7 S1B CHAN KA YAN

8 S1B CHAN TIM WAI

9 S1B CHAN TIN PO

10 S1B CHENG YUK YING

Step2: Using the function “Rand” to finish the column C, D and E. Note that the marks in these columns should be more than 30 and no more than 100.

Note: Rand() will generate a random number between and (it will not be negative)

The formula in E2 is Step3: Still use the function “Rand”, “Average” and “if” to finish the column F, but note that the marks for

the exam should not differ more than 15% of the average mark of that particular student. i.e. For example, John’s average mark is 65, then, the possible range of his exam mark would be 65

±65*15%. Still each student’s exam mark cannot be less than 30 and cannot exceed 100. The formula in F2 Step4: The weight of Test 1, 2, 3 and the exam is 0.1, 0.1, 0.2, 0.6.

Page 26: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

26

Write down the formula in G2. The formula in G2 What is the value in G2? Step5: Copy the cells G2 and paste it in G5. What is the value in G5? Is it different in G5 and G2, why?

What symbol we use to distinguish which is Absolute Address and which is Relative Address? Step6: If we insist to paste the value in G2 into G5, what should we do? Paste Step7: Copy the data in column G and then paste the values of them into Sheet2, note to the decimal

places. If we want to have the value in integer format, what should we do? Step8: Use conditional formatting, we select those fail students mark (less than 50< column F). For those who fail will show a red color in that mark. Step9: H2 to H4 is used to hold the top 3 marks in the column final_mark, use the function “large” to finish

it. The formula in H2 should be Apart from values, what else we can paste?

Overall Project1 Task

3 Step1: Open the file sample_data2.xls. You will get this. A workbook with 3 worksheets, data, graph, statements. In the worksheet data, you should have something like this: A B C D E F G H

1 Reference: Year: 2003 Level: A.L. Class: 6S

2 Eng Chinese P. Maths Physics

3 A 1 2 1 3

4 B 1 2 2 4

5 C 3 2 2 3

6 D 10 10 5 9

7 E 9 6 4 7

8 F 5 5 0 3

9 U 1 2 0 1

10 ABS 0 1 0 1

11 Pass %

12 Our School Credit %

13 Pass % 73.2% 75.5% 83.7% 82.8%

14

Public Result Credit % 18.3% 16.4% 26.9% 27.2%

15

Page 27: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

27

The cells that are in light green color are supposed to be changeable and they are just data, however, for those C11 to F12, you are required to finish it (which is presented by % with 1 d.p.) Formula in C11 Value in C11 Step2: Use Chart wizard to draw a chart to compare the Passing Percentage of our school and

the public result. Type of Chart: Bar Chart ( Clustered Column) Title: Passing Percentage Comparison Axis: X: subjects name, Y: (No need) Scale: Y: (min. 40%, max 100%) Legends: Our School: Yellow, Public Result: Red Fonts: 10 Put the chart in the worksheet “Graph”.

You should be able to produce something like: Passing Percentage Comparison40.0%50.0%60.0%70.0%80.0%90.0%100.0%

English Chinese P. Maths PhysicsOur SchoolPublic Result

Step3: Copy the above graph and paste it in the worksheet “Graph” too.

1. Double click on the y-axis of the graph. Then, set the y-scale to min. = 0% and max. = 100%

2. Change the title to “Credit Percentage Comparison” 3. Right click on the graph and then select “source data”. Select Series, select series

“Our school” and select new values, then, select series “Public Result” and select new values

4. Try to use another type of chart, say, line chart, pie chart or XY graph or with 3-D visual effect.

Step4: In the worksheet statements, you should produce a complete sentence which states the

passing percentage and the credit percentage of each subject. The following is an example. Remember, the data should be automatically updated whenever changes are made.

At the cell A1: The passing percentage of English is 83.3% and the credit percentage is 16.7% You should make use of the symbol “&”. What is the formula in A1? Step5: Still in the worksheet statements, you should produce a complete sentence that states of

which subjects the passing percentage is higher than the public result and of which subjects the credit percentage is higher than the public result. You would get something like:

The subjects of which the passing percentage is better than the public results include English and P. Maths and Physics The subjects of which the credit percentage is better than the public results include Chinese and P. Maths and Physics

Page 28: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

28

Remember, they have to be automatically updated whenever changes are made.

Project In a week time, you should produce a Excel file which like the one in task 3. However, apart from the one in

task 3, it will also compare the results of the past 3 years. The data is to be generated by you. The subjects should contain English, Chinese, P. Maths, App. Maths, Physics, CA, Bio, Chem.

Revision of functions and techniques: Rand() If(…, …, …) Average() Large() Combining the contents of two cells & Paste Special Conditional Formatting Chart Wizard, Legends, Title, Scale, Axis, Type of Chart The techniques that I will demonstrate on the lessons: Import from .csv file comma-separated values file

In computers, a CSV (comma-separated values) file contains the values in a table as a series of ASCII text lines organized so that each column value is separated by a comma from the next column's value and each row starts a new line. Here's an example: Doe,John,944-7077 Johnson,Mary,370-3920 Smith,Abigail,299-3958 (etc.) Example: Hang Seng Index data from Yahoo! http://table.finance.yahoo.com/k?s=^hsi&g=d right click the link and select “save target as”. Save it in the desktop and then open it with Excel and with note pad respectively. What did you discover? How about to add a new worksheet in the .csv file?

Validation In Excel, data is often inputted directly by keyboard. So, we need to take some measures to avoid

some accidental input error. We can set it with the technique called “Validation”. Example: Open the file demo_1.xls Set the allowed input range of the column Exam from 0 to 100. The inputted data should be

Name Test1 Test2 Exam

CHENG TSZ PAN 40 96 61

CHENG YIM HA 32 47 26

CHEUNG HOI TUNG 93 72 50

HO TSZ WAI 47 58 88

KWONG PUI HUEN 79 51 21 1. Enter the data into F2 and F3 correctly, see what happens? 2. Enter the data into F4 incorrectly, see what happens?

Demonstrate how to use validation with a list. Save Option save it with a password To protect the Excel file, you can set a password for it. The password can be set to read or read-write.

Now, we use the above Excel file as the demonstration and set the password as “trial”.

Page 29: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

29

Worksheet / Workbook protection Printing techniques Page Setup

• Margins – Left, Right, Top, Bottom, Header, Footer • Orientation – Landscape or Portrait • Header and Footer • Scaling – Adjust Percentage • Select Rows on top of every page • Select Column on left of every page

Now, check the page information of the worksheet page_setup in the file demo1.xls Margin: Left ,

Right ,

Top ,

Bottom ,

Header ,

Footer ,

Orientation: ,

Header: ,

Footer: ,

Scaling: ,

Select Rows: ,

Select Col: ,

Importance of PREVIEW. Print all the worksheet in a time

Auto filter and Advanced filter We will illustrate the auto filter and advanced filter by using the worksheet page_setup in the

demo1.xls. For auto filter,

All you need to do is to apply auto filter, then, you can easily filter the data by the criteria, say, top 10 or custom autofilter. Now, you are supposed to find out who have marks more than 85 in Test 8 and more than 65 in the final_mark.

For advanced filter,

We can set multiple criteria and put the criteria in the range of cells. For example, I want to find those who is studying in S1B and at the same time, their marks in Test1 would be more than 60. What I have to do is to put the following data in M1:N2.

class Test1

S1B >60 Then, apply advanced filter and set the criteria in M1:N2.

Trace error

Page 30: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

30

Simple Exercise 1: Formula Operation I Simple Exercise:

Scenario Formula Round off the data in the cell A3 =Round(A3, 0)

Change the letters in the cell B5 into block letters =upper(B5)

Combine the strings in the cells from A1 to D1 =concatenate(A1, B1, C1, D1)

To create a random value from 10 to 20, correct your answer to 1 d.p.

=round(rand()*10+10,1)

Find out how many blank cells in the range from cell A5 to C12

=countblank(A5:C12)

Find out how many cells that contain information (e.g. number, text or formula) in the range from cell A1:C11 and the cell A14

=counta(A1:C11, A14)

Eliminate all the extra spaces in the cells B6 =trim(B6)

Find out how many value in the range from A1 to A10 =count(A1:A10)

Find out the first 5 letters of string in cell A3 =left(A3,5)

If the content of cell A1 is not equal to B1, then output “Correct”, output “Incorrect” otherwise.

=if(A1<>B1, “Correct”,”Incorrect”)

Find out how many cells which are greater than 30 in the range from the cells A3 to C14.

=countif(A3:C14,”>30”)

Find out the present time =now()

Nested if =if(A>B, if(B>C, 1, 0), -1)

Commands Usages Examples

Char Return the ASCII character of a code Char(65) returns “A”

Code Return the ASCII code of a character Code(“A”) returns 65

Date Return a date. date(1900,1,1) will return 1/1/1900 which is date format (in fact, 1-Jan-1900 is set to be 1, 2-Jan-1900 is set to be 2 and so on.)

Exact Compare two strings, the returned result would be logical value, True or False

EXACT("word","word") returns TRUE EXACT("Word","word") returns FALSE EXACT("w ord","word") returns FALSE

Find Return the position of a string in another string. It is case sensitive and no wild card is allowed.

FIND("M","Miriam McGovern") returns 1 FIND("m","Miriam McGovern") returns 6 FIND("M","Miriam McGovern",3) returns 8

IsBlank Return a logical value True or False. True if that cell is blank, false otherwise.

IsBlank(A1) => True or False, it depends on if A1 is empty or not

Large Return the kth largest value in the range. Large(A1:A11,2) returns the second largest value in

A1 to A11

Lookup The position of a value in the array. If A1:A5 contains 7, 3.5, 3.5, 1 and 2, then, Lookup(1,A1:A5) returns 4

Page 31: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

31

Rank Returns the rank of a value in an array If A1:A5 contains 7, 3.5, 3.5, 1 and 2, then, RANK(A2,A1:A5) returns 2 (Descending) RANK(A2,A1:A5,1) returns 5 (Ascending)

Search Similar to the function find, but it is case insensitive.

Small Return the kth smallest value in the range. Small(A1:A11,4) returns the forth smallest value in A1

to A11

Text Transform a value into text with specific format

TEXT(2.715, "$0.00") returns "$2.72" TEXT("4/15/91", "mmmm dd, yyyy") returns "April 15, 1991"

Value Transform a text into value VALUE("$1,000") returns 1,000

Vlookup Similar to lookup but it works in columns

Hlookup Similar to lookup but it works in rows

Simple Exercise 2: Formula Operation II Write down the output of the following expression:

Function Output

1 LEN(TRIM(“chan tai man “)

2 FIND(" ", "chan tai man",1)

3 LEFT(“chan tai man”, 3)

4 CONCATENATE(“yll”,”ss”)

5 “Yuen “ & “Long”

6 (“chan tai man”) Chan Tai Man

7 (“chan tai man”) CHAN TAI MAN

8 MID("chan tai man",6,3)

9 IF(10>20,”CORRECT”,”INCORRECT”)

10 IF(OR(“10”>”20”,”10”<”20”),TRUE,FALSE)

11 IF(AND(“10”>”20”,”10”<”20”),TRUE,FALSE)

12 IF(A1>B1,TRUE,IF(NOT(A1>B1),TRUE,FALSE))

13 ROUND(8.91334,1)

14 INT(8.91334)

15 INT(-8.91334)

Page 32: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

32

To answer the following question with reference to the following table:

A B C D E F G H

1 Class Class No. Test1 Test2 Exam Final

2 S1A 2 21 80 19

3 S1A 7 84 60 81

4 S1A 19 79 75 40

5 S1A 25 62 70 28

6 S1A 26 ABS 30 54

7 S1A 30 57 ABS 31

8 S2B 3 71 55 41

9 S2B 16 14 20 52

10 S2B 17 79 77 49

11 S2B 22 86 23 86

12 S2B 26 21 44 67

13 S2B 31 97 26 99

14 S2B 34 37 64 92

15 S3C 7 70 19 60

16 S3C 8 44 41 55

17 S3C 19 17 ABS ABS

18 S3C 33 45 62 ABS

19 S3C 35 93 6 42

20 S3C 37 47 83 86

21

22

23

Cell Formula Output

1 C23 =COUNTIF(C2:C7,”>50”)

2 D23 =COUNT(D2:D22)

3 E23 =COUNTA(E2:E22)

4 E24 =COUNTBLANK(E2:E22)

5 C24 =LARGE(C2:C22,2)

6 D24 =SMALL(D2:D22,3)

7 C25 =RANK(86, C2:C22)

8 G2 =RIGHT(A2,2)

9 F2 =C2*0.1+D2*0.2+E2*0.7

10 H2 =SUM(C2:D2,50)

11 H3 =MOD(E3,3)

Page 33: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

33

Simple Exercise 3: Overall Revision Simple operation:

A B C D E F

1 2001 3 24

2 13 88 36 19

3 15 56 48 18

4 16 21 22

5 17 58 8

6 18 11 84

7 27 23 88

8 77 73 78 71

9 Chan Tai Ming

10 For the above spreadsheet data, answer questions 1 to 13. Write down your answers at the spaces provided. Question Answer

1 =date(A1,B1,C1)

2 =vlookup(E2,$A$2:$C$7,2,0)

3 =vlookup(E2,$A$2:$C$7,2,1)

4 =vlookup(E3,$A$2:$C$7,2,0)

5 =vlookup(E3,$A$2:$C$7,2,1)

6 =IF(NOT(AND(A7>A6,OR(B7>B6,C7>C6))),"A",IF(AND(A7>B7,B7>C7),"B","C"))

7 =large(A2:A7,3)

8 =char(A8) & char(B8) & char(C8) & char(D8)

9 =code(left(A9,1))

10 =find(“ “,A9,7) OR =find(char(32),A9,7)

11 =countif(B1:C8,”>”&D8)

12 =small(C1:C8,2)

13 =now()

Download the Excel file from: http://www.yll.edu.hk/~yll-cym/s6ca/note/exercise/spreadsheet/exercise1.xls Advance Techniques: Perform the techniques in your computer. In the worksheet “personal_info”, perform the following tasks.

1. Name the range from A2:E17 with the name “INFO”. 2. Since the names in column B are not in the standard format, i.e. some are capital letters and some

are small letters. Standardise the names with capital letters in column F.

3. The dates of birth stored in column E are in the text format. Use the functions like date, left, mid, right, vlookup and the table “month_table” to transform the data in column E into date format in column G. For example, in E2, it is in text format '03-DEC-1992, then the data in G2 would be in date format 1992/12/3. After that, with the first key at column G, sort the data in ascending order.

In the worksheet “subject_CA”, perform the following tasks.

4. To calculate the total mark in column I, the formula is below: The exam weights 70% of the total mark. The best 3 test scores will weight 30% of the total mark. (Note that the full marks of exam and test would be 100)

5. Round off the total marks into integers.

Page 34: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

34

6. The passing mark would be 50, in column I, use conditional formatting to change the color into red if it fails.

7. With reference the data in the worksheet “personal_info”, put the names of students in column J.

8. Create a column chart such that it looks like the following chart.

CA Marks

20

30

40

50

60

70

80

90

WO

NG

SIU

LIN

G

TO

NG

CH

I W

AI

WU

YA

N Y

AN

CH

EU

NG

MA

N M

AN

CH

AN

SIU

MIN

G

CH

AN

SIU

LIN

G

MA

N K

A Y

EE

CH

EU

NG

LU

NG

CH

IU M

ING

YIP

KO

K W

ING

LE

UN

G Y

ING

MIN

G

TA

M C

HI

YU

NG

CH

EN

G C

HIN

G

PO

ON

WIN

G

WO

NG

SH

ING

TA

NG

TA

I M

AN

Note: The x-axis is the student name and the scale is from 20 to 90. Save the chart in the worksheet called Mark_Chart.

Page 35: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

35

Chapter 5: Macro - Basic Operation in Programming Declare variables Dim Public

Dim num1 as integer Dim num2 Public num3

Assignment =

A = 10 B = B + 1 C = “ABC DEF”

Input / Get information Inputbox Cells(x,y).value

Cells(1, 1) = InputBox("Please input a sentence", "Input", 0) Abc = cells(1,1).value Apart from cells(x,y), we can use “Range”. e.g. Range(“A1”).Select or Range(“B1:B10”).Select Examples:

Range(“A1”).Select ActiveCell.FormulaR1C1 = 10

Branching If

If (condition) then … Else … End if

If a > 0 then Cells(1,1)= 10 else cells(1,1) = 20 end if

Iteration for while

For I = 1 to 10 Next i While (condition) … Wend

For i = 1 to 10 Cells(I,1) = I Next I While I < 10 I = I + 1 Wend

Documentation ‘

Exercise 1. Write the macro that it will let you input an integer, then it show you the value at cell A1. 2. Modify the macro so that it will determine whether it is greater than 10 or not. 3. Modify it so that it will accept numbers only 4. Modify it loop infinitely until a number is inputted.

Page 36: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

36

Mock Questions (created by YM Chan) 1. In using electronic spreadsheet program, we may encounter some problems, for example, there are a

number error messages that they represent different meaning. Below shows some of them:

#N/A

#VALUE

#REF!

#DIV/0!

#NAME?

a) Briefly describe what the error #DIV/0! is and give an example of it. (1 mark)

It is divide by zero error, computer will not able to divide a number by 0, e.g. 13/0

will give this error.

b) #VALUE is an error that represents no value has been assigned to a cell. Please give an example

that a cell will give a #VALUE error by making use of the function FIND. (Find is a function that gives the position of a string segment in another string. E.g. FIND(“an”, “Chan Tai Man”) will give a result 3.) (1 mark)

Find(“abc”, “XYZ”) will give an #VALUE error. i.e. The string segment is not found

in the searched string.

c) Below shows three scenarios, try to match them with the following errors: #N/A, #REF!, #NAME? (3 marks)

Scenario Corresponding error

1. At cell C9, a formula “=A1+B2” is entered. Then, the formula in C9 is copied to B1.

#REF! error

2. At cell C9, a formula “=VLOOKUP(1,A$1:B$6,2)” is entered. However, the smallest number in the index column (i.e. from A1 to A6) is 10.

#N/A error

3. At cell C9, a formula “=AB/2” is entered. However, there is no such a variable “AB” in the spreadsheet.

#NAME?

d) In order to detect if there is an error in a cell, a function is needed. In spreadsheet program, there is a

function called “ISERROR”, it will give a TRUE value if there is an error in the cell, FALSE if there is no error in the cell. Here is an example:

If a #N/A error is in the cell A1 and the formula in cell A2 is “=ISERROR(A1)”, then, the result in A2 would be TRUE.

Now, names of the students are listed in the column A from A1 to A100 as shown below,

A B

1 Chan Tai Man 1

2 Wong Siu Ling 0

3 Ma Wing Yee 0

4 Chan Siu Ying 1

98 Liu Wai Hung 0

99 Chan Po Kam 1

100 Cheng Ka Wing 0

you want to indicate in column B that if the name contains the segment “chan”, it will return a “1” and “0” if the name does not contain the segment. Write down the formula in B1 such that it can be copied from B2 to B100. (3 marks)

=IF(ISERROR(FIND(“chan”,A1)),0,1)

2. Peter is the principal of a secondary school. He used a spreadsheet software package to create 2 worksheets,

INFO and STATISTICS. Some of the data of worksheet INFO is shown below:

Page 37: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

37

Column A shows the name of the teachers(the school has about 100 teachers), column B shows the sexes. Column C shows the subjects they teach. (Note that each teacher will teach one subject only.) Column D shows the teacher ID, column E shows the classes if they are the class teachers (N.A. means he or she is not a class teacher). Column F shows the number of regular lessons he or she needs to take up. Column G shows if he or she will have one more class lesson or not. Column H shows the total number of lessons which is the sum of column F and column G. Note that the records is sorted by the name of the teachers.

a) Initially, John cannot successfully sort the data by the name of the teachers, because the spreadsheet sorted the data including the first row of data. i.e. Instead of getting the expected result as shown in the above figure, it got a result as shown below:

What would be the problem and how to solve it?

(2 marks) He sorted the data including the header row.

He should select the option (with header row) so that the spreadsheet program will not sort

the data including the header row.

b) After successfully sorted the data, John tried to use a formula to finish the column D. The teacher ID has the

following structure: The first 3 letters are the subject code, then, it follows a symbol "_" and at last, 2 letters to represent the order of teachers who is teaching this subject. For example, at row 19, it shows a record of "Ng Ka Wai" is the third person who teaches Biology in the school. So, its ID is BIO_03. So, if a person who teaches ENG and his position in the subject "ENG" is 12, then his ID would be ENG_12. Write down the formula in D2, note that the formula can be used to copy to the rest of the cells in column D.

(4 marks)

Page 38: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

38

=C2 & “_” &

IF(COUNTIF(C2:C$2, C2)<10,

”0” & (COUNTIF(C2:C$2, C2),

(COUNTIF(C2:C$2, C2))

c) Data in column F is inputted by a clerk, and according to the school policy, no teacher will be assigned more than 35 regular lessons or less than 20 regular lessons. Suggest an effective way to avoid careless input mistakes in column F.

(1 mark) Validation.

Column F should be set such that the inputted data should be integer in the range of 20 to

35.

d) Class lesson in column G is an extra lesson for each junior class (i.e. from F.1 to F.3), write down the formula in G2, note that the formula can be copied to the rest of the cells in the column G.

(2 marks) =IF(

LEFT(E2,1)<=”3”,

1,0)

e) As there are so many records in this spreadsheet, suggest a feature of spreadsheet software package that it can (i) easily find a teacher with special criteria, e.g. a girl who teaches BIO and has lessons more than 31. (ii) view the data and the header row even though it is scrolling up or down, left or right.

(2 marks)

(i) filter

(ii) freeze panes / split window

f) John tried to use a formula to find the total number of lessons of the teacher BIO_02 with the formula: VLOOKUP("BIO_02", D2:H100, 5), can he have the required result? If not, suggest two ways to get the required result.

(2 marks) No, it is because the data in not sorted.

Method 1: Sort the data in ascending order

Method 2: Change the formula into VLOOKUP("BIO_02", D2:H100,4,0)

In the worksheet STATISTICS, some of data has been shown below:

g) WITH reference to worksheet INFO, write down the formula in C2(in the worksheet STATISTICS) such that it will automatically find the average number of lessons of each type of teachers (according to the subject they teach). The formula in C2 can be used in the rest of the cells in column C.

(5 marks) =SUMIF(INFO!

C$2:C$101,

A2,

INFO!H$2:H$101) /

COUNTIF(INFO!C$2:C$101,A2)

h) By making use of the data in the worksheet STATISTICS, John plotted a full screen column chart (the resolution of the picture has been set to 1000x720) as shown in below:

Page 39: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

39

John found that the file is too large, so, he decided to reduce its resolution to (400x288). Is it helpful in reducing the file size of this spreadsheet file? Briefly explain please.

(2 mark) No, it will not help much.

It is because the graphic itself is a vector graphic which is generated by the data. i.e.

formula instead of bitmap pixels graphics, so, the area of the graphic will not change much

even it is enlarged or diminished.

3. David is a research analyst of an investing company. He is trying to use a spreadsheet to simulate the

return in different investments. a) He thinks that the formula “=IF(RAND()>0.5, RAND(), 1 – RAND())” will give a value varies from 0.5 to 1. Do

you agree? Explain please. If not, suggest a way to give a value varies from 0.5 to 1.

The formula will not necessary give a value ranges from 0.5 to 1.

It is because the function rand() in the formula

“=IF(RAND()>0.5, RAND(), 1 – RAND())” will give 3 different values.

Use another column to contain the random value

OR

=0.5 + Rand()*0.5

(any valid answer)

b) Now, David tries to use an investment model to simulate the returns of three different investments. The expected returns are listed in column G, the corresponding risk is listed in column H. Column E is a random number and it is used as a reference to the risk. For example, for investment 1 in the first year,

IF Cell E3 THEN Cell B3 < 0.35 =B2*{1 – (another random number)*G2}

≥ 0.35 =B2*{1 + (another random number)*G2}

A B C D E F G H

1 Year Investment1 Investment2 Investment3 REF Return Risk

2 100 100 100 Investment1 0.1 0.35

3 1 109.04 105.48 100.36 0.404001 Investment2 0.06 0.15

4 2 112.90 107.70 101.10 0.523586 Investment3 0.03 0.05

5 3 123.63 108.09 102.67 0.392296

6 4 127.36 114.29 103.89 0.816525

7 5 128.96 121.04 105.23 0.798281

8 6 123.48 124.19 107.00 0.281765

Page 40: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

40

9 7 120.73 130.85 108.51 0.159863

10 8 110.86 131.93 109.34 0.179779

11 9 118.96 137.00 109.47 0.977143

12 10 130.21 137.32 111.89 0.353603

13 11 138.75 141.92 113.51 0.392775

14 12 148.47 144.36 113.56 0.484827

15 13 147.33 138.38 116.50 0.09295

16 14 147.12 130.10 118.44 0.122167

17 15 150.05 132.63 119.33 0.366458

18 16 158.97 132.85 121.88 0.977434

19 17 163.04 139.78 123.27 0.958257

20 18 147.38 136.27 123.67 0.070843

21 19 160.20 138.17 124.79 0.860672

22 20 155.88 136.31 123.71 0.000515 (i) Write down the formula in E3 such that it is a value ranges from 0 to 1. (ii) Write down the formula in B3 such that it can be copied from B4 to B22.

(i) rand()

(ii) IF(E3 < H$2, B2*(1 – RAND()*G$2), B2*(1 + RAND()*G$2))

OR

B2*IF(E3 < H$2, 1 – RAND()*G$2, 1 + RAND()*G$2)

OR

B2*IF(E3 >= H$2, 1 + RAND()*G$2, 1 – RAND()*G$2)

c) If David is now trying another model to simulate 3 different investments, the expected returns would be listed at column G as shown below. Initially, the investments in 1, 2 and 3 are 100 (as shown in B2 to D2). He needs to write the formula at the cells from B3 to D22 such that the return of the investment is the average of the previous years times a random number multiply the corresponding return rate. For example, at cell C12, the formula would be something like

(average of C2 to C11) * {1+ (random number)* G3} A B C D E F G

1 Year Investment1 Investment2 Investment3 Return

2 0 100 100 100 Investment1 0.15

3 1 111.92 106.34 102.09 Investment2 0.1

4 2 109.47 104.20 102.09 Investment3 0.08

5 3 119.99 110.05 106.48

6 4 116.59 111.83 103.49

7 5 113.90 116.06 110.62

8 6 127.22 109.06 107.93

9 7 129.32 112.60 110.57

10 8 130.89 110.18 110.03

11 9 123.12 108.99 111.80

12 10 128.97 114.08 107.11

13 11 120.01 113.31 114.55

14 12 121.82 115.78 112.06

15 13 125.00 110.19 111.21

16 14 132.59 111.30 112.30

17 15 121.30 114.78 115.91

18 16 126.39 120.33 111.23

19 17 130.22 115.27 109.47

20 18 139.60 117.39 110.23

21 19 137.88 113.31 113.56

22 20 129.47 115.31 109.36

Page 41: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

41

(i) Write down the formula for cell B3 such that it can be copied to cells B4 to B22. (ii) Since whenever new data is entered or the formula is changed, the random value generated will be

changed automatically. Suggest a way to avoid this problem.

(i) =AVERAGE(C$2 : C2) * (1+ RAND()) * G$3

(ii) Paste value instead of formula

Page 42: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

42

Practical Enrichment for Spreadsheet #1 Several students taken the exam and the marks are shown in column C, because the marks are too low,

the teacher wants to adjust them by adding base marks. e.g. Marie has 33 marks, if it adds basemark1, it will be 33+10=43 or if it adds basemark2, it will be 33+15=48.

A B C D E F G H

1 Sex Exam New Mark1 New Mark2 basemark1 basemark2

2 Marie F 62 72 77 10 15

3 Jane F 33 43 48

4 Bobby M 46 56 61

5 Mick M 32 42 47

6 Johnson M 34 44 49

7 Maple F 46 56 61

8 Leo M 53 63 68

9 Pinky F 35 45 50

10

11 Average mark 42.6 52.6 57.6

12 Average mark for M 41.3 51.25 56.25

13 F 176 216 236

a) Write down the formula for cell D2 such that it can be copied from D2 to E9.

=$C2+G$2

b) Write down the formula in C11 such that it can be copied from C11 to E11. Give your answer

correct to 1 decimal places.

=ROUND(AVERAGE(C2:C9),1)

c) Write down the formula in C12 such that it can be copied from C12 to E13.

=SUMIF($B$2:$B$9,"="&$B12,C$2:C$9)/COUNTIF($B$3:$B$10,"="&$B13)

#2 A group by students attend an exam, the passing mark of the exam for P5, P6 students is stored in the cell

H2 and H3 respectively. Note that the value of column E is logical value. A B C D E F G H

1 Class Exam Passmark Is Passed? Passmark

2 Marie P6 62 45 TRUE P5 40

3 Jane P5 33 40 FALSE P6 45

4 Bobby P5 46 40 TRUE

5 Mick P6 32 45 FALSE

6 Johnson P5 34 40 FALSE

7 Maple P6 46 45 TRUE

8 Leo P6 53 45 TRUE

9 Pinky P5 35 40 FALSE

10

11 Number of pass 4

a) Write down the formula for cell D2 such that it can be copied from D2 to D9.

=IF(B2=”P5”, H$2, H$3) <- Note: H$2, H$3 are used instead of 40, 45, “ ” should be used.

Page 43: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

43

b) Write down the formula for cell E2 such that it can be copied from E2 to E9.

=IF(C2>=D2,TRUE,FALSE) <- Note, Not “TRUE” but TRUE

c) Write down the formula for cell B11.

=COUNTIF(E2:E9,TRUE)

Integrated Exercise 01 John is a teacher in a secondary school, he is required to select different students do 3 different set of questionnaires. The following is a spreadsheet called “stu_info”.

Rules are set to select some students in selection 1, 2 and 3. a) Rule for selection 1: For the students whose class number is a multiplication of 7, write the formula in E2 so

that it can be copied to the rest of column E.

=IF(MOD(D2,7)=0,"Selected","")

b) Rule for selection 2: For the students whose class number is less than 10 and she is a girl, write the formula

in F2 so that it can be copied to the rest of column F.

=IF(AND(B2="F",D2<10),"Selected","")

c) Rule for selection 3: For the students who are in class 1C, 1D or 1E and he is a boy, write the formula in G2

so that it can be copied to the rest of column G. Will the following formula give the expected result? IF(NOT(OR(C2="1A",C2="1B",B2="F")),"selected","")

Explain please.

Yes, it is ok. another option. =IF(AND(RIGHT(C2,1)>="C",B2="M"),"Selected","")

Page 44: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

44

Basic Techniques 01 Q1 What is the name of features provided by spreadsheet software package shown in the figure below?

Autofill

Q2 With reference to the following figure, answer the following questions.

(i) To generate a set of random integers from B2 to F13, Cell B17 and B18 contain the upper limit and the

lower limit respectively. i.e. All the data from B2 to F13 should be confined in the range of B17 and B18. Write down the formula for B2.

=ROUND(B$18+(B$17-B$18)*rand(),0)

(ii) Find the formula at cell B15.

=COUNTIF(B2:B13,”>=”&B14)/COUNT(B2:B13) <-Note, no need to multiply by 100%

(iii) What is the feature below? What is the result of large(test1,3)?

Page 45: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

45

Name a range, The result would be 71.

(iv) For the above figure, what is the result of the formula, 1. RANK(B2,Test1) 2. RANK(B10, Test1, 1)

1. It would give a 4.

2. It would give a 4.

<End of Basic Techniques 01>

Basic Techniques 02 Q1 With reference to the following two figures, finish the following questions:

figure – 1

figure – 2

John is going to design a project, he tries to write the proposal first of which the structure is shown in the index, that is, the worksheet “content” on Figure – 1. However, after it’s been read by the teachers, several pages needs to be revised and it is shown in the worksheet “revision” on Figure – 2. In the worksheet “revision”,

(a) Which cell is the string “Teacher1” stored? What is the technique to combine several cells together?

merge cells

(b) Cell B2 to B15 are the pages that needs to be revised, and cells C2 to C15 are going to be used to

Page 46: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

46

store the corresponding content / topic that needs revisions. Write down the formula for cell C2 so that it can be copied from C3 to C15.

=VLOOKUP(B2,content!A$2:B$9,2)

(c) Cells C18 to C25 are assigned to shows the content / topic from the worksheet “content”, What is the formula for cell C18.

=content!B2

(d) Cells D18 to D25 are assigned to shows the frequency of the content / topic shown in cells C2 to C15, Write down the formula for cell D18.

=COUNTIF(C$2:C$15,C18)

(e) John’s proposal has 31 pages. In the worksheet “revision”, the cells from B2 to B15 have been assigned to store those pages that needs to be revised, that is, the numbers in these cells should be positive integer and less than or equal to 31. Describe how the spreadsheet software package can help avoiding careless input error?

First select those input cells, then, set validation rules on those cells such that

only values ranges from 1 to 31 are allowed.

<-You need to try to express your idea logically, you’ve got lots of time to explain your idea clearly, so, never answer this type of question without deep thinking.

Spreadsheet Exercise Basic Techniques 03 Peter is a teacher in a secondary school. He is planning to organize the students activities by using a spreadsheet file. In this workbook, there are 5 worksheets. They are “Details”, “Reference”, “Chess”, “Science” and “Art” as shown in the following figure.

The worksheets “Details”, “Reference”, “Chess” are shown below:

Details Reference

Chess

Page 47: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

47

The data in the worksheet “Details” and “Reference” is entered by a school clerk. Peter is going to generate the member_id, post, and password by using some formula. The structure of member_id is set as follows:

The first 2 characters

The following 2 characters

The following 2 characters

The following 1 character

The following 2 characters

The last character

Name of the club

Class Class No. Sex Year (2 digits) Chess Post in “Details”

CHESS 1A 5 F 1982 0 CH 1A 05 F 82 0

a) With reference to the worksheet “Details”, write down the formula in cell A2 in the worksheet “Chess”. Cells A2:

="ch"&Details!A2&IF(Details!B2<10,"0"&Details!B2,Details!B2)&Details!C2&

MOD(YEAR(Details!D2),100)&Details!E2

b) According to the worksheet “Reference”, 0 represents non-member and so on. With reference to the

worksheet “Reference”, finish the cells B2 in worksheet “Chess”. Cells B2:

=VLOOKUP(VALUE(RIGHT(A2,1)),reference!A$1:B$4,2)

c) Peter is planning to design a web base logon system, so, he has to generate a set of password for different

members. The password is set to have 4 digits, note that the password has to have 4 digits, so, “0717” should be shown instead of “717”. Finish the cells in C2 in worksheet “Chess”.

Cells C2:

=ROUND(RAND()*9,0)&ROUND(RAND()*9,0)&ROUND(RAND()*9,0)&

ROUND(RAND()*9,0)

d) Peter wants to do some statistics on the chess club, i.e. the cells F2 to F5 in worksheet “Chess”. Write

down the formula in cell F2 such that it can be copied to F3 to F5. Cells F2:

=COUNTIF(B$2:B$16,E2)

e) Peter wants to restrict users to input data only on the cells from E2 to G16 in the worksheet “Details”,

describe the procedures that allow him to do so.

Highlight the cells from E2 to G16, then, select cells option from the format menu and

unlock the cells. After that protect the worksheet. So, only those cells unlocked will

be allowed to input data.

Page 48: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

48

Medium Techniques 01 John is a researcher in ABC University, he helps the health center in the university to conduct a simulation of the BMI (Body Mass Index) of Hong Kong student and the students of mainland China.

The cells with gray background contain the information provided from health center and hence should not be changed. a) Describe two methods to create the list in column A in an efficient way.

(2 marks)

Method 1: Autofill

Method 2: At cell A2, enter the value 998001 and then at cell A3 enter the formula

“=A2+1”. Finally, copy the formula in A3 to A4 till A22.

b) For column B, the sexes of the students are randomly assigned. Write down a formula in cell B2 such that there is 50% of assigning a “M” and 50% of assigning a “F” to a student.

(1 mark)

IF(RAND()>0.5, “M”, “F”) OR IF(RAND()<0.5, “M”,”F”)

c) The column C is randomly generated according to the sex in column B. i.e. (i) If the student is a boy, his height will range from 150cm to 190cm (ii) If the student is a girl, her height will range from 140cm to 170cm Note, the data should be rounded off. What is the formula in cell C2? (2 marks)

=ROUND(IF(B2="M",RAND()*40+150,RAND()*30+140),0)

d) Cell J2 stores the average height of girls and cell J3 stores the average height of boys. (i) Write down the formula for cell J2 such that it can be copied to cell J3. (ii) How to set the cell such that the text will go to a new line if it is too long as it is in cell J1 and K1?

(4 marks)

(i) =SUMIF(B$2:B$22,B26,C$2:C$22)/COUNTIF(B$2:B$22,B26)

(ii) Wrap text

e) Column D will find the percentage difference of the students with respect to the average height according to their sexes. For example, student 998001, her height is 147 and the average height of girl

Page 49: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

49

is 152.36, so, the formula is:

%52.3%10036.152

36.152147−=×

Write down the formula in cell D2 such that it can be copied to D3 till D22. (2 marks)

=(C2/IF(B2="F",J$2,J$3)-1)

f) Column E are the data randomly generated by a formula.

(1+(percentage difference)×0.3×(randomly generated number) ×0.85×(average weight of girls) The formula can be illustrated by the following example:

For student 998001,

The weight is = 100)85.0number) generatedrandomly (3.0%)52.3(1(( ××××−+

Write down the formula in E2 such that it can be copied to E3 till E22. (2 marks)

=((1+D2)*RAND()*0.3+0.85)*VLOOKUP(B2,I$2:K$3,3)

g) Column F stores the BMI (Body Mass Index) of the student. BMI is calculated according to the following formula:

BMI = (m)Height

(kg)t Body Weigh2

BMI indicates that BMI < 18 Too Thin

18 ≤ BMI ≤ 23 Normal

BMI > 23 Too fat

The relation is presented in cells from I6 to K9. Write down the formula in cell F2 such that it can be copied from F3 to F22.

(2 marks)

=E2/2.2/(C2/100)^2

h) Write down the formula in cell G2 such that it can be copied to G3 till G22. (2 marks)

=VLOOKUP(F2,I$7:K$9,3)

i) Write down the formula in cell K12 such that it can be copied to K13 and K14. (1 mark)

=COUNTIF(G$2:G$22,J12)

Page 50: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

50

Advance Techniques 01 Peter is going to buy six books, they are Harry Potter, Rich Dad, The Da Vinci, Chicken Soup, Little Prince, The ring of the Lord. There are 4 bookstores that have stocks for those books, they are Tin Tin Book Store, Goodwill Book Store, Pink Lady Book Store, Bookworm Book Store. Because of their difference in prices and discount, Peter uses 3 spreadsheets to try to find out how to get those books with the lowest cost. Figure – 1 shows the worksheet “reference”, it provides the information of the price and discount of different bookstores. If the bookstore has no stock for the book, for example, Tin Tin Book Store has no “Harry Potter”, then, it will leave the cell blank. For example, if you buy “Harry Potter”, “Little Prince” from Pink Lady Book Store, the marked price would be ($128 + $60) = $188, however, for $188, the Pink Lady Book Store will give a 5% discount, so the cost would be:

Cost = ($128 + $60)*(1- 5%) = $178.6

Figure – 1

There are two schemes to find out how to buy the books with the lowest cost, the first one is in the worksheet scheme1.

Figure – 2

a) As shown in the figure, it will find out the lowest price among the 4 bookstores for each book. For example, there are 3 bookstores that provide “Harry Potter” and among these 3 bookstores, Bookworm bookstore provides the lowest cost, i.e. $125. Write down the formula for the cell B2 such that it can be copied to the rest of the cells in the range B2:E7.

=IF(reference!C2=MIN(reference!$C2:$F2),reference!C2,0)

b) Cells B9 to E9 are assigned to store the total marked price for each bookstore. Cells B11 to E11 is assigned to store the discounted price for each bookstore, write down the formula in cell B11 such that it can be copied to C11:E11.

=(1-VLOOKUP(B9,reference!$A$12:$F$15,COUNT(reference!$A12:C12)))*B9

c) Figure – 3 shows the scheme 2, for each book, it will randomly to choose a bookstore to buy, e.g. “Little Prince” from Pink Lady bookstore, “The Da Vinci” from Goodwill bookstore, etc.

Page 51: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

51

Figure – 3

(i) To achieve the above goal, we need to use column F to find out which shop would be the last shop provides that particular book among the 4 bookstores. For example, there are 2 bookstores that have the book “The Da Vinci” and Goodwill bookstore is the last shop that provides the book as shown in figure – 1. Write down the formula in cell F2.

=IF(reference!F2>0,reference!F$1,

IF(reference!E2>0,reference!E$1,

IF(reference!D2>0,reference!D$1,reference!C$1)))

After finishing the column F, in worksheet scheme2, cells B2 to E7 is supposed to randomly assign a value 0 or 1 to the cell. ‘1’ means buy the book and ‘0’ means do not buy the book. The policy of assigning ‘0’ or ‘1’ is as follows:

� If the bookstore has no stock for that book, assign a ‘0’ to the cell. � If the bookstore has stock for that book and it is not the last shop available for that book and that

book is not ordered at the previous bookstores, then, there is 50% possibility that it will assign ‘1’ and 50% for ‘0’ to that cell.

� If the bookstore is the last shop available for that book and that book is not ordered at the previous bookstores, then, it would be 100% assign ‘1’ to that cell.

(ii) Write down the formula in cell B2 such that it can be copied to cell B3 to B7. Remember the formula should fulfill the requirements shown in the above. For example, you need to check if “Tin Tin bookstore” is the last bookstore available or not.

=IF(reference!C2<>"",IF(F2<>B$1,IF(RAND()>0.5,1,0),1),0)

(iii) Write down the formula in cell C2 such that it can be copied to cell C3 to C7. Remember the formula should fulfill the requirements shown in the above. For example, you need to check if “Goodwill bookstore” is the last bookstore available or not if the book is ordered at the previous bookstore.

=IF(reference!D2<>"",IF(B2<>1,IF(C$1<>F2,IF(RAND()>0.5,1,0),1),0),0)

(iv) Write down the formula in cell D2 such that it can be copied to cell D3 to E7. Remember the formula should fulfill the requirements shown in the above. For example, you need to check if “Goodwill bookstore” is the last bookstore available or not if the book is ordered at the previous bookstore.

=IF(reference!E2<>"",IF(SUM(B2:C2)=0,IF(D$1<>F2,IF(RAND()>0.5,1,0),1),0),0)

Page 52: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

52

Quiz on Spreadsheet #1 ASCA - IA- 98 Question 18-20 refer to the following spreadsheet.

A 1 Name 2 Joan 3 David 4 Mary 5 Georgia 6 Cathy 7 Oscar 8 Tammy

In this spreadsheet, the formula FIND("a",A2,1) is stored in X4. 18. What value will be displayed in X4? A. 2 B. 3 C. 4 D. 5 E. 6 19. If the formula stored in X4 is copied to Y9, what formula will be stored in Y9? A. FIND("a", B7, 1) B. FIND("a", A7, 1) C. FIND("a", C7, 1) D. FIND("a", B6, 1) E. FIND("a", A6, 1) 20. If the formula stored in X4 is copied to the range X5..X10, which of the following cells will display the largest

value? A. X5 B. X6 C. X7 D. X8 E. X9 21. The formula PROPER("AbCDe") outputs the string A. AbcdE B. Abcde C. AbcDE D. ABcde E. AbCde 22. If the value 9600000000 is entered in a cell of width 9, what will be displayed in that cell? A. 9.6E+07 B. 9.7E+08 C. 9.6E+08 D. 9.6E+09 E. 9.7E+09 23. Suppose the formula SUM(A1..A5) is stored in E8. It is invalid to copy this formula from E8 to …. (1) D8 (2) G6 (3) F9 A. (1) only B. (2) only C. (1) and (2) only D. (2) and (3) only E. (1), (2) and (3)

<End of Quiz>

Quiz on Spreadsheet #2

Page 53: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

53

ASCA - IA- 97 18. Suppose A1, A2, A3 and A4 store the values 1, 2, 3 and 4 respectively. Which of the following formulae will

return the value 7? A. SUM(A1,A2,A3) B. SUM(A1,A2..A4) C. SUM(A1..A3,A4) D. SUM(A1..A2,A4) E. SUM(A2..A3,A4) 19. Suppose a cell of width 10 is formatted with percentage style and the value 12 is entered in it. Which of the

following will be displayed in this cell? A. 0.12% B. 1.2% C. 12% D. 120% E. 1200% 20. Some numerical values are stored in a worksheet as shown below:

A B C D E 1 3 2 1 3 2 1 125 140 4 2 150 135 5 3 175 123

If the following formula is entered in B1, what value will be displayed in B1? VLOOKUP(A2, $C$3..$E$5,3)*A3 A. 140 B. 50 C. 280 D. 300 E. 450 21. There will be a circular reference of A. A5 stores the formula 0.1*B4 and B4 stores the formula SUM(A1..A4). B. A3 stores the formula 0.1*B4 and B4 stores the formula SUM(A1..A2). C. A3 stores the formula 0.1*B4 and B4 stores the formula SUM(A4..A5). D. A1 stores the formula 0.1*B4 and B4 stores the formula SUM(A2..A4). E. A3 stores the formula 0.1*B4 and B4 stores the formula SUM(A1..A4). 22. Suppose B4 and B5 store the values 3 and 4 respectively and B2 stores the formula IF(C$5>$B4, 1, 2). If

the formula stored in B2 is copied to A3, then the value displayed in A3 will be A. 0 B. 1 C. 2 D. 3 E. 4 23. If C1 stores the label 'abc, then the formula UPPER(C1&"xyz") will return the string A. abcxyz B. ABCxyz C. ABC&xyz D. ABC&XYZ E. ABCXYZ

<End of Quiz>

Quiz on Spreadsheet #3 ASCA - IA- 96 18. Given that the formula +D3/D$4 is stored in C2. If this formula is copied to F5, then F5 will store the

formula A. +D3/D$4 B. +D3/G$4

Page 54: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

54

C. +G6/G$4 D. +G3/G$6 E. +G6/G$7 19. A student stores the formula SUM(B1..B8) in A1. He then moves the contents of B1 to B2(by dragging or

using MOVE command). The formula stored in A1 will become A. SUM(B2..B9) B. SUM(B2..B8) C. SUM(B1..B9) D. SUM(B1..B8) E. SUM(B1..B2) 20. Which of the following is invalid? A. COUNT(A1..A9) B. MAX(A1..A9) C. FIND(A1..A9) D. SUM(A1..A9) E. MIN(A1..A9) 21. Some labels are entered in a worksheet as shown below:

A B C D E 1 CAT DOG TIGER 2 CAT G30 3 DOG G50 4 TIGER G70

Suppose the formula IF($A2=C$1, $B2, “”) is entered in C2, and this formula is then copied to the rest of the cells in the range C2..E4. Which of the following displays of the result is correct? A.

A B C D E 1 CAT DOG TIGER 2 CAT G30 G30 3 DOG G50 G50 4 TIGER G70 G70

B.

A B C D E 1 CAT DOG TIGER 2 CAT G30 G30 3 DOG G50 G50 4 TIGER G70 G70

C.

A B C D E 1 CAT DOG TIGER 2 CAT G30 G30 3 DOG G50 G50 4 TIGER G70 G70

D.

A B C D E 1 CAT DOG TIGER 2 CAT G30 G30 3 DOG G50 G70 4 TIGER G70 G50

E.

A B C D E 1 CAT DOG TIGER 2 CAT G30 G30 3 DOG G50 G50 4 TIGER G70 G70

22. Suppose formula MIN(C2..C7) is stored in C1. It is valid to copy this formula from C1 to

Page 55: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

55

(1) C3 (2) C7 (3) C9

A. (1) only B. (2) only C. (3) only D. (1) and (2) only E. (1), (2) and (3) 23. The value returned by

ROUND(2/3, 1) A. 0 B. 0.6 C. 0.7 D. 1 E. 0.67

<End of Quiz>

Quiz on Spreadsheet #4 ASCA - IA- 95 18. Suppose A4 stores a string of length 8 and A5 stores the formula REPLACE(A4, 2, 3, “+2”). Then the string

displayed in A5 is of length A. 2 B. 6 C. 7 D. 8 E. 10 19. Suppose the formula +B4-B$5 is stored in A10. If this formula is copied to C11, the value displayed in C11

will be A. 0 B. 1 C. 2 D. 3 E. unable to be determined 20. Suppose C5 stores 5 and C7 stores the formula IF(C4>C5, 3, 2). If the value displayed in C7 is 3, which of

the following is a possible value in C4. A. 2 B. 3 C. 4 D. 5 E. 6 21. Data can be entered into a worksheet in the form of

(1) values (2) labels (3) formulae

A. (1) only B. (1) and (2) only C. (1) and (3) only D. (2) and (3) only E. (1), (2) and (3) 22. Which of the following cells is not a suitable location for storing the formula SUM(A2..G8)? A. A5 B. G9 C. C9 D. A10 E. B1

Page 56: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

56

23. Which of the following can be left unspecified when sorting data? A. data range B. sort order C. primary sort key D. secondary sort key E. All of the above must be specified

<End of Quiz>

Quiz on Spreadsheet #5 ASCA - IA- 94 18. ‘123 company’

If the above character string is entered when editing a worksheet, which of the following labels will be stored in the current cell?

A. 123 Company B. ‘123 Company C. 123 Company’ D. ‘123 Company’ E. syntax error 19. Suppose the formula at cell K1 is

+C$11 + SUM(D3..D8) what is the formula at cell K2 when the formula at cell K1 is copied to cell K2? A. +C$12 + SUM(D4..D9) B. +C$11 + SUM(D4..D9) C. +C$11 + SUM(D3..D8) D. +C$12 + SUM(D3..D8) E. +C$11 + SUM(D4..D9) 20. Cells A1, B1, C1 and C2 stores the values a, b, c and d respectively. A formula has been entered in cell J1

to evaluate b + c – a. If the formula at J1 is copied to cell K2, the resulting formula at K2 will evaluate the value 2d-a Which of the following is possible formula at cell J1?

A. +B1 + $C1-$A1 B. +B1 + C1-$A1 C. +B1 + $C1-A$1 D. +B1 + C1-$A$1 E. +B1 + $C1-$A$1 21. If cells E1 and E2 stores the values 2 and 3 respectively, then the value returned by the formula

=IF(E1>E2, +E1+E2, +1-E2) A. 2 B. 3 C. 5 D. 1 E. -1 22. Which of the following statements concerning macros is true?

A. A macro is made up of formula only B. A macro is a series o keystrokes including commands formulae.

C. An automatic macro contained in a worksheet will be executed each time you start using the spreadsheet program.

D. A macro cannot contain any branching statements. E. A macro is a non-interactive computer program.

23. In the above worksheet, values 10, 3, 2 and 5 are entered in cells B1,B2 and B4 respectively. If the formula A. replace the value in cell B1 with 0. B. replace the value in cell B2 with -2. C. replace the value in cell B3 with –3. D. replace the value in cell B4 with -5. E. replace the formula in cell B5 w

<End of Quiz>

Page 57: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

57

Sample TAS Question on Spreadsheet Time allowed : 1.5 hrs Name : For every print out, remember to include the question number and your id code. Part A (20 marks) After you finish Question 1 and 2, you should save it as q1.xls. 1. “bookdata.txt” stores the information of some books, the first column is the book code, the second

column is the title of the book and the third one is the marked price and the last column is the author. a) Open the workbook q1.xls and insert a new worksheet called “data”. b) Retrieve the “bookdata.txt”, and then add the titles (book code, title of the book, marked price and

author) to column A to D. c) Sort the data in ascending order according to the book code. Finally save it as spreadsheet format.

(This worksheet should appear in the workbook q1.xls and this worksheet should be called “data”) (4 marks)

2. In the worksheet “order”, fill cells in column B and C according to the information you got from the worksheet “data”. a) Print column A, B and C in both value format and formula format. b) Split the worksheet so that the top row and the book code are always able to be present no matter

it is scrolled up or down, left or right. c) If the number of books in stock is less than or equal to the number ordered, then, the bookshop

needs replenishment. The number of replenishment is according to the following relation:

Relation Number of replenishment Number of stock > Number of order 0 Number of stock = Number of order 1 Number of stock < Number of order *(Number of order - Number of stock)*1.25

*Noted that the number of replenishment should be rounded off. Complete Column G according to the above relation. (You have to use the function “IF”)

(5 marks) 3. There are six categories of books in this bookshop. They are: Children's Books, Religion &

Spirituality, Science, History, Arts & Photography and Literature & Fiction. The books can be categorized by the book code. The relations are as follows and it is saved in the worksheet “category”.

Initials of Book code Category A Children's Books B Religion & Spirituality C Science D History E Arts & Photography F Literature & Fiction

a) Fill the information in column F according to the relations above. b) In Column H, they are the marked price, and all the price of the books are according to the data in

the worksheet “data”. Since, the price it shows is in fact USD, you should change it into HKD. The ratio is 7.8. (i.e. 1 USD to 7.8 HKD) and you should round off (with the function “ROUND”) the marked price to 1 decimal place.

c) Add a new worksheet called “best_seller” and format it like the one below. Then fill the data in the column Title and Author. The criteria to determine best seller is according to the book ordered, the one with the greatest order in that category is the best seller of that category.

Category Title Author

Children's Books

Religion & Spirituality

Science

History

Arts & Photography

Best

Selle

r

Literature & Fiction

d) Use a suitable chart to make a comparison between the best sellers in different categories.

Page 58: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

58

(7 marks) 4. Create a workbook named “macro” and then create a macro called “macro1” in it. The macro will do the

following operation. i) Insert a new worksheet and in it enter the following title “Name”, “Age” and “Sex” in cells A1, B1

and C1. ii) Fill the first row with yellow color. Assign the hot–key “Crtl+A” to the macro1 and print out the macro1.

(4 marks) <End of Section A>

Part B(20 marks) Complete the following task. 5. A club in school wants to hold some activities. The school policies are follows:

• Each activity should not be less than 15 students. • One teacher can take care 20 students at most. i.e. if an activity has 48 students to participate,

there are at least 3 teachers. • The school can sponsor $500 for an activity at most if number of students is below 40 and $1000

for an activity if the number of students is more than 40. Mr. Wong is going to hold a camping in Sai Kung next month for 3 days and 2 nights. Apart from him, there are 3 more teachers can be available to participate in this camping if needed. Below is the information about the camping. a) Everybody in the camp should pay $130 for 3 days and 2 nights. b) Teachers are supposed not to pay any charge for the camping.

c) $500 should be used for the preparation and materials for the camping. d) There are four activities planned as below:

Activity Nature Sound System 1 Indoor Required 2 Outdoor Required 3 Outdoor Not required 4 Indoor Required

The campsite provides some places for Mr. Wong to select. There are 3 places for indoor activities and 2 places for outdoor activities according to the number of people involved. Their relations are as followed.

persons allowed Places Nature

Min. Max.

Sound System Charge

A Indoor 15 35 Provided $250 B Indoor 36 60 Not provided $350 C Indoor 61 100 Provided $580 D Outdoor 15 72 Provided $160 E Outdoor 73 140 Not provided $300

Note: 1. If the places (like B, C) do not provide Sound System, Mr. Wong can rent it from some

sound system companies. The charge is $250 for 3 days. 2. Any places can be booked more than once.

e) Recently, the campsite is promoting its services. It offers some discounts. No. of people (N) Discount

N < 30 5%

30 ≤ N < 45 10%

45 ≤ N < 60 15%

60 ≤ N 20%

e.g. If there are 60 peoples (students + teachers) and total charge is $7,800. After the discount, the final charge is $7,800*0.8 = $6,240.

Finish the following tasks.

i) Create a worksheet called "relation" which look likes: Stu_Num Tea_Num Total_person

Page 59: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

59

… … …

19 1 20

20 1 21

21 2 23

22 2 24

… … …

Note : Stu_Num is the number of student and Tea_Num is the number of teachers required and Total_person is the sum of Stu_Num and Tea_Num. In this worksheet, it should contain all the possible number of students.

ii) In the same workbook, create another worksheet called "ref" and in it create a lookup table for indoor activities, the lookup table should contain the information of its number of people allowed, its charge and if it provided sound system. Name this range as "indoor". Then create another lookup table for outdoor activities and name it as "outdoor".

iii) Making use of the lookup tables, in the worksheet "relation", find the cost of each activities

according to the number of persons (Note: you need not to consider the sound system here).

iv) Since some activities need sound system, so, if all the venues booked provide the sound system, Mr. Wong need not to rent. If not, then Mr. Wong needs to rent the sound system. In the worksheet "relation", create a column "Sound System" which will show $250 if Mr. Wong needs to rent, $0 otherwise.

v) Since the lower the prices, the more popular it will be. Therefore, calculate the cost of each

student has to pay according to the number of people involved. Also, fill the cells in yellow color if it is below $120. (Noted the items like discount, the cost for the preparation for the camp, etc.)

vi) Find the minimum charge (namely C) of the students and its corresponding number of participants

(namely N, exclude the teachers). And the whole row into red color. vii) Now, fortunately, there are N students participate in this activity, use some charts to show the

distribution of money spent on. The following points should be noted. 1. Clearly give title or label for every item in your worksheets. 2. Print the worksheets involved. 3. Print out the charts. 4. Save the workbook as “camping”. Marks will be given for suitable design and appropriate layout of the worksheet and the chart.

(20 marks) <End of Paper>

Past Papers & Conventional Questions 1. Mr. Leung is a Mathematics teacher, he is trying to use IT in education. He chooses to use Excel to demonstrate the formula

“Amount = Principal × (1 + rate%)no. of term

” He thinks the worksheet should be presented exactly the same as the table below. A B C D E F

1

2 No. of terms Capitals Interest Balance rate

3 1 10000.00 500.00 10500.00 5%

4 2 10500.00 525.00 11025.00

5 3 11025.00 551.25 11576.25

6 4 11576.25 578.81 12155.06

7 5 12155.06 607.75 12762.82

8 6 12762.82 638.14 13400.96

Page 60: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

60

9 7 13400.96 670.05 14071.00

10 8 14071.00 703.55 14774.55 =10000*(1+5%)^8

11 However, when he try to enter “=10000*(1+5%)^8” into E10, this cell does not give “=10000*(1+5%)^8” but “14774.55”. Therefore, Mr. Leung is confused. Is this phenomenon rare? What would you explain to Mr. Leung? Suggest two different methods that can solve his problem?

(8 marks) 2. Mary is an account clerk in a company. She prepared this month balance sheet (as shown in below). A B C D E

1 Date Income Expense Balance

2 12/8 $ 30,000 $ 4,000 $ 26,000

3 12/10 $ 60,000 $ 75,000 $ 11,000

4 12/13 $ 5,000 $ 23,000 -$ 7,000

5 12/17 $ 78,000 $ 22,000 $ 49,000

6 12/18 $ 68,000 $ 36,000 $ 81,000

7 12/22 $ 92,000 $ 15,000 $ 158,000

8 12/27 $ 69,000 $ 50,000 $ 177,000

9 12/28 $ 71,000 $ 42,000 $ 206,000

10 12/31 $ 59,000 $ 135,000 $ 130,000

11

12 Bank Balance

13 Previous Month $ 384,256

14 This Month

15

a) In cell D2, the formula “=B2−C2” is entered, Write down the formula in cell D3? b) The value in cell D13 is copied from the last month balance sheet, so it is surely correct. In cell D14,

the formula “=D13+D10” is entered. However, her boss told her that this balance sheet has something wrong. Explain how her boss can detect this mistake?

c) After correcting the mistake, her boss told her that this balance sheet has redundancy and hence can be simplified. Is her boss right? If so, what is the redundancy?

(8 marks) 3. Miss Wong is an English teacher. She teaches S.2 English in 3 different classes in the same form, say S2A, S2B and S2C. She chooses to use Excel to calculate the marks of the students. Also, she would like to do some statistics to compare the marks of the students. The following is a sample of her excel file, A B C D E F G

1 Class No. Name Test1 Test2 Test3 Exam Total Mark

2 1 Chan Tai Man 65 26 33 111

3 2 Cheng Shing Kung 82 45 56 165

4 3 I Siu Hang 61 40 50 153

… … … … … … …

40 39 Tang Keung 45 28 30 123

41 40 Wong Sam 52 21 18 68

Page 61: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

61

42

43 Full Marks 100 50 60 200 200

44 Weight 10% 20% 20% 50%

45 Fail No.

46

47 Average Marks C44 to F44 is the cells to store the weight of the total marks, i.e. Test1 weight 10% to the total marks and Test2 weight 20% and so on. Moreover, as illustrated in C43 to F43, every test or exam may have different full marks. The full marks for the total mark is 200(as shown in G43). a). Suggest three special features of Excel which would attract Miss Wong to choose to simplify her work.

(3 marks)

b) Originally, Miss Wong stores the data of her 3 different classes in 3 different files, say s2a.xls, s2b.xls and s2c.xls. What is the advantage and disadvantage of this storing method? What would you suggest to Miss Wong to improve the storing method?

(4 marks) c) Write down the formula in C47.

(2 marks) d) Write down the formula in G2, which is easy to be copied and pasted to G3 to G41.

(2 marks) e) Cells C45 to G45 are the number of failed students(Passing mark is half of the full marks). Write

down the formula in G45. Miss Wong wants to use graph to show these “Failed No.” in tests and exam (including Total Marks), what kinds of charts will you suggest? Describe the procedures clearly. (The graph should be suitably labeled.)

(5 marks) f) Miss Wong likes to identify the failed students in a easy way, therefore, she designs the spreadsheet

so that if the total mark is below 100, the marks will be shown in red color. What is that feature? Describe the procedure of getting it work.

(5 marks) g) Miss Wong is required to submit the marks (in soft copy format) to the school, however, she wants to

ensure that nobody except her is able to change any data in the file, what should be done? Describe briefly.

(2 marks) h) In fact, Miss Wong wants to classify her students into five groups depending on their “Total Mark”. i.e.

Group A Total Mark > 85 Group B 85 ≥ Total Mark > 70 Group C 70 ≥ Total Mark > 55 Group D 55 ≥ Total Mark > 40 Group E 40 ≥ Total Mark

She guesses the function “countif” may be able to achieve this goal, is she correct? If so, write down the formula in G48(to store number of group A student) and G49(to store the number of group B students).

(2 marks) 4. Peter is a laboratory technician who is responsible to test the performance of 3 different digital

cameras. Say, Brand A, Brand B and Brand C. He uses a spreadsheet to store the information. The spreadsheet was shown in below: There are 22 features under testing, from auto-focus to zoom. The marks are given such that 1 the highest and 5 is the lowest, 0 implies that the camera has no such feature (e.g. auto-focus for Brand A).

A B C D E

1 Brand A Brand B Brand C Minimum

Page 62: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

62

2 Auto-Focus 0 3 4

3 Battery 3 4 3

4 Color Accuracy 5 2 3

5 Data Transmission 3 2 2

6 Flashing light 3 3 2

7 LCD Monitor 3 5 5

8 Menu 2 3 1

9 Movie clip 0 3 1

10 Port 1 0 0

11 Price 2 2 2

12 Quality 4 1 5

13 RAM 0 2 4

14 Resolution 2 2 4

15 Sharpness 4 2 4

16 Size 5 1 3

17 Software 0 4 0

18 Sound 2 3 2

19 Special Effect 0 1 2

20 Storage Media 4 3 4

21 User-Friendly 3 4 4

22 Weight 2 3 3

23 Zoom 5 2 2 a) Column E is used to store the minimum value (exclude the value 0) of each feature, e.g. E16 will store

the lowest mark in size and it is 1. But, when it is the case in E2, the value should be 3 rather than 0. To achieve this goal, write down the formulae in E2.

(2 marks) b) If there are two zeros in a feature, we will choose the value not equal to 0. (e.g. in the E17, the value

would be 4) Write down the amended formulae in E2. (2 marks)

5. Peter is a discipline teacher responsible for the whole form 3 classes. He designs two spreadsheets so

that he can keep all the records of his students. The figures below are the spreadsheets he designed. Figure 8-1 and figure 8-2 are stored in the same workbook. Figure 8-1 is in the worksheet called “record” and figure 8-2 is in the worksheet called “ref”. The worksheet record is used to store the data like who are late for school on which date. The worksheet ref is used to store the personal data of the form 3 students. (The data range in figure 8-2 is named as reference.)

Figure 8 - 1 A B C D E F G H

1 Record_no Date Stud_id Name Class Occurrence

2 1001 2002/5/3 98003 3A

3 1002 2001/10/23 98012 3B

4 1003 2002/1/31 98002 3C

5 1004 2002/3/12 98008 3D

6 1005 2001/9/19 98004 3E

7 1006 2001/12/2 98012

8 1007 2002/2/11 98013 Max_occ

9 1008 2002/1/31 98004 Min_occ

10 1009 2002/4/20 98004 Max_class

11 Min_class

Figure 8 - 2 A B C D E F

1 Stud_id Name Sex Class Class_no

2 98001 Chan Tai Man M 3A 1

Page 63: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

63

3 98002 Wong Siu Yung M 3D 3

4 98003 Tang Chi Ping M 3E 2

5 98004 Tam Mei Ling F 3B 5

6 98005 Chu Chiu Ting F 3B 12

7 98006 Lau Ching M 3A 14

8 98007 Cheung Yan F 3C 26

9 98008 Cheng Wing F 3C 22

… … … … … …

… … … … … …

200 98239 Chen Sze F 3A 33 a) As shown in figure 8-1, Peter had already inputted the stud_id (student id), he hopes the fields Name

and Class can be filled by a single formulae (with the reference of figure 8-2), what is the formulae in cell D2 and E3?

(3 marks) b) According to past records, in a whole year, there must be less than 1000 lateness recorded in form 3.

And this spreadsheet will store the data of form 3 students only (3A to 3E five classes). Peter wants to use column G to store the total occurrence of each class, e.g. G2 is for 3A, G3 for 3B and so on. Write down the formulae in G2.

(2 marks) c) G8 is used to store the maximum number of occurrence in these five classes. G9 is used to store the

minimum number of occurrence. Write down the formula in G8 and G9. (2 marks)

d) G10 is used to store the class name of which its occurrence is the maximum and G11 is used to store the class name of which it’s occurrence is the minimum. To achieve this, Peter writes down the formulae in G10 and G11 as follows, G10: vlookup(G8,G2:H6,2,0), G11: vlookup(G9, G2:H6,2,0). However, these formulae may not completely fulfill Peter’s requirement, why?

(2 marks) e) If Peter wants to arrange the data (form column A to E) in figure 8-1 according to the ascending order

of the date and the name (Arrange the data first according to the date, and if the date are the same, the one with prior alphabetical order will be arranged first.) What features of spreadsheet software can be helpful? Briefly describe the procedure to achieve this.

(5 marks) f) Peter wants to use charts to present the data in the spreadsheet, describe the whole process to

achieve this goal. (5 marks)

ASCA 96 #2 (a) A what-if analysis is an evaluation in which certain values are changed in order to reveal the effects of

those changes on decision-making. (i) Give an example of a what-if analysis in daily life. (ii) Give two reasons why it is more suitable to use a spreadsheet program instead of a database

management system for carrying out a what-if analysis.

(b) (i) What is the purpose of using a spreadsheet macro? (ii) Some spreadsheet packages provide a macro recorder feature for creating spreadsheet

macros automatically, i.e. the sequence of keystrokes made by the user can be recorded and stored automatically as a spreadsheet macro. However, not all spreadsheet macros can be created by the macro recorder. Name two types of operations which the macro recorder is unable to capture.

ASCA – 97 #2

Page 64: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

64

Mrs Fung is a private tutor of Mary, John, Jane, Lucy and David. Mrs Fung teaches them English, Mathematics and Chinese.

Mrs Fung prepares the following spreadsheet model to show the number of assignments given to each student in each subject.

A B C D E 1 English Maths Chinese Total 2 Mary 3 John 4 Jane 5 Lucy 6 David 7 Total

Formulae for the total number of assignments given to each student and the total number of assignments of each subject are stored in column E and row 7 respectively. A formula which calculates the total number of assignments for all subjects is stored in cell E7. (a) Write down the formula that should be entered in

(i) cell E2; (ii) cell E7.

(b) Design a cross-checking mechanism for this model (i.e. as soon as all values are entered, the model is able to indicate whether there are any errors in the formulae). Explain how the cross-checking mechanism works.

(c) Mrs Fung wants to avoid accidental overwriting of the formulae in the model while entering values. Suggest what Mrs Fung should do besides entering values with more care.

(d) Explain why it is more difficult to locate an error in a spreadsheet model than to locate an error in a database program.

ASCA - 98 2. Miss Lau stores students’ marks (ranged from 0 to 100) in a spreadsheet as follows :

A B C 1 Name Mark Grade 2 Mary 80 3 John 53 4 Jane 21 5 Lucy 75 6 David 43 7 … …

Miss Lau enters formulae in column C so that the spreadsheet is able to calculate for her the grades according to the marks. Miss Lau enters the following nested-if formula in C2 and copies it to the other cells in column C: IF (B2 < 40, “F”, IF(B2< 60,”C”, IF(B2 < 75, “B”, “A’)))

(a) Write down all possible grades. Also write down the mark range for each grade. (b) Miss Lau wants to replace the nested-if formulae in column C with formulae which refer to a lookup

table. In order to do so, she stores the grades and their respective lowest marks in column G and F respectively in ascending order of the marks as follows:

F G … 29 Lowest Mark Grade 30 0 F 31 … … 32 … … 33 … …

Write down the formula that Miss Lau should enter in C2 so that the spreadsheet will find the grades using a lookup table instead of nested-ifs.

(c) (i) Give two advantages of using lookup tables instead of nested-if formulae.

(ii) Give one other real-life application of spreadsheets in which the use of lookup tables is helpful.

Page 65: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

65

ASCA – 2002#8 In a common spreadsheet software package, SHEETA!A2:H9 refers to the cells, ranging from A2 to H9, on the worksheet named SHEETA. ABC Company sells different kinds of stationery (ball pens, pencils and A4 files) to school teachers. The following worksheet PRICE is used to record the unit price of each type of stationery. A B C D E F G

1 Quantity Unit Price ($)

2 From To Discount

Ball pen Pencil A4 file

3 0 4 0%

4 5 9 10%

5 10 19 20%

6 20 more than 20 40%

7 The unit price of ball pens, pencils and A4 files have been entered into cells D3, E3 and F3 respectively. For each teacher, the company offers a discount on each type of stationery as follows:

10% off the unit price if the quantity ordered is 5 to 9; 20% off the unit price if the quantity ordered is 10 to 19; 40% off the unit price if the quantity ordered is 20 or more.

The discount rates have been entered into cells C3 to C6. (a) In order to complete the worksheet PRICE, a formula is entered into cell D4. The formula is then copied into cells D5 to D6, and E4 to F6. (i) Write down the formula stored in cell D4. (ii) Write down the formula stored in cell F6.

(4 marks) All the orders are entered into another worksheet ORDER as shown below.

Cells C2:C101, E2:E101 and G2:G101 show the quantities ordered by ‘Teacher 1’, ‘Teacher 2’, …, ‘Teacher 100’ respectively, with the cell left blank if the quantity ordered is zero. In order to calculate the amount each

Page 66: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

66

teacher should pay for each kind of stationery, three formulae are entered into cells D2, F2 and H2. The three formulae are then copied into cells D3 to D101, F3 to F101 and H3 to H101 respectively. (b) By using the function VLOOKUP, or otherwise, write down the formulae stored in cells D2 and H101.

(6 marks) (c) `In order to calculate the total amount that should be paid by each teacher, a formula is entered into

cell I2 of the worksheet ORDER. The formula is then copied into cells I3 to I101. Write down the formula stored in cell I45.

(1 mark) (d) Write down a formula that should be entered into cell C103 in order to find out the number of teachers

who have ordered ball pens. (2 marks)

(e) On the worksheet ORDER, school codes for teachers have been entered into cells B2 to B101. Each school code is a string which consists of a character ‘A’ or ‘B’ and a 3-digit number, where ‘A’ and ‘B’ denote two different types of schools.

(i) A formula is entered into the cell J2 which will assign the cell J2 value 1 if the teacher is of the same school type entered in the cell J1 or assign the value 0 otherwise. The formula is then copied into cells J3 to J101. Write down the formula stored in cell J3.

(ii) The manager of ABC Company, Mr. Chan, wants to calculate the total amount to be collected from each type of school by entering either ‘A’ or ‘B’ in cell J1. He wants to display the value in cell K103. Describe how he can complete this task by using cells J2:K101.

(iii) Describe how Mr. Chan can complete the task in (e)(ii) without using cells J2:J101. (7 marks)

ASCA – 2000 #6 6. The following worksheet shows the quarterly income and expenditure of a company:

A formula, B2-C2-D2-B8, is entered in cell E2 to calculate the quarterly profit of the company. Copy the formula to other cells in column E to calculate the profits for the other three quarters. Another formula, B9*SUM(E2:E5) is entered in cell E9 to calculate the profit share of Director A for the year. Copy the formula to cells E10 and E11 to calculate the profit share of Directors B and C. After all formulas have been entered and copied to the appropriate cells, the figures showing the profits for the 2nd, 3rd, 4th quarters and the profit share of Directors B and C are wrong. There must be errors in the formulas in cells E2 and E9. Identify the errors and suggest appropriate corrections to the worksheet.

(4 marks)

ASCA – 2000#11 11. A company sells different blends of tea (Supreme, High Q, Ordinary and Low) by mixing ingredients, X, Y

and Z, in certain ratios. These blends and the ratios are recorded on the following worksheet.

Page 67: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

67

a) Mr. Wong, the company’s manager, wants to use the worksheet to display the cost of the different blends

of tea. A formula is entered into cell E3 and then copied to cells E4 to E6. The cost is calculated as follows:

Write the formula that should be entered in cell E3.

(2 marks)

b) The quantity sold for Supreme, High Q, Ordinary, and Low is 20 kg, 20 kg, 35kg and 50 kg respectively. A decimal number is entered in cell B9 to denote the profit rate of tea. The price is calculated by multiplying the cost by (1 + profit rate). The total profit of tea is recorded in cell B10. Write the formula that should be entered in cell G3, and cell B10.

c) Mr. Wong likes to show the costs of different blends of tea by using charts. Describe the steps that he has to follow to create the appropriate charts.

(4 marks)

d) Mr. Wong needs to enter a formula in cell B10 to calculate the total profit. Suggest measures that he could use to verify the accuracy of total profit.

(4 marks)

ASCA 2001#12 12. Peter is going to determine the selling price of shirts. He uses the following spreadsheet to compare the

profits for the two different selling prices, $60 and $70.

Page 68: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

68

The cost of the first shirt is $54 and the cost of the rest of the shirts varies according to the formulas in column B.

a) To calculate the cost of the second shirt, Peter enters =IF(B2>30, B2-3, 30) in cell B3. He then copies the formula into B4 through B16 to find the cost of the 3rd to the 15th shirts. (i) Write the formula stored in B4. (ii) What is the value displayed in B4? (iii) What is the minimum unit cost among different quantities of shirts?

(6 marks)

b) Peter enters the formula =SUM(B$2:B2) into cell C2. He then copies the formula from C2 into C3 through C16. (i) What is the value displayed in C3? (ii) What does the value in C16 represent?

(4 marks)

c) The values 60 and 70 in cell D18, and E18 represent 2 different proposed selling prices. Peter enters the formula =$D$18-B2 in D2 and =D2+$D$18-B3 in D3 respectively. He then copies the formula from D3 into D4 through D16. (i) Write the value that would be displayed in cell D3. (ii) What does the value in D16 represent?

(4 marks)

d) The values in column D are calculated with a unit selling price of $60. Peter wants to see how the values change if the unit selling price is $70. In order to compare the values, he keeps the original values in column D and calculates the corresponding new values in column E. He copies the formula from D2 to D16 into E2 to E16 respectively. (i) Write the formula that is stored in E2 after Peter makes the copy. However, Peter does not get the correct values in column E since the formulas stored there are not as

Page 69: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

69

expected. Peter realizes that if he insists on using the same procedure to complete the calculations, the two formulas in D2 and D3 must be modified. (ii) Write the formula that should be entered in D2. (iii) Write the formula that should be entered in D3.

(6 marks)

2003 #9 9. ABC Secondary School is a private school and is required to dismiss some staff in the coming year. The

Principal, Mr. Tao, uses a spreadsheet to investigate various possibilities.

In his first attempt, Mr. Tao decides to manually select the redundant staff as shown in the above spreadsheet PAY. The cells D3:D28 contain logical values which represent his decision. A logical value, TRUE, means that the staff will be dismissed and the expected monthly salary payment will become $0, while a logical value, FALSE, means that the staff will be retained and the expected monthly salary payment will be the same as the current salary. (a) A formula is entered into cell H3 and is copied to other cells in column H to calculate the expected

monthly salary payment for the staff. Write down the formula in cell H3. (2 marks)

The redundancy payment is calculated according to the years of service and the current salary of the dismissed staff. If a member of the staff serves the school for less than 4 years, the redundancy payment will be the current salary multiplied by the corresponding factor in the column M according to his or her salary point. For example, Chirs’s current salary point is 2 and he has served the school for 3 years. Then,

Redundancy Payment = $7,215 × 1.96 = $14,141.4 If a member of the staff serves the school for 4 or more years, the redundancy payment will be the current salary multiplied by the years of service and the corresponding factor in column N according to his or her salary point. For example, Ada’s current salary point is 8 and she has served the school for 15 years. Then,

Redundancy Payment = $40,785 × 15 × 0.51 = 312,005.25 (b) A formula is entered into cell I3 and is copied to other cells in column I to calculate the redundancy

payment. Write down the formula in cell I3. (5 marks)

In his second attempt, he generates sets of random data to simulate several different scenarios after staff dismissal as shown in the following spreadsheet RAN:

Page 70: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

70

(c) A formula is entered into cell C3 and then copied into cells C4 to C10 to count the current number of the

staff. Write down the formula in cell C3. (Hint: use the spreadsheet PAY)

(3 marks) For each subject, the number of the staff randomly selected is bounded inclusively by the current number of the staff and the minimum number of staff required. He also understands that the total number of the staff should not be more than 20.

(d) (i) A formula ‘=sum(E3:E10)’ is entered into cell E11 before data are entered into the cells E3 to E10. Will this action cause any error in the cell E11? Justify your answer. (ii) A formula is entered into cell E3 and then copied cells E4 to E10 to generate the Random Data Set #1. If the total number of the staff generated exceeds 20, Mr. Tao will generate Random Data Set #2 by copying the formula in cells E3 to E11 into cells F3 to F11. If necessary, Mr. Tao will repeat the generation for Random Data Sets #3, #4, #5, … Write down the formula in cell E3.

(5 marks) (e) Mr. Tao observes that the random values stored in cells E3 to E10 will change whenever he edits the

spreadsheet RAN. Explain why this happens and suggest one method to preserve these values on this spreadsheet.

(2 marks) (f) Mr. Tao wants to present the composition of the Random Data Set #1 to the retained staff using a Pie

Chart. Describe the essential steps needed to produce this Pie Chart. (3 marks)

2004#8 8. In a common spreadsheet package, SHEETA!A1:C4 refers to the cells, ranging from A1 to C4 on the

worksheet named SHEETA. Ms. Wong is an English teacher, and wants to give a final grade for each student at the end of the academic year. There are totally 8 composition exercises given to students within the academic year. Each exercise is given a mark ranging from 0 to 100, and the passing mark is 40. She uses the following worksheet MARK to record the marks of the 8 exercises for each student:

Page 71: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

71

There are two methods to calculate the average mark:

� For method 1, the average mark (AM 1) of a student is the average of the 8 exercise marks. � For method 2, the average mark (AM2) of a student is the average of the 6 exercise marks, excluding

the highest and lowest exercise marks among the 8 exercise marks. The greater one of AM 1 and AM2 is taken to be the final mark of a student. Take Mary (the first student) as an example:

AM1 = (40+60+63+56+34+61+45+70) ÷ 8 = 53.6 AM2 = (40+60+63+56+61+45) ÷ 6 = 54.2 The highest mark (70) and the lowest mark (34) are both excluded. Hence, the final mark is 54.2. Three formulae are entered into cells J3, K3 and L3 to calculate the corresponding AM1, AM2 and final mark respectively (all correct to 1 decimal place). The three formulae are then copied into cells J4 to J41, K4 to K41, and L4 to L41 respectively. (a) Write the formulae in the following cells:

(i) J3 (ii) K3 (iii) L3

(5 marks)

Furthermore, in order to find the total number of exercises that each student passed (the passing mark is 40), a formula is entered into cell M3, and then copied into cells M4 to M41. (b) What is the formula in cell M3?

(2 marks) On the other hand, Ms. Wong creates another worksheet GRADE in the same workbook as shown below:

(c) Ms. Wong wants to display the final mark and the total number of exercises passed in columns B and C

respectively in worksheet GRADE. (i) She enters a formula into cell B3 and copies it into cell C3 in worksheet GRADE. Then formulae

in cells B3 and C3 are copied into cells B4 to B41 and C4 to C41 respectively. Write the formulae in cells B3 and C3.

Page 72: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

72

(ii) Besides the method in (c)(i), she can only use ‘copy and paste' to complete this task as well. Describe how she can do this task.

(4 marks) She correctly enters a formula in cell B44 to find the overall average mark.

The final grade (A, B, C or D) for each student on worksheet GRADE is decided by certain criteria. Ms. Wong initially sets the criteria as shown in the following table:

(d) Ms. Wong enters a formula into cell D3 and then copies it into cells D4 to D41 to assign final grades to

her students. What is the formula in cell D3? (3 marks)

(e) Ms. Wong has good knowledge of both spreadsheet and database packages which have been provided by the school. However, she chooses to use a spreadsheet package to complete this task. Give two reasons to support her choice.

(2 marks) (f) Ms. Wong would like to check whether the final marks of any two students are equal in column B. She

wants cell E43 to display the check result: ‘YES' or ‘NO'. Describe how she can do so. (4 marks)

2005#9 9. In a school photo competition, mere are participants from four different houses (A, B, C and D). Each of

7 judges gives a score to each photo ranging from 0 to 10 inclusively. The scores are correct to 1 decimal place.

The following worksheet SCORE records the scores given to participants:

The final score is calculated by adding the 3

rd, 4

th and 5* highest marks for each participant. For example,

the scores of Participant 1 are 8.3, 8.2, 8.1, 3.1, 2.9, 2.8 and 2.2 . The 3

rd highest mark is 8.1 .

The 4th highest mark is 3.1 .

The 5th highest mark is 2.9 .

The final score of Participant 1 = 8.1 + 3.1 + 2.9 = 14.1

Page 73: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

73

The rank is assigned according to the final score in descending order (i.e. Rank 1 represents the highest final score.). House total is calculated by adding the ranks of all participants who are the members of that house. House average is correct to 2 decimal places and is calculated by

Cells B44 to B47 store the house totals. Cells C44 to C47 store the numbers of participants of house. Cells D44 to D47 store the house averages. Among the tour houses, the house average of the house winner should be the minimum (there may be more than one winner). The name of the house winner will appear in cell K43. (a) The formulae are entered into K2 and L2 to find the final score and rank of Participant 1 respectively.

They are then copied into K.3 to K41 and L3 to L41 respectively. (i) Write the formula in K3. (ii) Write the formula in L3. (b) Formulae are entered into B44 and C44 to find the house total and number of participants for House A

respectively. Both formulae are then copied into B45 to B47 and C45 to C47 respectively. (i) Write the formula in B45. (ii) Write the formula in C45. (c) A formula is entered into D44 to find the house average for House A correct to 2 decimal places. It is

then copied into D45 to D47. Write the formula in D45. (d) The name(s) of the house winner(s) should be displayed in K43. Describe, with formula(e) how to do so. (e) Rows 1 to 41 are copied to another worksheet. The worksheet should then be sorted according following criteria:

1st priority: House (Column C) in ascending order 2nd priority: Sex (Column B) with 'F' first 3rd priority; Final Score (Column K) in ascending order

However, the spreadsheet software can sort the worksheet with only two priorities at the same time. Describe, with steps, how to sort the worksheet twice to get the above result. (f) It is required to display only the information of the participants for House A, with their ranks between 5

and 30 inclusively, in the worksheet SCORE as shown below. Describe, with steps, how to do so.

1 Answer to Past Paper and Conventional Questions 98 CA MC

18 19 20 21 22 23

Page 74: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

74

B A C B D C 97 CA MC

18 19 20 21 22 23 D C C E C E

96 CA MC 18 19 20 21 22 23 C B C B E C

95 CA MC 18 19 20 21 22 23 Out A E E A D

94 CA MC 18 19 20 21 22 23 C B E E Out out

1. This phenomenon is not rare but normal.

Because in Excel, data are stored in several formats, i.e. numbers,

text and formula. Mr. Leung enter “=10000*(1+5%)^8”, in Excel all formula are initialized by “=”,so it will regard it as a formula but not a text and hence calculate the value of this formula and give “14774.55”.

To avoid this, we can

(i) Change the formula into a text, all we have to do is to add an apostrophe before the sign “=”, i.e. “’=10000*(1+5%)^8”, and then, Excel will regard it as a text but not a formula.

(ii) In Excel, choose the view option and select “Formula” in the windows option. And hence, Excel will show the formula but not the value.

1 mark 1 mark 1 mark 1 mark 2 marks 2 marks

2. a) =D2+B3−C3 or D2+B3−C3 2 marks

b) Because her boss checks the balance from the bankbook, currently, the balance is not the same as this balance sheet. If everything is correct, there should not be any difference.

3 marks

c) Her boss is right. The column D i.e. Balance is redundant!

1 mark 2 marks

3. a) Excel can:

Set formula for trivial calculation Auto-renew calculation Show data in graphics easily Reusability Electronic sheet (Environmental Protection)

Any three or other reasonable answers. @ 1 marks

b) Suggestion : Put all three worksheet into one workbook. And every time

she finish the work, save an extra backup file. Advantage of original method: If a file is damaged, the other two will not be affected. Disadvantage of original method: Time consuming, need to open three files three times

1 mark 1 mark 1 mark 1 mark

c) =average(C2:C41) 2 marks

Page 75: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

75

d) =C2/C$43*G$43*C$44+ D2/D$43*G$43*D$44+ E2/E$43*G$43*E$44+ F2/F$43*G$43*F$44

OR =C2/C$43*200*C$44+ D2/D$43*200*D$44+ E2/E$43*200*E$44+

F2/F$43*200*F$44

2 marks

e) In G45, the formula is “=countif(G2:G41,”<100”)

Or “=200-countif(G2:G41,”>=100”)” Column chart, bar chart or line chart Procedures :

1. At the same time, select name (i.e. C1 to G1) and 2. select the failed number (i.e. C45 to G45) 3. Press chart wizard icon 4. select the type of chart, say column chart 5. Give the graph title and show the legends

1 mark 1 mark Clearly described 3 marks.

f) She can use the feature “Conditional Formatting”. It allows us to set

the conditions so that the data will be presented according to that condition.

Procedures :

1. Select the range, i.e. from G2 to G41 2. Select conditional formatting 3. Set condition be “less than 100” and “greater than 0”

2 marks All 3 steps required @ 1 mark

g) When she save the file, in save option, save it with the option that

needs a password to modify. 1 mark 1 mark

h) Yes, countif can work.

In G48, formula is “=countif(G2:G41,”>85”) In G49, formula should be “=countif(G2:G41,”>70”)-G48” OR “=countif(G2:G41,”>70)-countif(G2:G41,”>85”)

1 mark 1 mark

4(a) =IF(AND(B2<>0,C2<>0,D2<>0),MIN(B2:D2),SUM(B2:D2)-MAX(B2:D2)) If + and (1)

Correct (1) 4(b) =IF(AND(B2<>0,C2<>0,D2<>0),MIN(B2:D2),IF((SUM(B2:D2)

-MAX(B2:D2))=0,SUM(B2:D2),SUM(B2:D2)-MAX(B2:D2)))

Correct(2)

5(a) D2: =vlookup(C2,reference,2, 0)

E3: =vlookup(C3, reference, 4,0) 1 + logic(1) 1

5(b) G2: =countif(E2:E1001,”=3A”) 1+1 5(c) G8: =max(G2:G6)

G9: =min(G2:G6) 1 1

5(d) if there are more than one class to have the maximum(minimum) number of lateness, it will locate one only.

2

5(e) Sorting, Select range from column A to E, Select data and then sort, then select date as the primary sorting key(in ascending order) and name as the secondary primary sorting key (in ascending order). Finally, press OK.

1 1 1 1 1

Page 76: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

76

5(f) Select the data you want to plot chart Press the chart wizard Select chart type Give the title of the chart, and name the legends Adjust scale, change the color, etc Press Finish

1 1 1 1 1

ASCA - 2002 8 (a)(i) =D$3*(1-$C4) 2 (ii) =F$3(1-$C6) 2 (b) D2 = C2*VLOOKUP(C2, PRICE!A$3:F$6,4) 3 H101 = G101*VLOOKUP(G101, PRICE!A$3:F$6, 6) 3 (c) =D45+F45+H45 1 (d) =COUNT(C2:C101) 1+1 (e)(i) =IF(LEFT(B3,1)=J$1,1,0) 1+1+1 (ii) 1. enter a formula = I2*J2 into cell K2 0.5 2. copy the formula into cells K3 to K101 0.5 3. enter a formula = SUM(K2:K101) into cell K103 1 (iii) Change the step 1 in (e)(ii) to Enter a formula = IF(LEFT(B2,1)=J$1, I2, 0) into cell K2 2 ASCA – 2000 11. (a) (B3*B$7+C3*C$7+D$7)/(B3+C3+D3) 5 (b) Formula in cell G3:E3(1+B$9)

Formula in cell B10:(E3*F3+E4*F4+E5*F5+E6*F6)*B9 5

(c) The following steps should be taken: (1) highlight the cells, (2) choose the wizard in drawing charts and follow the steps provided which are as

follows: (3) choose the kind of chart to be presented (e.g. bar chart, line graph, etc.) (4) once chosen the kind of chart, add the appropriate chart labels (e.g. axis label chart

title, legend etc.) (5) choose OK when done.

4

(d) Mr. Wong can enter another formula in either cell F10 or cell G10 to cross check the result obtained in B10. The formula can be (E3*F3+E4*F4+E5*F5+E6*F6)*(1+B9) Cross-checking or similar measure – 2 Any valid formula – 2

4

2001#12 12 (a)(i) =IF(B3>30, B3-3,30) 2 (ii) 48 2 (iii) 30 2 (b)(i) 105 2 (ii) Total cost of the first 15 shirts 2 (c)(i) 15 2 (ii) Total profit for selling the first 15 shirts in the price of $60 2 (d)(i) =$D$18-C2 2 (ii) =D$18-$B2 or =D$18-$C2 or =D$18*$A2-$C2 2 (iii) =D2+D$18-$B3 or =D$18*$A3-$C3 2 2003#9

Page 77: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

77

9. (a) IF($D3, 0, $G3) (b) IF($D3,

IF($F3<4, G3 * VLOOKUP($E, $K$3: $M$12, 3, FALSE), G3 * F3 * VLOOKUP($E3, $K$3: $N$12, 4, FALSE)), 0) OR IF($D3, $G3 * IF($F3 < 4, 1, $F3) * VLOOKUP($E3, $K$3: $N$12, IF($F3<4, 3, 4), FALSE), 0)

(c) COUNTIF (PAY!$C$3:$C$28, B3) (d) (i) No, blank cells are assumed to be zero. (ii) TRUNC(RAND()*($C3 –$D3 + 1), 0) + $D3

OR ROUND(RAND()*($C3 – $D3),0) + $D3 OR RANBETWEEN ($D3, $C3)

(e) RAND() recalculates every time any editing to the worksheet. Copy the range and paste by value to fix the data

set. / Turn the calculation mode (計算方式) into manual (手動)

(f) - range of Data Set #1 - chart type (Pie chart) - appropriate descriptors such as labels, heading, legends

2004#8

Page 78: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

78

2005#

9. (a) (i) LARGE(D3:J3,3)+LARGE(D3:J3,4)+LARGE(D3:J3,5) 1 LARGE(,) / SMALL(,) 2

(ii) RANK($K3,$K$2:$K$41) 1 RANK(,) 2

(b) (i) SUMIF($C$2:$C$41,$A45,$L$2:$L$41) 1 SUMIF(,,) 2

(ii) COUNTIF($C$2:$C$41,$A45) 1 COUNTIFQ 2

(c) IF(C45=0, 100, ROUND(B45/C45.2)) 2

(d) Finding the minimum average house score 1 1

Comparing each average house score to the minimum 1 1

Concatenate the names of winners 1 1

Text & formula exist 1 1

All correct formulae 1 1

=concatenate(if(D44=min(D44:D47),A44, ""), if(D45=min(D44:D47),A45, ""),

if(D46=min(D44:D47), A46,""), if(D47=min(D44:D47), A47,""))

(e) Step 1: Sort Final Score 1 2

Step 2: Sort House (1") and Sex (2nd

) 1

or

Step 1: Sort Sex (1st) and Final Score (2

nd) 1

Step 2: Sort House 1

(f) use automatic data filtering feature 1

select "House = A" condition in house field (i.e. column C) 1

select "5 <= rank <= 30" condition in rank field (i.e. column L) 1

Page 79: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 79

Keywords Absolute Address Row Relative Address Column Legends Border Macro Shading Split Windows Formula Name a range Text Auto-recalculation Lookup Table Multiple key sorting Cell Pie Chart Worksheet Bar Chart Workbook Polygon Chart Built-in Function Validation Freeze panes Paste special /Paste value

Conditional Formatting

Filter Chart wizard

Important rules and revision

1 Compared with absolute addressing, what is the advantage of using named cell or named range?

1. Absolute addressing can be wrongly if transcription errors happen.

2. No absolute addressing is needed if cells are copied from one cell to

another.

3. When referring a cell in another worksheet, no worksheet name should be

provided.

2. What is the limitation of using named cells or named range?

Each named cell or named range have to be unique in the whole workbook.

Some reserved words cannot be used as the named cell or named range. E.g.

A5.

3. How to avoid inputting errors in spreadsheet?

Validation

4. How do you avoid errors like “#N/A”, “#VALUE” in spreadsheet?

Use the function ISERROR

5. What is the default ranking order of using the function “RANK”? How do you reverse the order?

It is in descending order as the default order of ranking. To reverse it, it should

be written as =RANK(Value, Range, non-zero positive value)

6. The syntax of VLOOKUP is

VLOOPKUP(Value, Range, column_number, parameter), what are the choices of the parameters? Parameter can be any value, positive or negative or zero or even TRUE or

FALSE, however, only 0 or FALSE will locate the exact values in an unsorted

list.

7. How do you generate an integer varies from 30 to 100? =ROUND(rand()*(100-30)+30,0)

Page 80: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 80

8. How to round up a value in A3 such that it is correct to nearest thousand? =ROUND(A3, -3)

9. We can apply conditional formatting to a cell, for example, we can set the rule such that if the value

of the cell is over 30, then, it becomes red. Apart from checking the value, what can be set in conditional formatting?

We can set formula instead of value when setting the conditional rules.

Suppose there is a list of number stored from cell B1 to B12, then, we can set

the conditional formatting rule as =B2>B1 such that if the formula is true, the

cell will show red color.

10. When copying a range of cells from one worksheet to another, what options can be pasted? Paste by ALL

Paste by VALUE

11. What is the usual file format such that it can be used to import and export data between excel and

other application program? It is a text file format called CSV file. Its file extension would be .csv

12. If the print preview shows that it takes two pages to print a worksheet, how would you reduce it into just one page?

Set the margin, the left, right, top, bottom and the header and footer margins.

Print the worksheet with adjusted percentage.

13. If a worksheet is too long, it has to be printed into two pages, however, the header row will show up

just in the first page but not the second page, what should you do? You can select the header row in the option of the page setup such that it will

show up at the top of each page.

14. What are the advantages of using spreadsheet software package over database Management System?

Auto-recalculation

Suitable for What-if Analysis

15. What are the advantages of using DBMS over spreadsheet software package? DBMS is used for a large data size situation.

16. If we want to use VLOOKUP to refer to a table, index column has to be on the leftmost column, if, in case, the index column is in the middle of the range, i.e. some columns it is referring to is on the left side of it. What should you do?

You should use the function LOOKUP instead of VLOOKUP.

17. After doing the past papers, what functions that are mostly appeared? 1. IF

2. COUNTIF

3. VLOOKUP, RANK, ROUND

4. RAND, SUMIF

5. LARGE, SMALL, COUNT, SUMPRODUCT, LEFT, RIGHT, MID, LEN

Page 81: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 81

Advance Techniques for spreadsheet

What-if analysis

What–if analysis is a simulation in which one wants to know what the change in the outcomes is if some factors in the scenario are altered. It is useful in informed judgment, decision making and prediction.

Spreadsheet characteristics/functions useful for what-if analysis

Recalculation

Recalculate feature enables users to see the updated result immediately when some input values are changed. However if several different input values are used, it is difficult to compare the outcomes. In order to produce an output, one formula is required for one input value. If there are many input values, each individual formula has to be changed so that updated outputs from these input values can be seen.

Goal Seek

When you know the desired result of a single formula but not the input value the formula needs to determine the result, you can use the Goal Seek feature. When goal seeking, the spreadsheet program varies the value in one specific cell until a formula that's dependent on that cell returns the result you want.

Example If Mr Chan deposits $4000 in ABC Bank for 5 years with an annual interest rate of 2% he can withdraw 4416.3 dollars after 5 years. Now Mr Chan wants to know the number of years required if he wants the amount paid to be 5000 (with the annual interest rate is unchanged). Tools�Goal Seek

Result:

Mr Chan needs to deopsite $4000 for 11.27 years in order to withdraw $5000 at the end. Data Table The same formula for different input values produces different outcomes. The shortcoming of data table is that it only allows two variables. Let’s reconsider Mr Chan’s example. This time the annual interest rate factor can be taken into consideration in addition to the time factor. We may set two variables, namely the number of year (as row input cell) and the annual interests rate (as column input cell), in the data table. 1. Enter the time factor (e.g. 5 to 12 years) in cells D3 to D10 and the annual interest rate (e.g. 2, 2.5 and 3 %) in cells E2 to G2 (you may expand the data table by entering more entries for time and annual interest rate factors) 2. Refer cell D2 to cell B7 (i.e. enter =B7 in D2)

=B3*(1+B5/100)^B4

Page 82: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 82

3. Select cells D2 to G9 4. Data�Table 5. Select cell B5 as “Row input cell” and cell B4 as “Column input cell” 6. Result is shown on the data table (Amount paid=5000)

Scenario Manager The scenario manager is a tool for saving different sets of data used for the what-if analysis as scenarios. There can be multiple variables in scenarios. Let’s reconsider Mr Chan’s example. We can produce the following scenarios:

Scenario Name 1 2 3 4 5 6 7 8 Number of years 5 10 15 20 5 10 15 20 Annual interest rate 2 2 2 2 3 3 3 3

1. Highlight cell B3 then Insert� Name� Define �Enter deposit under “Names in workbook” (The name will be used in the Summary Report) � Add

Repeat the above step for cells B4 (time), B5 (rate) and B7 (amount)

Only number of years is considered Annual interest rate

is changed to 3%

Page 83: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 83

2. Tools � Scenarios�Add

3. Enter 1 under “Scenario name”�OK (Enter the value for the first scenario)

4. Add the other seven scenarios � Summary

3. Choose Scenario summary

Page 84: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 84

Pivot Table

Pivot Tables and Pivot Charts

A pivot table is an interactive table that you can use to quickly summarize large amounts of data. You can rotate its rows and columns to see different summaries of the source data, filter the data by displaying different pages, or display the details for areas of interest. A pivot chart combines interactive summarization of data provided by a pivot table with the visual appeal and benefits of a chart.

Creating pivot tables and pivot charts

1. Enter the source data on a worksheet

2. Menu bar�Data�PivotTable and PivotChart Report

3. Choose a range of data to be used in the pivot table

Page 85: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 85

4. Locate the pivot table

5. An empty pivot table on a new worksheet

There are four areas in the pivot table. You may drop one or more fields in any area. You may also leave any area empty.

I Data area: Display a summary of numeric results II Row area Display a vertical list of fields III Column area Display a horizontal list of fields IV Page area Determine the scope of data to be displayed Example 1: Find the total marks scored by 1B students 1. From the PivotTable Menu bar, drag the button Class into the Page area and select the class as 1B

(only records of 1B students will be considered)

Page 86: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 86

2. Drag the button Name into the Row area and drag the button Marks into the Data area

Pivot Chart for Example 1

PivotTable Menu bar � Chart Wizard button

You may change the values of Class and Name. Effects are reflected immediately. e.g. Choose the class as 1A

Example 2: Find the contribution of the marks scored by each student in 1B (shown as percentage).

1. Use the result produced by the first example and double click on the button Sum of Marks 2. Choose Sum under “Summarize by” and % of total under “Show data as”

Page 87: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 87

Pivot Chart for Example 2

Choose the chart type as an exploded pie chart and set the chart options

Example 3: Find the student with max mark in each class 1. Drag the button Class and button Name into the Row area drag the button Mark into Data area (Page

area is empty as there is no restriction on the scope of data to be displayed). 2. Double click on the button Sum of Marks and choose Max under “Summarize by”

Example 4: (a) Find the number of boys and girls in each house Drag the buttons of House and Sex into the Row area and drag the button

name into Data area (it counts number of name in each category)

Page 88: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 88

(b) Find the number of girls in houses B and R Click on the button House and uncheck G and Y; Click on the button Sex and uncheck M

Removing grand total and subtotals The subtotals and grand totals are sometimes not necessary. They can be removed by not selecting the corresponding options. Removing grand total: PivotTable Menu bar � PivotTable�Table Options� Uncheck Grand totals for columns Removing subtotals

1. Double click on the button in the Row area (e.g. House) 2. Select None as the options for Subtotals

Output from Example 4(b)

Page 89: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 89

Summary functions for data analysis

Function Summarizes

Sum The sum of the values. This is the default function for numeric source data.

Count The number of items. The Count summary function works the same as the COUNTA worksheet function. Count is the default function for source data other than numbers.

Average The average of the values.

Max The largest value.

Min The smallest value.

Product The product of the values.

Count Nums The number of rows that contain numeric data. The Count Nums summary function works the same as the COUNT worksheet function.

StdDev An estimate of the standard deviation of a population, where the sample is all of the data to be summarized.

StdDevp The standard deviation of a population, where the population is all of the data to be summarized.

Var An estimate of the variance of a population, where the sample is all of the data to be summarized.

Varp The variance of a population, where the population is all of the data to be summarized.

Output from example 4(b)

Page 90: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 90

Class Practice for pivot table: The following shows a pivot table which can be downloaded from http://yiuming.yll.edu.hk/ca/pivot_table_data1.xls

Please finish the following pivot charts:

(i) (ii)

(iii) (iv)

(v) (vi)

Page 91: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 91

Spreadsheet Drilling Exercise 1 There are 40 customers joining a lucky draw. The marketing manager, Mr Wing wants to do an analysis on the customers. The following spreadsheet is produced.

… … …

(a) Mr Wing wants to classify the ages of the customers into three groups according to the following rule:

<20 Junior 20-50 Intermediate >50 Senior

Write a formula in cell D2 to show the group of HO WAN KI belongs to. This formula is copied to cells D3 to D41.

(b) In order to find the number of customer in different age groups, write down the formula in

(i) cell F2

(ii) cell F3

(iii) cell F4

(iv) cell F5

(v) cell F6

(c) A pie chart is chosen to represent the data. Give a reason.

(d) Describe how a pie chart containing different age groups can be generated.

(e) The following pie chart is produced. However, Mr Wing is not satisfied with it. Suggest three

improvements.

Page 92: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 92

Spreadsheet Drilling Exercise 2 1. What are the outputs of the following?

a) IF(6>MOD(20,3)*3,2,5)+5-LEN("TREE")+INT(-4.9)

b) Range A1:A4 stores 2.1, 2.8, 9, 3.5 ROUND (IF (AND (SQRT (15) > 3, 3 = 3), 22.8, 49.3), -1) + RANK (3.5, A1:A4, 0)

2. Consider the following spreadsheet

a) Write down the output for the following. i) VLOOKUP("Nancy",A2:E6,4) ii) VLOOKUP("Lily",A2:E6,2,TRUE)

b) Only the best 2 tests will be taken for calculating the average e.g. Kitty's average mark is (80+81)/2 = 80.5 . In cell F2, write down the formula for calculating the average of Kitty. The formula will then be copied to cells F3 to F6.

c) The total is calculated by (Average * Test weighting + Examination * Exam weighting) e.g. kitty's Total is (80.5 * 0.4 + 79 * 0.6) = 79.6. In cell I2, write down the formula for calculating the total of Kitty. The formula will then be copied to cells I3 to I6.

Page 93: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 93

Spreadsheet Drilling Exercise 3

Ms Chan uses a spreadsheet program to handle the date of her class. There are two worksheets in this

workbook. Act is used to store the activity/activities taken by the student in years 2000, 2001 and 2002. Conduct is used to store the conduct of the students.

(a) The conduct is stored in another worksheet in the same workbook. The final marks will be adjusted by the conduct. For example, the final marks for KWONG WAI HUNG is 23 x 0.9 = 20.7. Write down the formula for KOWNG WAI HUNG in cell G2. This formula will be copied to cells G3 to G20.

Page 94: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 94

(b) The grade based on the final mark is assigned according to the following table. This table can also be

found in worksheet Act.

Mark not lower than Performance

0 Poor

40 Below Average

60 Average

70 Good

80 Excellent Write down the formula for the grade obtained by KOWNG WAI HUNG in cell H2. This formula is then copied to cells H3 to H20. You are NOT allowed to use 'IF' in this question.

(c) Ms Chan wants to find the positions in her class. The student(s) with the highest mark will occupy

position 1 and the student(s) with the lowest mark will score position 19. Students with the same score will occupy the same position (e.g. if two students occupy position 5 then there will be no position 6). Write down the formula for the position obtained by KOWNG WAI HUNG in cell I2. This formula is then copied to cells I3 to I20.

(d) An award will be presented to the students who have taken the same activity for more than 1 year. For

example, KWONG WAI HUNG has taken "SCU" in year 2001 and year 2002. An award is granted to him. Write down the formula for KOWNG WAI HUNG in cell J2. This formula will be copied to cells J3 to J20.

(e) (i) Ms Chan wants to know the number of students whose performance is poor, below

average, average, good or excellent respectively. Write down the formula for counting the number of students with poor performance in cell M10. This formula will be copied to cells M11to M14.

(ii) Suggest a suitable chart type which can show the proportion of students with poor, below

average, average, good or excellent performance clearly.

(iii) Name three items that should appear on the chart.

Page 95: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 95

Spreadsheet Drilling Exercise 4 Ms Kwan uses a spreadsheet file to store her students’ achievements. Worksheet “Score” stores the achievements of the students. Worksheet “Final” stores the promotion status and the position of the students at the end of the school year. Worksheet “Score” Worksheet “Final”

a) Referring to worksheet “Score”, the column “Result” is found by the marks and the corresponding weighting. For example, Bill scores 78, 56 and 80 in Chinese, English and Mathematics respectively. His final result is 78x4/(4+4+3)+56x4/(4+4+3)+80x3/(4+4+3) = 70.5 (round to 1 decimal place). Enter the formula for finding Bill’s final result in cell E2 of worksheet “Score”. This formula will be copied to cells E3 to E13.

b) Answer the following questions referring to worksheet “Final”. (i) A student is promoted if the “Result” is at least 50 and “Conduct” is either A or B in worksheet

“Score”. The promotion status of Irene and Connie are shown as examples. Enter a formula in cell B2 of worksheet “Final” to find the promotion status of Irene. The formula will be copied to cells B3 to B13.

(ii) The positions of the students are found by arranging the “Result” in worksheet “Score” in descending order. Enter a formula in cell C2 of worksheet “Final” to find the position for Irene. The formula will then be copied to cells C3 to C13.

c) Ms Kwan wants to share the students’ result with another teacher. However she does not want other teachers to change the data or view the formulas. What should he do?

Retained

Promoted

Page 96: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 96

Spreadsheet Drilling Exercise 5 1. The tables below show the sales of the salesmen in ABC Company. There are four spreadsheets in a

workbook. The first, second and third worksheet shows the sales of the salesmen in January, February and March respectively. The fourth worksheet shows the total sales of each salesman.

Spreadsheet 1 Spreadsheet 2

Spreadsheet 3 Spreadsheet 4

a) What formula should be entered in cell B3 of the spreadsheet ‘Total’ in order to find the total sales of

Calvin?

b) The company wants to know the trend of sales of each salesman. Suggest a suitable graph. Explain briefly.

Page 97: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 97

2. Below is a spreadsheet. The part on the left contains the name, the marks and the grade of the students. The part on the right is a grade conversion table for determining the grades of the students. Both parts belong to the same spreadsheet.

…… …… …… ……

The grade is found by referring to the table on the right. A formula is entered in cell C2 and then the formula is copied to the other cells in column C. a) Write down the formula to be entered in cell C2. You are not allowed to use the 'IF' function.

b) Write down the formula in cell C5 after copying the formula.

a) The student data and the grade conversion table cannot be seen within the same screen. If moving the grade conversion table is not allowed, suggest a function to make them appear within the same screen.

b) A cell in a spreadsheet can dynamically link to other cells in other spreadsheets. State TWO advantages of using dynamic links.

Spreadsheet Revision Questions: Name: M.C. Class: 1. Consider the following worksheet:

AAAA BBBB CCCC DDDD EEEE

1111 2 -3 4 8

2222

3333

What is the result of =D1^(A1+B1)/-A1? A. 0.625 B. -4 C. 2.828

cell L1

cell L7

Page 98: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 98

D. -0.0625 2. Which of the following formulas cannot be placed at A1? A. =A2*A3+B3*D6^E5+G4-H5 B. =B3+D5*D3/E19*G5 C. =B3*B3-D3/C3+A1 D. =A11+C14+D15-SUM(A2:B14) 3. Which of the following will NOT give an error message? A. =E19/(E13-E13)*2 B. =(8-16)^1/2 C. =A1+”A1” D. =A1&”A1” 4. Consider the following worksheet:

AAAA BBBB CCCC DDDD

1111 23 9 32 65

2222

Which of the following will give a TRUE value? A. =AND(B1<C1, C1<C2) B. =OR(B1<0, NOT(C1>B1)) C. =AND(A1>B1, NOT(OR(B1>C1, C1>D1))) D. =NOT(D1>C1) 5. Which of the following is a correct cell reference to a range of cells in worksheet

SHEET5 of the spreadsheet file MYSHEET.XLS? A. [mysheet.xls]sheet5!C5:B4 B. mysheet.xls.sheet5!B4:C5 C. [mysheet.xls]sheet5!B4:C5 D. mysheet.xls[sheet5]!B4:C5 6. Which of the following will generate a random number between 5 and 15 inclusively? A. =INT(RAND()*10)+5 B. =INT(RAND()*10)+15 C. =INT(RAND()*11)+5) D. =INT(RAND()*9)+5 7. Which of the following is equivalent to =AVERAGE(range), where range represents a

range of cells? A. =COUNT(range)/SUM(range) B. =SUM(range)/COUNT(range) C. =SUM(range)/COUNTA(range) D. =SUM(range)*COUNT(range) 8. Which of the following is syntactically incorrect? A. =COUTIF(A1:A11,>=10) B. =COUTIF(A1:A11,”>” & COUNT(A2:A5)) C. =COUTIF(A1:A11,”A”) D. =COUTIF(A1:A11,”<B”) 9. Assume that the comparisons are non-case sensitive.

AAAA BBBB CCCC

1111 gentle 8

Page 99: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 99

2222 Great 9

3333 GOVT 2

4444 ghost 3

5555 Egg 9

Determine the value returned by COUNTIF(A1:A5,”g*”). A. 0 B. 2 C. 4 D. 5 Use the following worksheet in the three questions below:

AAAA BBBB

1111 Jan 6

2222 Feb 4

3333 Mar 2

4444 Apr 5

5555 May 6

6666 Jun 4

7777 Jul 3

10. Determine the value returned by SUMIF(B1:B7,”<4”) A. 0 B. 5 C. 13 D. 30 11. Determine the value returned SUMIF(A1:A7,”=Ma*”,B1:B7). A. 0 B. 2 C. 6 D. 8 12. Determine the value returned by SUMIF(A1:A7,”<Jan”,B1:B7). A. 0 B. 9 C. 11 D. 30 13. Given that A1 stores 7. Which of the following is not a possible value returned by the

function IF(A1>B1, A1, B1) A. 6 B. 7 C. 8 D. 100 14. If the formulas {=FREQUENCY(A2:B5,D2:D4)} are entered in E2 to E4,

AAAA BBBB CCCC DDDD EEEE

1111 Data ArrayData ArrayData ArrayData Array BinsBinsBinsBins FrequencyFrequencyFrequencyFrequency

2222 15 10 10

Page 100: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 100

3333 22 7 20

4444 17 3 30

5555 29 2

what would be the values displayed in E2 to E4? E2 E3 E4

A. 2 0 0 B. 2 2 0 C. 4 2 2 D. 4 6 8 15. Given that A1 stores 15. What is the result of

=IF(A1>20,IF(A1>40,1,2),IF(A1<10,3,4) ? A. 1 B. 2 C. 3 D. 4 16. Given that A1, B1, C1 store -2, 3, 5 respectively. Determine the value returned by

IF(AND(A1>0, B1>0),1, IF(A1>1, B1<1),2, IF(NOT(C1=5),3,4))

A. 1 B. 2 C. 3 D. 4 Use the following worksheet for the following three questions:

AAAA BBBB CCCC DDDD EEEE FFFF

1111 3

2222 1

3333 2

4444 1 113 115

5555 2 191 142

6666 3 118 186

17. What is the value returned by the function VLOOKUP(A2,D3:F5,3)? A. 113 B. 118 C. 115 D. 186 18. What is the value returned by the function VLOOKUP(A4,D3:F5,2,TRUE) ? A. 113 B. 191 C. 115 D. An error message 19. What is the value returned by the function VLOOKUP(A5,D3:F5,2,TRUE) ? A. 113 B. 191

Page 101: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 101

C. 115 D. An error message Use the following worksheet in the following four questions:

AAAA BBBB CCCC DDDD EEEE FFFF

1111 3

2222 1

3333 2 1 6 8 9

4444 8 2 5 11 6

5555 6 3 13 7 10

6666 6.3 4 15 2 7

7777 5 8 9 8

20. Determine the value returned by the function LOOKUP(A2,C3:F7). A. 1 B. 5 C. 9 D. An error message 21. Determine the value returned by the function LOOKUP(A1,C3:C7,E3:E7). A. 8 B. 7 C. 10 D. 9 22. Determine the value returned by the function LOOKUP(A6,C3:F3,C6:F6). A. 8 B. 9 C. 2 D. 15 23. Determine the value returned by the function LOOKUP(A6,C3:C7,D3:D7). A. 8 B. 9 C. 6 D. An error message 24. Which of the following is able to determine odd or even for the number in B3? A. =IF(MOD(B3,2), “ODD”, “EVEN”) B. =IF(MOD(B3,2), “EVEN”, “ODD”) C. =IF(MOD(B3,2)=0, “ODD”, “EVEN”) D. =IF(MOD(B3,2)<>0, “EVEN”, “ODD”) 25. Which of the following is equivalent to = MOD(x,y)? A. =MOD(y,x) B. =x/y – INT(x/y) C. = x – INT(x/y)*y D. =INT(x/y)*y – x 26. Which of the following about date and time is /are true?

Page 102: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 102

(1) Both NOW() and TODAY() functions would return different values on different days. (2) The value of the formula: = TODAY() <= NOW() is always true. (3) The display of the cell that stores = NOW() will change in every second.

A. (1) only B. (1) and (2) only C. (2) and (3) only D. (1), (2) and (3) Use the following diagram for the following questions:

AAAA BBBB CCCC DDDD EEEE

1111 namenamenamename engengengeng chichichichi mathsmathsmathsmaths totaltotaltotaltotal

2222 Peter 72 96 95 263

3333 Mary 92 70 71 233

4444 David 48 41 66 155

5555 Robert 73 81 96 250

6666 George 91 93 49 233

7777 Janet 91 90 52 233

We want to sort the data according to “total” in descending order. If total are the same, the one with higher “eng” mark will be ranker higher. If both “eng” is the same, the higher the “chi” mark, the higher will be the rank. 27. Which of the following statement is INCORRECT? A. To sort the data, we should check the header row box if the whole worksheet is

selected. B. The primary sorting key should be set to the field “total” C. If we need to sort the data by just one field at a time, then, we have to sort the

field “total” first, the field “eng” second, the field “chi” the last. D. The formula in cell E2 should be set to “=SUM($B2:$D2) This question above is modified by ASCA 2005#9(f)

Page 103: Index Topic Page Number In syllabus, we have… REFERENCE 1 ... · In syllabus, we have… The basic structure of a spreadsheet • Students should have a clear understanding of the

Spreadsheet - 103

Conventional Questions: 1. Now, you want to generate a random number varies from the floor to the ceiling,

AAAA BBBB CCCC

1111 Floor 35

2222 Ceiling 80

3333

4444 Rand Num

5555

What would be the possible answer (making use of the function “ROUND()”)?

2. Now, you are going to calculate the amount need to pay.

AAAA BBBB CCCC DDDD EEEE FFFF GGGG

1111 ITEM01 ITEM02 ITEM03 Number Discount Rate

2222 Price 400 300 1000 1 0%

3333 Qty 6 39 17 10 5%

4444 Amount $2,400 $9,945 $16,150 20 10%

5555 30 15%

6666

As illustrated in the above diagram, discount rate is according to the number of purchase, e.g. if you buy 3 things, you will get no discount, but if you buy 12 things, you will get 5% discount. What is the formula in B4 such that it can be copied to C4 to D4.

3. If we want to randomly generate an integer between 3 and 5 inclusively, we can use

either the following formula: =ROUND(3+RAND()*(5-3),0) OR

=INT(3+RAND()*3), comment on these two formula in terms of level of randomness.