CHAPTER
4
FUNCTIONS
AND
FORMULAE
FUNCTIONS
14
Abacus contains a number
of
pre-defined functions which are used
to
perform specific
calculations
on
the contents
of
one or more
cells.
A function takes a number of input
values, known
as
arguments, and from them calculates a specific
result.
The result
IS
said
to
be the value that the function returns.
In
Abacus you must supply the arguments
In
brackets after the name
of
the funclion
and,
If
there
IS
more than one argument.
you
must separate each with commas. Most
of the functions
prOVided
return a numeric
value,
for
example, the function sum(
).
This
takes,
as
an
argument, a range reference and returns a numeric value equal
to
the
sum
of the numeric values contained
in
all
the cells within
the
range.
Some functions, such
as
month(), return a
text
value.
(month(1), for example, returns
the
text
January'). A
few
functions require no arguments, but
you
must
still
include the
brackets.
For
example the function pi( ) returns the numerical value of the mathematical
constant
IT
(approximately
3.14).
.
Two
particularly useful functions are col( ) and row(). These return the number of the
column (or
row)
which intersect
at
the
cell
that contains the function. They are used
extensively
in
the examples
In
the next chapter.
For
example, col()
will
return a value of 1 from column
A.
2 from column
B,
and
so
on.
The function row()
Simply
returns the
row
number
As
an example
we
can use the two functions month( ) and
col()
to
label columns of
the grid. The object
will
be
to
place the headings January, February, and
so
on at the
top of columns B
to
M.
We
use the funclion
col()
to
supply the number that
month()
needs
as
its
argument.
so
that
It
gets a different value
,n
every column.
Type
In:
row
=
month(coLO)
and then press ENTER. Select the range from B
to
M when Abacus
asks
for the start
and end columns.
You
will
see that the result
is
not quite what
we
want
in
that.
although
the labels start
at
column
B,
the
first
label
is
February and not January. This
IS
because,
in
column
B,
col( ) returns
the
value 2 and month(2)
IS
the
text
'February:
All
we
have
to
do
is
to
alter the Instruction
so
that 1
IS
subtracted from the value returned
by
col(),
before calculating the month.
Type
In:
row
=
month(coL
0-1J
(Don't forget
to
press ENTER
to
mark the end
of
the Input.) Select the column range
from B
to
M,
as
before.
FORMULAE
A formula
is
usually used
to
relate
the contents of one cell
to
the contents of one or
more of the other cells
in
the grid. The idea
of
formulae
is
very important
in
the use
of Abacus
as
it
allows
you
to
describe
even
the
most complicated calculations
,n
a
Simple
way.
You
enter a formula into a
cell
uSing
the same method employed for entering numbers,
that
is,
by moving the cursor
to
the cell, typing
It
and then pressing ENTER. Abacus
assumes that anything
it
does not recognise
as
a number (starting with a numeric digit)
or a text value (starting with quotation marks)
IS
a formula.
Move the cursor
to
cell
B3
and enter the number
100,
move the cursor
to
cell C3 and
enter
200.
Now move the cursor
to
cell D3 and type
In
the following formula
83 +
C3
When
you
press ENTER you
will
see two things happen.
First
the value 300
Will
appear
In
cell
D3;
the formula's result has been calculated by adding together the contents of
cell
B3
and cell C3 and the
total
placed
In
cell
D3.
In
addition
you
Will
see that the status
area
at
the bottom of the screen shows the formula used
to
calculate the value
in
this
cell. A cell which contains a formula
will always show the result
of
the calculation.
If
you
position the cursor
on
the
cell
then Abacus
will
show the formula
Itself
in
the status area
at
the bottom of the screen.
12/54