Skip to main content

Matrix Formulas

The Matrix widget supports a comprehensive set of formulas that can be used in cell templates. Formulas follow Excel-style syntax and begin with =. This reference covers all available functions organized by category.

Cell Variables

Cell variables allow dynamic references to the current cell's properties. They are enclosed in curly braces {}.

Basic Cell Properties

VariableDescription
{value}The current cell's value
{spaceName}The name of the space containing this cell
{key}The cell's unique key
{row}The row index of the cell
{col}The column index of the cell
{label}The cell's display label
{formula}The formula assigned to this cell
{fieldType}The data type of the field
{isLeaf}Whether the cell is a leaf node (no children)
{hasLID}Whether the cell has a line item detail
{indent}The indentation level of the cell
{locked}Whether the cell is locked for editing

Cell Metadata

Access dimension metadata using the {meta.row.<index>.<property>} or {meta.col.<index>.<property>} syntax.

Row Metadata

VariableDescription
{meta.row.<index>.key}The key of the member at the specified row dimension index
{meta.row.<index>.name}The name of the member
{meta.row.<index>.caption}The display caption of the member
{meta.row.<index>.level}The hierarchy level of the member
{meta.row.<index>.parentKey}The key of the parent member
{meta.row.<index>.isLeaf}Whether the member is a leaf node
{meta.row.<index>.displayOnly}Whether the member is for display only
{meta.row.<index>.properties.<propertyKey>}Custom property value for the member

Column Metadata

VariableDescription
{meta.col.<index>.key}The key of the member at the specified column dimension index
{meta.col.<index>.name}The name of the member
{meta.col.<index>.caption}The display caption of the member
{meta.col.<index>.level}The hierarchy level of the member
{meta.col.<index>.parentKey}The key of the parent member
{meta.col.<index>.isLeaf}Whether the member is a leaf node
{meta.col.<index>.displayOnly}Whether the member is for display only
{meta.col.<index>.properties.<propertyKey>}Custom property value for the member

Cell Attributes

VariableDescription
{attributes.style}The style applied to the cell
{attributes.numberFormat}The number format string
{attributes.indentType}The type of indentation applied

Custom Functions

These functions are specific to Una's Matrix widget and provide powerful capabilities for cross-cell references and date calculations.

FINDCELL

Finds and returns the value of a cell within the current space based on dimension member criteria.

Syntax:

FINDCELL("<axis>.<dimensionIndex>", <memberKey>)
FINDCELL("<axis>.<dimensionIndex>", "<property>=<value>")
FINDCELL("<dimensionName>", <memberKey>)
FINDCELL("<dimensionName>", "<property>=<value>")

Parameters:

  • axis - Either row or col
  • dimensionIndex - The zero-based index of the dimension on that axis
  • dimensionName - The name of the dimension (alternative to axis.index format)
  • memberKey - A numeric key to match, or a property expression

Property expressions:

  • key=<number> - Match by member key
  • name=<string> - Match by member name
  • caption=<string> - Match by member caption

Examples:

Using axis and index:

=FINDCELL("row.0", 100)
=FINDCELL("col.1", "name=Revenue")
=FINDCELL("row.0", {meta.row.0.key})

Using dimension name:

=FINDCELL("Account", 100)
=FINDCELL("Period", "name=2024 Q1")
=FINDCELL("Department", "caption=Sales")
tip

Using dimension names is recommended over the row.index / col.index format as it makes formulas more readable and resilient to changes in dimension ordering.

FINDCELLIN

Finds and returns the value of a cell in a different space by matching dimension members.

Syntax:

FINDCELLIN("<spaceName>")
FINDCELLIN("<spaceName>", "<dimensionName>", <memberKey>)
FINDCELLIN("<spaceName>", "<dimensionName>", "<property>=<value>")

Parameters:

  • spaceName - The name of the target space to search
  • dimensionName - The name of the dimension to filter by
  • memberKey - A numeric key or property expression to match

When called with only the space name, it finds the cell matching all dimensions from the current cell's context.

Examples:

