This chapter introduces formulae and shows you how to write them. It introduces the operators and functions which you need to use in formulae and shows you the ways Fireworkz can help you to write formulae quickly and easily.
It includes sections on:
Load the spreadsheet exams from the Tutorial directory. You will see a list of class members and their marks in four exams.
You need to calculate the average mark for each pupil, and to award them each a single grade based on this average mark. You then need to work out the number of pupils receiving each grade, and the percentage of the class receiving each grade.
In the previous chapter you added columns of numbers using the button. You saw that this created a formula which you could read on the formula line. In this chapter, you will be entering formulae directly on the formula line. Note that unlike text and numbers, you cannot enter a formula directly into a cell - you have to use the formula line.
The first step is to work out the average number of marks earned by each student:
Click the
tool button on the toolbar.
Your formula is now complete. Click the
tool button on the toolbar or press
Return↵ to enter the formula. You will see the result 76.75 appear in the cell.
If you make a mistake and the correct result does not appear, then you need to change the formula:
Click the
tool button on the toolbar or press
Return↵ to enter the corrected formula.
You need to perform the same calculation for all the students in the class.
This can be done using one of the
buttons.
When you use a
button to copy a formula,
it updates the formula in each column or row, so that the data it operates on
has the same relative position to each cell containing the formula.
So when our formula appears in row 4, it will calculate the average value in
row 4, and so on:
Now click the
button (because you are
filling down a column). The column will fill with the average mark for each
student.
You can check the formulae which have been created by clicking on any of the cells in column G and looking at the formula which appears in the formula line.
The next stage is to assign a grade to each student, based on their average mark. The school operates the following formula:
| Average mark | Grade |
| over 75 | A |
| 50 to 75 | B |
| under 50 | C |
You could simply look at each mark and type in the appropriate grade. However, the process can be simply automated by writing a formula which calculates the grade, using the if() function.
The aim of our formula is to look at a mark and initially test whether it is over 75. If it is, then the letter A will be printed in the column. If not, the formula will test whether if the mark is between 50 and 75. If it is then the letter B will be printed. If not (i.e. it is less than 50), then the letter C will be printed. The steps required to achieve this are spread over the next few sections.
Click the
button,
then choose
from the menu which appears.
The if() function has three parameters.
The first is the condition, i.e. the test which the formula applies to the mark. If the condition is true, then the action detailed in the second parameter takes place. If it is false, then the action detailed in the third parameter takes place.
You need to first test that the mark is greater than 75. To do this you simply enter a comparison as the first parameter:
G3>75
Fireworkz will take the contents of the cell, and test to see if the answer is true (i.e the contents of cell G3 are greater than 75), or false (i.e. the contents of cell G3 are less than or equal to 75) and act accordingly.
Next you need to detail what will happen if the condition is true. You want the letter A to appear in the cell, so you simply need to type this in. Text manipulated by formulae needs to be surrounded by double quotes, so that Fireworkz can recognise it and process it correctly. It is referred to as a string because it is a string of characters.
Note that all parameters must be separated by commas, so that Fireworkz can tell them apart.
The last stage is to enter what happens if the average mark is less than 75. In this case, a further test will be applied to the mark, to test whether it is 50 or more. To write this part of the formula, you need to use a further if() function. Placing one function inside another is known as nesting.
There is no need to go back to the function selector; this time you should try typing in the function directly:
The next stage is to enter the new condition, the first parameter to the second if() function. This time you will test whether the mark is greater than or equal to 50.
To evaluate the formula:
11.
Click the
tool button on the toolbar or press
Return↵.
You should see the result A appear in the cell containing the formula.
Note that the quotes are not displayed.
If you have made a mistake, then remove the formula as described earlier in this
chapter and either type in the correct formula shown in the previous step or repeat the prodcedure from the start.
Finally, you need to perform the same calculation for each student in the class. Again, you can use the button to do this.
12.
Select the range of cells from cell H3 down to cell H18 and click the
tool button on the toolbar.
The column will fill with the grades for each student.
The next stage is to analyse the information on the grades for the class as a whole. You need to count the number of students with each of the grades.
The easiest way to do this is to use one of the database spreadsheet functions. Database spreadsheet functions make a selection from a set of records and perform a calculation on the selection.
You need to find the students with each grade and simply count how many there are, so the dcounta() function is the one to use.
Click the
tool button on the toolbar, then choose the
category from the
sub-menu.
Then locate and double-click on the
dcounta(range,condition) entry in
the list of database functions presented.
Click the
tool button on the toolbar or press
Return↵. The answer 2.00 should appear in
cell B23.
Select the range of cells from cell B23 down to cell B25 and click the
tool button on the toolbar.
As a finishing touch, you can display the information about the number of students with each grade category as a percentage.
There are two parts to this process. First you need to calculate the proportion of students with each grade as a fraction, then you need to use a percentage style to format and display the result correctly.
To calculate the proportion with each grade you simply divide the number of students with that grade by the total number of students. For simple arithmetic operations such as this, you use the arithmetic operators +, -, * and /.
Click the
tool button on the toolbar or press
Return↵. The result 0.13 will appear in the cell.
Select the range of cells from cell C23 down to cell C25 and click the
tool button on the toolbar
to calculate the remaining fractions.
The second stage is to convert the fractions displayed into percentages.
With the cells still selected, click the
tool button on the toolbar.
The advantage of using a spreadsheet instead of a pencil and paper is the ease with which information can be recalculated.
After all the marks have been gathered and the analysis completed, news comes in that the external moderators have changed the marks for some English students.
In this chapter you learned how to write formulae, including the following stages:
The User Guide contains more information on using functions and operators and writing formulae, as well as full details of each function, including its parameters.
You can also access information on functions through the function reference section of the on-line help system.