Functions
A function is a named formula that takes zero or more arguments, performs an operation, and, optionally, returns a result. A function call has the following form:
function-call:function-name ( [ argument-list ] )
function-name:predefined-function-nameuser-defined-function-name
predefined-function-name:ABS | ACOS | ACOSH | any of the other functions defined in §3.17.7
user-defined-function-name:letter [ user-defined-name-characters ]
user-defined-name-characters:user-defined-name-characters user-defined-name-character
user-defined-name-character:letterany decimal digit 0–9.
letter:any Latin letter A–Z, a–z
argument-list: argumentargument-list , argument
argument:expression
predefined-function-names and user-defined-function-names are not case-sensitive.
A user-defined-function-name shall not have any of the following forms:
TRUE
orFALSE
name
cell-reference
[: An implementation is encouraged to support user-defined-function-names at least as long as 255 characters. ]
The semantics of a call to a function having a user-defined-function-name are unspecified.
An argument to a function can be a call to a function. That is, function calls can nest. [G An implementation is encouraged to support at least 64 levels of nested function calls. ]
Some functions take a variable number of arguments. This is indicated in the Syntax sections of §3.17.7 by their having argument-list as all, or the trailing part, of their argument list. The total number of arguments that shall be passed to such functions is at least 1.
[An implementation is encouraged to support function calls having at least 255 arguments.]
Expressions can have one or more values. Scalar expressions designate a single value, and cell references and array constants can designate multiple values. In the case of a multi-value expression, the way in which this is handled by a function when passed as an argument depends on a number of factors.
Most functions and operators expect either single- or multi-valued arguments and perform all of the array calculations whenever multi-valued arguments are present. [: SQRT({1;2;3;4})
; see the examples in §3.17.2. ]
When a function expects a single-valued argument but a multi-valued expression is passed, an attempt can be made to convert that set of values to a single value. For an array value or constant, the value of the expression is the value of the first element within that array value or constant. For a cell range, the first element can be used, or implicit intersection can be performed—the exact behavior is unspecified.
When a function expects a multi-valued argument but a single-valued expression is passed, that single-valued argument is treated as a 1x1 array.
For rules on how deal with potential ambiguities between function names and defined names, see §3.17.5.1.