=FINDCELLIN("Budget")
=FINDCELLIN("Actuals", "Account", 500)
=FINDCELLIN("Forecast", "Period", "name=2024 Q1")

FINDCELLINROW

Same as FINDCELLIN, but limits the search to cells within the same row as the reference cell. This is useful when you cannot provide enough metadata to uniquely identify a single cell using FINDCELLIN, but you know the target cell is in the same row.

Syntax:

FINDCELLINROW("<spaceName>")
FINDCELLINROW("<spaceName>", "<dimensionName1>", <memberKey1>, "<dimensionName2>", <memberKey2>, ...)

Parameters:

  • spaceName - The name of the target space to search
  • dimensionName - The name of the dimension to filter by (can specify multiple pairs)
  • memberKey - A numeric key or property expression to match:
    • key=<number> - Match by member key
    • name=<string> - Match by member name
    • caption=<string> - Match by member caption

You may specify zero or more pairs of dimension names and member keys.

Examples:

=FINDCELLINROW("Budget")
=FINDCELLINROW("Actuals", "Period", 202401)
=FINDCELLINROW("Forecast", "Account", "name=Revenue", "Scenario", "caption=Base")

FINDCELLINCOL

Same as FINDCELLIN, but limits the search to cells within the same column as the reference cell. This is useful when you cannot provide enough metadata to uniquely identify a single cell using FINDCELLIN, but you know the target cell is in the same column.

Syntax:

FINDCELLINCOL("<spaceName>")
FINDCELLINCOL("<spaceName>", "<dimensionName1>", <memberKey1>, "<dimensionName2>", <memberKey2>, ...)

Parameters:

  • spaceName - The name of the target space to search
  • dimensionName - The name of the dimension to filter by (can specify multiple pairs)
  • memberKey - A numeric key or property expression to match:
    • key=<number> - Match by member key
    • name=<string> - Match by member name
    • caption=<string> - Match by member caption

You may specify zero or more pairs of dimension names and member keys.

Examples:

=FINDCELLINCOL("Budget")
=FINDCELLINCOL("YTD", "Account", "name=Revenue")
=FINDCELLINCOL("Actuals", "Period", "key=202501", "Department", 100)

DATEDIFF

Calculates a date offset based on period values with support for various calendar modes.

Syntax:

DATEDIFF(<period>, <offset>)
DATEDIFF(<period>, <offset>, "<mode>")
DATEDIFF(<period>, <offset>, "<mode>", "<template>")

Parameters:

  • period - A numeric period value (format depends on mode)
  • offset - The number of periods to add or subtract
  • mode - (Optional) The calendar mode (auto-detected if not specified)
  • template - (Optional) The format template for parsing/formatting

Supported Modes:

ModeDescriptionDefault Template
YEARAnnual periodsYYYY
QUARTERQuarterly periodsYYYYQ
MONTHMonthly periodsYYYYMM
52WEEKISO 52-week calendarYYYYWW
13WEEK13-week fiscal quartersYYYYQWW
4454-4-5 fiscal calendarYYYYPPWW
5445-4-4 fiscal calendarYYYYPPWW
4544-5-4 fiscal calendarYYYYPPWW
DAYDaily periodsYYYYMMDD

Template Formats:

TemplateFormatExample
YYYYYear only2026
YYYYQYear + Quarter20261
YYYYMMYear + Month202601
YYYYWWYear + Week202601
YYYYQWWYear + Quarter + Week2026101
YYYY52WWYear + "52" marker + Week20265201
YYYYMMDDYear + Month + Day20260115
YYYYPPWWYear + Period + Week20260104

Examples:

=DATEDIFF(202601, 1)                        // Auto-detect: 202602 (month mode)
=DATEDIFF(20261, 1) // Returns 20262 (quarter mode)
=DATEDIFF(202601, -3, "MONTH") // Returns 202510
=DATEDIFF(20265201, 1, "52WEEK", "YYYY52WW") // Returns 20265202
=DATEDIFF(20260104, 1, "445") // Returns 20260201 (next period)

ISERROR

Checks if a value is any type of error.

