# Formula Functions

> Check the arguments and defaults of the 85 functions a WPF table formula can call, from SUM and ROUND to COUNTA, and the Excel functions of XLSX worksheets.

- **Product:** TX Text Control .NET for WPF
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET for WPF > API Reference > Formula Functions
- **3250 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/formula-functions/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/formula-functions/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/formula-functions/llms-full.txt

---

`SUM`, `ROUND`, `IF` and the other functions of a table formula do most of the calculating in a table cell. The tables below list every function that TX Text Control evaluates in a table formula, with its arguments, the value an omitted argument takes and what the function returns. They apply to formulas that users enter on the **Formulas** tab of the ribbon, that your code sets with `TableCell.Formula` and that arrive with a loaded Excel worksheet.

Constants, operators, cell references and number formats are explained in [Calculate With Formulas](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/tables/#calculate-with-formulas) of Tables and Table Formulas.

### How to Read the Tables

Office Open XML defines the functions (ISO/IEC 29500-1, section 18.17.7, Predefined Function Definitions), and that chapter gives their argument types, restrictions and return values in full. The signatures below use this notation:

- **Square brackets** mark an optional argument: `LOG(x[,base])` is called as `LOG(100)` or as `LOG(8,2)`. The description says which value an omitted argument takes.
- **argument-list** is one or more arguments separated by commas. Each one is 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 when there is no argument: `PI()`.

[TableCollection.SupportedFormulaFunctions](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tablecollection/supportedformulafunctions-property/llms-full.txt) returns the names of the supported functions at runtime.

### 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, the same as `CEILING`. |
| `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. |

### Excel Functions in Loaded Worksheets

`StreamType.SpreadsheetML` loads a worksheet of an XLSX file as a table, as described in [Supported File Formats](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/overview/file-formats/#excel-worksheets-xlsx). The formulas of the worksheet become table formulas, and TX Text Control calculates them with the functions of the tables above. Text Control's list of supported Excel functions names these:

| Group | Functions |
|---|---|
| Mathematical and trigonometric | `ABS`, `ACOS`, `ACOSH`, `ASIN`, `ASINH`, `ATAN2`, `ATANH`, `CEILING`, `COMBIN`, `COS`, `COSH`, `DEGREES`, `ECMA.CEILING`, `EVEN`, `EXP`, `FACT`, `FACTDOUBLE`, `FLOOR`, `GCD`, `INT`, `ISO.CEILING`, `LCM`, `LN`, `LOG`, `LOG10`, `MOD`, `MROUND`, `ODD`, `PI`, `POWER`, `PRODUCT`, `QUOTIENT`, `RADIANS`, `RAND`, `RANDBETWEEN`, `ROUND`, `ROUNDDOWN`, `ROUNDUP`, `SIGN`, `SIN`, `SINH`, `SQRT`, `SQRTPI`, `SUM`, `SUMIF`, `TAN`, `TANH` |
| Statistical | `AVERAGE`, `AREAS`, `MAX`, `MAXA`, `MIN`, `MINA` |
| Lookup and reference | `ADDRESS`, `ROW` |

The other functions of the tables above, such as `ATAN`, `COUNT` or `AND`, belong to the same set of table formula functions. Two names of the Excel list are not in the list of formula functions:

| Function | Described as |
|---|---|
| `SUMIF` | Applies selection criteria to the values of one range of cells and adds up the values of the corresponding cells in another range |
| `AREAS` | The number of areas a reference designates |

Before you rely on one of them, or on any function of a worksheet you load, check whether `SupportedFormulaFunctions` contains its name. The following handler in *MainWindow.xaml.cs* of a window with a `TextControl` named `textControl1` shows the number of supported functions and whether `SUMIF` is one of them:

```csharp
using System;
using System.Windows;

namespace SampleApp;

public partial class MainWindow : Window
{
    private void CheckFunctions_Click(object sender, RoutedEventArgs e)
    {
        // The names of all functions a table formula can call
        string[] functions = textControl1.Tables.SupportedFormulaFunctions;

        bool sumIf = Array.IndexOf(functions, "SUMIF") >= 0;

        MessageBox.Show($"{functions.Length} functions, SUMIF supported: {sumIf}");
    }
}
```

[TextControl.Tables](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/tables-property/llms-full.txt) returns the `TableCollection` of the main text, and `SupportedFormulaFunctions` is a read-only array of function names.

### Related Pages

- [Tables and Table Formulas](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/tables/#calculate-with-formulas): the formula syntax, cell references, number formats and the **Formulas** tab.
- [Tables and Calculations](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-processing/tables/#calculate-with-formulas): add formula cells to tables in code.
- [Supported File Formats](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/overview/file-formats/#excel-worksheets-xlsx): load a worksheet of an XLSX file as a table.

---

## Nearby

- **Previous:** [Classes by Task](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/dotnet-api/tasks/llms-full.txt)
