Functions
A function is a predefined procedure that computes and returns a result. Functions defined below with a parameter list of list accept two or more arguments separated by commas (,) or semicolons (;). As to which separator is permitted, is defined by the document's <listSeparator>
(§2.15.1.56) element. Arguments to functions can be constants, formulas, or bookmark names that refer to constants or formulas. The functions AVERAGE
, COUNT
, MAX
, MIN
, PRODUCT
, and SUM
can also accept references to table cells as arguments. In the context of a table cell, functions taking a list also accept a single argument that designates a named-list of contiguous cells (§2.16.3.5). Function names are not case-sensitive, and white space can occur between a function's name and its argument list, if any.
The functions supported are as follows:
Functions |
|
---|---|
Function |
Description |
ABS(x) |
Returns the absolute value of x. |
AND(x,y) |
Returns 1 if the logical expressions x and y are both true; otherwise, it returns 0. |
AVERAGE(list) |
Returns the average value of the items in list. |
COUNT(list) |
Returns the number of items in list. |
DEFINED(x) |
Returns 1 if the expression x is well formed; otherwise, it returns 0. |
FALSE |
Returns 0. |
INT(x) |
Returns the value of the integer part of x. |
MAX(list) |
Returns the largest value in list. |
MIN(list) |
Returns the smallest value in list. |
MOD(x,y) |
Returns the value x - ny, for some integer n such that, if y is nonzero, the result has the same sign as x and magnitude less than the magnitude of y. If y is zero, a diagnostic shall be issued. (y need not be a whole number.)
example: :
|
NOT(x) |
Returns 0 if the logical expression x is true, or 1 if the expression is false. |
OR(x,y) |
Returns 1 if either or both logical expressions x and y are true; otherwise, it returns 0. |
PRODUCT(list) |
Returns the result of multiplying together all members in list. |
ROUND(x,y) |
Returns the value of x rounded to the specified number of decimal places indicated by floor(y), where floor has the mathematical meaning. If y is negative, any fractional part is discarded and the integer part of the value is rounded to the corresponding power of 10. |
SIGN(x) |
Returns 1 if x is positive; returns 0 if x is zero; and returns –1 if x is negative. |
SUM(list) |
Returns the sum of the items in list. |
TRUE |
Returns 1. |