Syntax:

ISERROR(<value>)

Returns: TRUE if the value is an error, FALSE otherwise.

Recognized Errors: #VALUE!, #REF!, #DIV/0!, #N/A, #NAME?, #NULL!, #NUM!, #ERROR!

Examples:

=ISERROR(A1/B1)          // TRUE if division by zero
=ISERROR(FINDCELL(...)) // TRUE if cell not found

ISNA

Checks if a value is specifically the #N/A error.

Syntax:

ISNA(<value>)

Returns: TRUE if the value is #N/A, FALSE otherwise.

Examples:

=ISNA(FINDCELL("row.0", 999))  // TRUE if member 999 not found

IFERROR

Returns an alternate value if an expression results in an error.

Syntax:

IFERROR(<value>, <value_if_error>)

Parameters:

  • value - The expression to evaluate
  • value_if_error - The value to return if the first argument is an error

Examples:

=IFERROR(A1/B1, 0)                           // Returns 0 instead of #DIV/0!
=IFERROR(FINDCELLIN("Budget"), "N/A") // Returns "N/A" if not found

IFNA

Returns an alternate value if an expression results in #N/A specifically.

Syntax:

IFNA(<value>, <value_if_na>)

Parameters:

  • value - The expression to evaluate
  • value_if_na - The value to return if the first argument is #N/A

