Formula Functions
Table formulas calculate the text of a cell from constants and other cells, and most of their work is done by functions such as SUM, ROUND or IF. The tables below list every function that TX Text Control evaluates in a table formula, with its arguments, the defaults of optional arguments and what it returns. They apply to formulas set with TableCell.Formula in code, entered in the Document Editor and loaded with an Excel worksheet.
How a formula is built, how cells are referenced and how the result is formatted is explained in Tables of Document Processing.
How to Read the Tables
The functions follow their definitions in Office Open XML (ISO/IEC 29500-1, section 18.17.7, Predefined Function Definitions), which also describes the argument types, restrictions and return values in full. The signatures use this notation:
- Square brackets mark an optional argument:
LOG(x[,base])can be called asLOG(100)orLOG(8,2). The description says which value an omitted argument takes. - argument-list is one or more arguments separated by commas. Each can be a constant, a cell reference, a range such as
A1:A3, an array constant such as{1,2,3}or the result of another function. - array and reference stand for a range or a single cell reference.
- Function names are uppercase, and the parentheses are required even without arguments:
PI().
TableCollection.SupportedFormulaFunctions returns the names of the supported functions at runtime. With version 34.0 of the Core engine, it returns the 85 names below.
Mathematical and Trigonometric Functions
| Function | Description |
|---|---|
ABS(x) | The absolute value of x. |
ACOS(x) | The arc cosine of x. |
ACOSH(x) | The inverse hyperbolic cosine of x. |
ASIN(x) | The arc sine of x. |
ASINH(x) | The inverse hyperbolic sine of x. |
ATAN(x) | The arc tangent of x. |
ATAN2(x,y) | The arc tangent of the coordinates x and y. |
ATANH(x) | The inverse hyperbolic tangent of x. |
CEILING(x,significance) | x rounded up, away from zero, to the nearest multiple of significance. Positive and negative values are both rounded away from zero. |
COMBIN(number,number-chosen) | The number of groups of number-chosen objects that can be formed from number objects. |
COS(x) | The cosine of x. |
COSH(x) | The hyperbolic cosine of x. |
DEGREES(angle) | angle converted from radians to degrees. |
ECMA.CEILING(x,significance) | x rounded up, away from zero, to the nearest multiple of significance, as CEILING does. |
EVEN(x) | x rounded away from zero to the nearest even integer. |
EXP(x) | e raised to the power of x, where e is the base of the natural logarithm. |
FACT(x) | The factorial of x. |
FACTDOUBLE(n) | The double factorial of n. |
FLOOR(x,significance) | x rounded down, toward zero, to the nearest multiple of significance. |
GCD(argument-list) | The greatest common divisor of one or more numbers. |
INT(x) | x rounded down to an integer. |
ISO.CEILING(x[,significance]) | x rounded up to the nearest multiple of significance, whatever the sign of x. significance is 1 when it is omitted. |
LCM(argument-list) | The least common multiple of one or more numbers. |
LN(x) | The natural logarithm of x. |
LOG(x[,base]) | The logarithm of x to base. base is 10 when it is omitted. |
LOG10(x) | The logarithm of x to base 10. |
MOD(x,y) | The remainder of x divided by y. The result has the sign of y. |
MROUND(x,multiple) | x rounded away from zero to a multiple of multiple. It rounds up when the remainder of x divided by multiple is at least half of multiple, and down otherwise. |
MULTINOMIAL(argument-list) | The factorial of the sum of the values, divided by the product of their factorials. |
ODD(x) | x rounded away from zero to the nearest odd integer. |
PI() | The number π. |
POWER(x,y) | x raised to the power of y. |
PRODUCT(argument-list) | The product of the numeric values of the arguments. |
QUOTIENT(dividend,divisor) | The integer part of dividend divided by divisor. |
RADIANS(angle) | angle converted from degrees to radians. |
RAND() | A random real number, evenly distributed, from 0 up to but not including 1. |
RANDBETWEEN(lower-bound,upper-bound) | A random integer from lower-bound to upper-bound. |
ROUND(x,number-digits) | x rounded to number-digits digits. |
ROUNDDOWN(x,number-digits) | x rounded down, toward zero, to number-digits digits. |
ROUNDUP(x,number-digits) | x rounded up, away from zero, to number-digits digits. |
SERIESSUM(input-value,initial-power,step,coefficients) | The sum of a power series. |
SIGN(x) | The sign of x. |
SIN(x) | The sine of x. |
SINH(x) | The hyperbolic sine of x. |
SQRT(x) | The positive square root of x. |
SQRTPI(x) | The positive square root of x multiplied by π. |
SUM(argument-list) | The sum of the numeric values of the arguments. |
SUMSQ(argument-list) | The sum of the squares of the arguments. |
SUMX2MY2(array-1,array-2) | The sum of the differences of the squares of corresponding numbers in two arrays. |
SUMX2PY2(array-1,array-2) | The sum of the sums of the squares of corresponding numbers in two arrays. |
SUMXMY2(array-1,array-2) | The sum of the squares of the differences of corresponding numbers in two arrays. |
TAN(x) | The tangent of x. |
TANH(x) | The hyperbolic tangent of x. |
TRUNC(x[,number-digits]) | x truncated to number-digits decimal places. |
Statistical Functions
| Function | Description |
|---|---|
AVERAGE(argument-list) | The arithmetic mean of the numeric values of the arguments. |
COUNT(argument-list) | The number of arguments that are numbers, plus the number of referenced cells that contain numbers. Dates aren't counted. |
COUNTA(argument-list) | The number of arguments that aren't cell references, plus the number of referenced cells that aren't empty. Dates in arrays and in referenced cells aren't counted. |
COUNTBLANK(cell-range) | The number of empty cells in a range. A cell whose formula returns an empty string isn't counted. |
MAX(argument-list) | The largest of a set of numbers. |
MAXA(argument-list) | The largest of a set of numbers. |
MIN(argument-list) | The smallest of a set of numbers. |
MINA(argument-list) | The smallest of a set of numbers. |
Logical Functions
| Function | Description |
|---|---|
AND(argument-list) | TRUE if all arguments are TRUE. All arguments are evaluated before the result is returned. |
FALSE() | The value FALSE, the same as the logical constant FALSE. |
IF(logical-value,[value-if-true][,[value-if-false]]) | Evaluates and returns value-if-true when logical-value is TRUE, and value-if-false otherwise. |
NOT(logical-value) | The logical negation of logical-value. |
OR(argument-list) | TRUE if at least one argument is TRUE. All arguments are evaluated before the result is returned. |
TRUE() | The value TRUE, the same as the logical constant TRUE. |
Lookup and Reference Functions
| Function | Description |
|---|---|
ADDRESS(row-number,col-number[,[ref-type][,[A1-ref-style-flag][,sheet-name]]]) | The address of the cell in row-number and col-number, as text. |
CHOOSE(index,argument-list) | The argument of argument-list at position index. |
COLUMN([reference]) | The column number of reference. Without reference, the column of the cell that contains the formula. |
COLUMNS(array) | The number of columns of array. Only cell references and ranges are supported as array. |
ROW([reference]) | The row number of reference. Without reference, the row of the cell that contains the formula. |
ROWS(array) | The number of rows of array. Only cell references and ranges are supported as array. |
Information Functions
| Function | Description |
|---|---|
ISBLANK(value) | Whether value refers to an empty cell. |
ISEVEN(value) | Whether value is an even number or refers to a cell with an even number. |
ISLOGICAL(value) | Whether value is a logical value or refers to a cell with a logical value. |
ISNONTEXT(value) | Whether value isn't text and doesn't refer to a cell with text. An empty cell doesn't count as text. |
ISNUMBER(value) | Whether value is a number or refers to a cell with a number. |
ISODD(value) | Whether value is an odd number or refers to a cell with an odd number. |
ISREF(value) | Whether value is a cell reference. |
ISTEXT(value) | Whether value is text or refers to a cell with text. |
N(value) | value converted to a number. For a reference to a single cell, the value of that cell converted to a number. |
NA() | The error value #N/A. Writing #N/A in the formula has the same result. |
TYPE(value) | The type of value. For a reference to a single cell, the type of the value in that cell. |
Functions That Show UNSUPPORTED
A cell whose formula calls a function that isn't listed above, such as VLOOKUP, shows the text UNSUPPORTED in place of a result. This matters most for Excel worksheets, whose formulas become table formulas when they are loaded.
Text Control's separate list of supported Excel functions names two functions that aren't in the tables above:
| Function | Described as | With version 34.0.5 of the Core engine |
|---|---|---|
SUMIF | Applies selection criteria to the values of one range of cells and adds up the values of the corresponding cells in another range | Shows UNSUPPORTED, and SupportedFormulaFunctions doesn't return it |
AREAS | The number of areas a reference designates | Shows UNSUPPORTED, and SupportedFormulaFunctions doesn't return it |
To find out whether a function is available in the engine your application runs, check whether SupportedFormulaFunctions contains its name:
using TXTextControl;
using (ServerTextControl tx = new ServerTextControl())
{
tx.Create();
string[] functions = tx.Tables.SupportedFormulaFunctions;
Console.WriteLine($"{functions.Length} functions");
Console.WriteLine($"SUMIF supported: {functions.Contains("SUMIF")}");
}