Other errors (like #VALUE!) will pass through unchanged.

Examples:

=IFNA(FINDCELL("row.0", 999), 0)  // Returns 0 if #N/A, keeps other errors

Standard Formulas

The following formulas are provided by the formula parser engine and work similarly to their Excel equivalents.

Constants

FormulaDescription
TRUEBoolean true value
FALSEBoolean false value

Arithmetic

FormulaDescription
ADD(a, b)Adds two numbers
MINUS(a, b)Subtracts b from a
MULTIPLY(a, b)Multiplies two numbers
DIVIDE(a, b)Divides a by b
POW(base, exp)Raises base to the power of exp
E()Returns Euler's number (~2.718)

Mathematical

FormulaDescription
ABS(n)Absolute value
CEILING(n)Rounds up to nearest integer
CEILINGMATH(n, [significance])Rounds up to nearest multiple
CEILINGPRECISE(n, [significance])Rounds up with precision
DEGREES(radians)Converts radians to degrees
EVEN(n)Rounds up to nearest even integer
EXP(n)Returns e^n
FACT(n)Factorial
FLOOR(n)Rounds down to nearest integer
INT(n)Truncates to integer
LN(n)Natural logarithm
LOG10(n)Base-10 logarithm
MOD(n, divisor)Modulo (remainder)
ODD(n)Rounds up to nearest odd integer
PI()Returns π (~3.14159)
POWER(base, exp)Same as POW
RADIANS(degrees)Converts degrees to radians
RAND()Random number between 0 and 1
ROUND(n, decimals)Rounds to specified decimals
ROUNDDOWN(n, decimals)Rounds down
ROUNDUP(n, decimals)Rounds up
SQRT(n)Square root
SUMSQ(values...)Sum of squares
TRUNC(n, [decimals])Truncates to specified decimals

Trigonometric

FormulaDescription
ACOS(n)Arccosine
ACOSH(n)Hyperbolic arccosine
ACOT(n)Arccotangent
ACOTH(n)Hyperbolic arccotangent
ASIN(n)Arcsine
ASINH(n)Hyperbolic arcsine
ATAN(n)Arctangent
ATAN2(x, y)Arctangent of y/x
ATANH(n)Hyperbolic arctangent
COS(n)Cosine
COSH(n)Hyperbolic cosine
COT(n)Cotangent
COTH(n)Hyperbolic cotangent
CSC(n)Cosecant
CSCH(n)Hyperbolic cosecant
SEC(n)Secant
SECH(n)Hyperbolic secant
SIN(n)Sine
SINH(n)Hyperbolic sine
TAN(n)Tangent
TANH(n)Hyperbolic tangent

Statistical

FormulaDescription
AVERAGE(values...)Arithmetic mean
AVERAGEA(values...)Average including text and logical values
AVEDEV(values...)Average deviation from mean
COUNT(values...)Count of numbers
COUNTA(values...)Count of non-empty values
COUNTBLANK(range)Count of empty cells
COUNTIF(range, criteria)Conditional count
COUNTIFS(range1, criteria1, ...)Multiple criteria count
COUNTIN(values...)Count occurrences
COUNTUNIQUE(values...)Count unique values
DEVSQ(values...)Sum of squared deviations
FISHER(x)Fisher transformation
FISHERINV(y)Inverse Fisher transformation
FREQUENCY(data, bins)Frequency distribution
GEOMEAN(values...)Geometric mean
HARMEAN(values...)Harmonic mean
KURT(values...)Kurtosis
LARGE(array, k)K-th largest value
MAX(values...)Maximum value
MAXA(values...)Maximum including text and logical
MEDIAN(values...)Median value
MIN(values...)Minimum value
MINA(values...)Minimum including text and logical
MODE.MULT(values...)Multiple modes
MODE.SNGL(values...)Single mode
PEARSON(x, y)Pearson correlation coefficient
PERCENTILEEXC(array, k)K-th percentile (exclusive)
PERCENTILEINC(array, k)K-th percentile (inclusive)
PERCENTRANKEXC(array, x)Percentile rank (exclusive)
PERCENTRANKINC(array, x)Percentile rank (inclusive)
PERMUT(n, k)Permutations
PERMUTATIONA(n, k)Permutations with repetition
QUARTILE.EXC(array, q)Quartile (exclusive)
QUARTILE.INC(array, q)Quartile (inclusive)
RANK.AVG(n, array)Rank with average for ties
RANK.EQ(n, array)Rank with equal for ties
SKEW(values...)Skewness
SKEW.P(values...)Population skewness
SMALL(array, k)K-th smallest value
STANDARDIZE(x, mean, stddev)Standardized value
STDEV.P(values...)Population standard deviation
STDEV.S(values...)Sample standard deviation
TRIMMEAN(array, percent)Trimmed mean
VAR.P(values...)Population variance
VAR.S(values...)Sample variance

Logical

FormulaDescription
AND(conditions...)All conditions true
OR(conditions...)Any condition true
NOT(condition)Negates a condition
IF(condition, true_val, false_val)Conditional
XOR(conditions...)Exclusive OR
SWITCH(expr, case1, val1, ...)Switch/case statement
TRUE()Returns TRUE
FALSE()Returns FALSE

Logical/Comparison

FormulaDescription
DELTA(a, b)Returns 1 if a equals b, 0 otherwise
EQ(a, b)Returns TRUE if a equals b
GTE(a, b)Returns TRUE if a ≥ b
GESTEP(n, step)Returns 1 if n ≥ step
ISBINARY(n)Checks if value is binary
ISEVEN(n)Checks if number is even
ISODD(n)Checks if number is odd
LT(a, b)Returns TRUE if a < b
LTE(a, b)Returns TRUE if a ≤ b
NE(a, b)Returns TRUE if a ≠ b

Information

FormulaDescription
ISBLANK(value)Checks if cell is empty
ISEVEN(n)Checks if number is even
ISLOGICAL(value)Checks if value is logical
ISNONTEXT(value)Checks if value is not text
ISNUMBER(value)Checks if value is a number
ISTEXT(value)Checks if value is text

Text

FormulaDescription
CHAR(code)Character from ASCII code
CLEAN(text)Removes non-printable characters
CODE(char)ASCII code from character
CONCATENATE(text1, text2, ...)Joins text strings
FIND(find_text, within_text, [start])Position of substring
HTML2TEXT(html)Strips HTML tags
LEFT(text, [chars])Leftmost characters
LEN(text)Length of text
LOWER(text)Converts to lowercase
MID(text, start, chars)Substring
PROPER(text)Title case
REGEXEXTRACT(text, regex)Extract regex match
REGEXMATCH(text, regex)Test regex match
REGEXREPLACE(text, regex, replacement)Replace regex match
REPLACE(text, start, chars, new_text)Replace characters
REPT(text, times)Repeat text
RIGHT(text, [chars])Rightmost characters
SEARCH(find_text, within_text, [start])Case-insensitive find
SUBSTITUTE(text, old_text, new_text)Replace all occurrences
T(value)Converts to text
TRIM(text)Removes extra spaces
UNICHAR(code)Unicode character
UNICODE(char)Unicode code point
UPPER(text)Converts to uppercase

Date & Time

FormulaDescription
DATE(year, month, day)Creates a date
DATEVALUE(date_text)Converts text to date
DAY(date)Day of month
DAYS(end_date, start_date)Days between dates
DAYS360(start, end)Days using 360-day year
EDATE(date, months)Date plus months
EOMONTH(date, months)End of month
HOUR(time)Hour component
ISOWEEKNUM(date)ISO week number
MINUTE(time)Minute component
MONTH(date)Month component
NETWORKDAYS(start, end, [holidays])Working days
NOW()Current date and time
SECOND(time)Second component
TIME(hour, minute, second)Creates a time
TIMEVALUE(time_text)Converts text to time
TODAY()Current date
WEEKDAY(date)Day of week
WEEKNUM(date)Week number
YEAR(date)Year component
YEARFRAC(start, end, [basis])Fraction of year

Financial

FormulaDescription
DB(cost, salvage, life, period)Declining balance depreciation
DDB(cost, salvage, life, period)Double declining balance
FV(rate, periods, payment, [pv])Future value
FVSCHEDULE(principal, schedule)FV with variable rates
IPMT(rate, period, periods, pv)Interest payment
NPER(rate, payment, pv, [fv])Number of periods
PDURATION(rate, pv, fv)Periods for investment
PMT(rate, periods, pv, [fv])Periodic payment
PPMT(rate, period, periods, pv)Principal payment
PV(rate, periods, payment, [fv])Present value
RATE(periods, payment, pv, [fv])Interest rate
RRI(periods, pv, fv)Equivalent interest rate
SLN(cost, salvage, life)Straight-line depreciation
SYD(cost, salvage, life, period)Sum-of-years depreciation
XIRR(values, dates, [guess])IRR with dates
XNPV(rate, values, dates)NPV with dates

Lookup & Reference

FormulaDescription
CHOOSE(index, val1, val2, ...)Choose from list
MATCH(lookup, array, [type])Position of value in array

Conversion

FormulaDescription
BASE(n, radix, [min_length])Convert to base
BIN2DEC(binary)Binary to decimal
BIN2HEX(binary)Binary to hexadecimal
BIN2OCT(binary)Binary to octal
CONVERT(n, from_unit, to_unit)Unit conversion
DECIMAL(text, radix)Text to decimal

Bitwise

FormulaDescription
BITAND(a, b)Bitwise AND
BITOR(a, b)Bitwise OR
BITXOR(a, b)Bitwise XOR
BITLSHIFT(n, shift)Left bit shift
BITRSHIFT(n, shift)Right bit shift

Complex Numbers

FormulaDescription
COMPLEX(real, imaginary)Create complex number
IMABS(complex)Absolute value
IMAGINARY(complex)Imaginary coefficient
IMARGUMENT(complex)Argument (angle)
IMCONJUGATE(complex)Complex conjugate
IMCOS(complex)Cosine
IMCOSH(complex)Hyperbolic cosine
IMCOT(complex)Cotangent
IMCSC(complex)Cosecant
IMCSCH(complex)Hyperbolic cosecant
IMDIV(a, b)Division
IMEXP(complex)Exponential
IMLN(complex)Natural log
IMLOG10(complex)Base-10 log
IMLOG2(complex)Base-2 log
IMPOWER(complex, n)Power
IMPRODUCT(complexes...)Product
IMREAL(complex)Real coefficient
IMSEC(complex)Secant
IMSECH(complex)Hyperbolic secant
IMSIN(complex)Sine
IMSINH(complex)Hyperbolic sine
IMSQRT(complex)Square root
IMSUB(a, b)Subtraction
IMSUM(complexes...)Sum
IMTAN(complex)Tangent

Distribution Functions

FormulaDescription
BETA.DIST(x, alpha, beta, cumulative)Beta distribution
BETA.INV(p, alpha, beta)Inverse beta
BINOM.DIST(successes, trials, prob, cumulative)Binomial distribution
BINOM.DIST.RANGE(trials, prob, s, s2)Binomial range
BINOM.INV(trials, prob, alpha)Inverse binomial
CHISQ.DIST(x, df, cumulative)Chi-squared distribution
CHISQ.DIST.RT(x, df)Right-tailed chi-squared
CHISQ.INV(p, df)Inverse chi-squared
CHISQ.INV.RT(p, df)Right-tailed inverse
ERF(lower, [upper])Error function
ERFC(x)Complementary error function
EXPON.DIST(x, lambda, cumulative)Exponential distribution
F.DIST(x, df1, df2, cumulative)F distribution
F.DIST.RT(x, df1, df2)Right-tailed F
F.INV(p, df1, df2)Inverse F
F.INV.RT(p, df1, df2)Right-tailed inverse F
GAMMA.DIST(x, alpha, beta, cumulative)Gamma distribution
GAMMA.INV(p, alpha, beta)Inverse gamma
HYPGEOM.DIST(s, n, S, N, cumulative)Hypergeometric
LOGNORM.DIST(x, mean, stddev, cumulative)Lognormal distribution
LOGNORM.INV(p, mean, stddev)Inverse lognormal
NEGBINOM.DIST(failures, successes, prob, cumulative)Negative binomial
NORM.DIST(x, mean, stddev, cumulative)Normal distribution
NORM.INV(p, mean, stddev)Inverse normal
NORM.S.DIST(z, cumulative)Standard normal
NORM.S.INV(p)Inverse standard normal
POISSON.DIST(x, mean, cumulative)Poisson distribution
PROB(x_range, prob_range, lower, [upper])Probability
T.DIST(x, df, cumulative)Student's t distribution
T.DIST.2T(x, df)Two-tailed t
T.DIST.RT(x, df)Right-tailed t
T.INV(p, df)Inverse t
T.INV.2T(p, df)Two-tailed inverse t
WEIBULL.DIST(x, alpha, beta, cumulative)Weibull distribution

Regression

FormulaDescription
FORECAST(x, known_y, known_x)Predicted value
GROWTH(known_y, known_x, new_x)Exponential growth
INTERCEPT(known_y, known_x)Y-intercept
LINEST(known_y, known_x)Linear regression
LOGEST(known_y, known_x)Exponential regression
RSQ(known_y, known_x)R-squared value
SLOPE(known_y, known_x)Slope of regression line
STEYX(known_y, known_x)Standard error
TREND(known_y, known_x, new_x)Linear trend values

Other Functions

FormulaDescription
ARGS2ARRAY(values...)Convert args to array
BESSELI(x, n)Modified Bessel I function
BESSELJ(x, n)Bessel J function
BESSELK(x, n)Modified Bessel K function
BESSELY(x, n)Bessel Y function
FLATTEN(array)Flatten nested array
GAMMA(n)Gamma function
GAMMALN(n)Log gamma function
GAMMALN.PRECISE(n)Precise log gamma
GAUSS(z)Gaussian distribution
INTERVAL(seconds)Format time interval
NUMBERS(values...)Extract numbers
PHI(x)Standard normal PDF
REFERENCE(ref)Get cell reference
SERIESSUM(x, n, m, coefficients)Power series sum

Error Handling

Formula errors are indicated with standard error codes:

ErrorDescription
#VALUE!Invalid value or argument type
#REF!Invalid cell reference
#DIV/0!Division by zero
#N/AValue not available
#NAME?Unknown function name
#NULL!Null intersection
#NUM!Invalid numeric value
#ERROR!General error

Use IFERROR or IFNA to handle errors gracefully:

=IFERROR(A1/B1, 0)
=IFNA(FINDCELLIN("Budget"), "Not Found")