Functions

Function Catalog

Function Catalog

Auto-generated reference for the 548 built-in functions in Grid.

Do not hand-edit. Regenerate with npm run generate:language-docs.

Functions are grouped by category. Within each category they are sorted alphabetically. The signature shows positional parameter names and types; ...name indicates the variadic tail.

Category Count Focus
Math 115 Arithmetic, rounding, matrix algebra, calculus, and numeric helpers.
Text 44 String manipulation, parsing, regex, formatting, and template helpers.
Logical 18 Boolean logic, conditional dispatch, and predicates.
Date & Time 25 Date/time arithmetic, formatting, and calendar helpers.
Lookup & Reference 45 Range and table lookups, joins, sorting, filtering.
Financial 55 Time-value-of-money, depreciation, bond math, and other finance helpers.
Statistical 115 Descriptive statistics, distributions, regression, and hypothesis tests.
Information 20 Type predicates, error inspection, and metadata accessors.
Engineering 57 Bit operations, base conversions, complex numbers, and engineering helpers.
Domain Types 39 URL, molecule, DNA, color, musical note, and bytes accessors and constructors.
Database 12 Database-style aggregations over criteria-defined ranges.
External (Async) 3 Functions that execute asynchronously in worker processes.

Total: 548 functions.

For function-call syntax, see reference.md. For external (async) functions, see external-functions.md. For error semantics, see errors.md.


Math

Arithmetic, rounding, matrix algebra, calculus, and numeric helpers.

Function count: 115.

Function Returns Notes
ABS(number: number) → number number Returns the absolute value of a number.
ACOS(v: number) → number number Returns the arccosine (inverse cosine) in radians.
ACOSH(v: number) → number number Returns the inverse hyperbolic cosine.
ACOT(v: number) → number number Returns the arccotangent (inverse cotangent) in radians.
ACOTH(v: number) → number number Returns the hyperbolic arccotangent.
AGGREGATE(function_num: number, options: number, ...ref: number[]) → number number variadic. Returns an aggregate in a list, with options to ignore errors and hidden values.
ARABIC(text: string) → number number Converts a Roman numeral string to an Arabic number.
ASIN(v: number) → number number Returns the arcsine (inverse sine) in radians.
ASINH(v: number) → number number Returns the inverse hyperbolic sine.
ATAN(v: number) → number number Returns the arctangent (inverse tangent) in radians.
ATAN2(x: number, y: number) → number number Returns the arctangent from x and y coordinates.
ATANH(v: number) → number number Returns the inverse hyperbolic tangent.
AVERAGE(...values: number[]) → number number variadic. Returns the arithmetic mean of the supplied arguments.
AVERAGEIF(range: array, criteria: any, average_range: array) → number number variadic. Averages cells that match a condition.
AVERAGEIFS(average_range: array, ...criteria_range: array, ...criteria: any) → number number variadic. Averages cells that meet multiple criteria.
BASE(number: number, radix: number, min_length: number) → string string Converts a number to text in a given base.
CEILING(value: number, significance: number) → number number Rounds a number up to the nearest multiple of significance.
CEILING_MATH(number: number, significance: number, mode: number) → number number Rounds a number up to the nearest integer or multiple of significance.
CEILING_PRECISE(number: number, significance: number) → number number Rounds a number up to the nearest integer or multiple (alias for CEILING.MATH).
COMBIN(n: number, k: number) → number number Returns the number of combinations for a given number of objects.
COMBINA(n: number, k: number) → number number Returns the number of combinations with repetitions.
CONCATENATE(...values: string[]) → string string variadic. Concatenates strings (legacy alias for CONCAT).
COS(v: number) → number number Returns the cosine of an angle in radians.
COSH(v: number) → number number Returns the hyperbolic cosine.
COSINE_SIMILARITY(left: array, right: array) → number number Returns the cosine similarity between two arrays after flattening them row by row.
COT(v: number) → number number Returns the cotangent of an angle in radians.
COTH(v: number) → number number Returns the hyperbolic cotangent.
COUNT(...values: any[]) → number number variadic. Counts arguments that contain numeric values.
COUNTA(...values: any[]) → number number variadic. Counts arguments that are not empty.
COUNTBLANK(...values: any[]) → number number variadic. Counts blank cells in a range.
COUNTIF(range: array, criteria: any) → number number Counts cells that match a condition.
COUNTIFS(...criteria_range: array, ...criteria: any) → number number variadic. Counts cells that meet multiple criteria.
CROSS(left: array, right: array) → array array Returns the three-dimensional cross product of two vectors.
CSC(v: number) → number number Returns the cosecant of an angle in radians.
CSCH(v: number) → number number Returns the hyperbolic cosecant.
DECIMAL(text: string, radix: number) → number number Converts a text representation of a number in a given base to decimal.
DEGREES(radians: number) → number number Converts radians to degrees.
DERIVATIVE(fn: lambda, x: number, h: number) → number number Approximates the derivative of a lambda at a point using a central difference.
DIAG(values: array) → array array Builds a diagonal matrix from a vector.
DISTANCE(left: array, right: array, p: number) → number number Returns the p-distance between two arrays after flattening them row by row.
DOT(left: array, right: array) → number number Returns the dot product of two arrays after flattening them row by row.
EVEN(value: number) → number number Rounds a number up to the nearest even integer.
EXP(value: number) → number number Returns e raised to the power of a number.
FACT(value: number) → number number Returns the factorial of a number.
FACTDOUBLE(value: number) → number number Returns the double factorial of a number.
FLOOR(value: number, significance: number) → number number Rounds a number down to the nearest multiple of significance.
FLOOR_MATH(number: number, significance: number, mode: number) → number number Rounds a number down to the nearest integer or multiple of significance.
FLOOR_PRECISE(number: number, significance: number) → number number Rounds a number down to the nearest integer or multiple (alias for FLOOR.MATH).
GCD(...values: number[]) → number number variadic. Returns the greatest common divisor.
GETDIAGONAL(matrix: array) → array array Returns the diagonal of a matrix as a column vector.
INT(value: number) → number number Rounds a number down to the nearest integer.
INTEGRATE(fn: lambda, start: number, end: number, segments: number) → number number Approximates the definite integral of a lambda using the trapezoidal rule.
INTERPOLATE.LINEAR(x: number, xs: array, ys: array) → number number Interpolates or extrapolates linearly from paired x/y samples.
ISEVEN(v: number) → boolean boolean Returns TRUE if the number is even.
ISO_CEILING(number: number, significance: number) → number number Rounds up to the nearest integer or multiple (ISO standard).
ISODD(v: number) → boolean boolean Returns TRUE if the number is odd.
KRONECKERPRODUCT(left: array, right: array) → array array Returns the Kronecker product of two matrices.
LCM(...values: number[]) → number number variadic. Returns the least common multiple.
LN(value: number) → number number Returns the natural logarithm of a number.
LOG(value: number, base: number) → number number Returns the logarithm of a number to a specified base.
LOG10(value: number) → number number Returns the base-10 logarithm of a number.
MATRIXRANK(matrix: array) → number number Returns the rank of a matrix.
MAX(...values: number[]) → number number variadic. Returns the maximum of the supplied arguments.
MDETERM(matrix: array) → number number Returns the determinant of a square matrix.
MEDIAN(...values: number[]) → number number variadic. Returns the median of the supplied arguments.
MIN(...values: number[]) → number number variadic. Returns the minimum of the supplied arguments.
MINVERSE(matrix: array) → array array Returns the inverse of a square matrix.
MMULT(left: array, right: array) → array array Returns the matrix product of two arrays.
MOD(number: number, divisor: number) → number number Returns the remainder of a division.
MPOWER(matrix: array, exponent: number) → array array Raises a square matrix to an integer power.
MROUND(value: number, multiple: number) → number number Returns a number rounded to the desired multiple.
MULTINOMIAL(...values: number[]) → number number variadic. Returns the multinomial of a set of numbers.
MUNIT(size: number) → array array Returns an identity matrix of the requested size.
NORM(vector: array, p: number) → number number Returns the p-norm of an array after flattening it row by row.
NORMALIZE(vector: array) → array array Returns a unit-length version of a vector.
ODD(value: number) → number number Rounds a number up to the nearest odd integer.
OUTERPRODUCT(left: array, right: array) → array array Returns the outer product of two arrays after flattening them row by row.
PERMUT(n: number, k: number) → number number Returns the number of permutations for a given number of objects.
PI() → number number Returns the value of pi.
POLYFIT(xs: array, ys: array, degree: number) → array array Fits a polynomial of the requested degree and returns coefficients from highest degree to lowest.
POLYVAL(coefficients: array, x: number) → number number Evaluates a polynomial at x using coefficients ordered from highest degree to lowest.
POWER(base: number, exponent: number) → number number Returns a number raised to a power.
PRODUCT(...values: number[]) → number number variadic. Returns the product of the supplied arguments.
QUOTIENT(numerator: number, denominator: number) → number number Returns the integer portion of a division.
RADIANS(degrees: number) → number number Converts degrees to radians.
RAND() → number number volatile. Returns a random number between 0 and 1.
RANDARRAY(rows: number, cols: number, min_val: number, max_val: number) → array array volatile. Returns an array of random numbers (Excel 365).
RANDBETWEEN(bottom: number, top: number) → number number volatile. Returns a random integer between two values.
ROMAN(value: number) → string string Converts an Arabic numeral to a Roman numeral string.
ROOT(fn: lambda, lower: number, upper: number, tolerance: number, max_iterations: number) → number number Finds a root of a lambda over a bracketing interval using bisection.
ROUND(number: number, digits: number) → number number Rounds a number to the specified number of digits.
ROUNDDOWN(value: number, digits: number) → number number Rounds a number down, toward zero.
ROUNDUP(value: number, digits: number) → number number Rounds a number up, away from zero.
RREF(matrix: array) → array array Returns the reduced row echelon form of a matrix.
SEC(v: number) → number number Returns the secant of an angle in radians.
SECH(v: number) → number number Returns the hyperbolic secant.
SERIESSUM(x: number, n: number, m: number, coefficients: number[]) → number number Returns the sum of a power series.
SIGN(value: number) → number number Returns the sign of a number: 1, 0, or -1.
SIN(v: number) → number number Returns the sine of an angle in radians.
SINH(v: number) → number number Returns the hyperbolic sine.
SOLVE(coefficients: array, rhs: array) → array array Solves a linear system Ax = b for x.
SQRT(value: number) → number number Returns the square root of a number.
SUBTOTAL(function_num: number, ...ref: number[]) → number number variadic. Returns a subtotal using a specified function number (1=AVERAGE, 2=COUNT, 3=COUNTA, 4=MAX, 5=MIN, 6=PRODUCT, 7=STDEV, 9=SUM).
SUM(...values: number[]) → number number variadic. Returns the sum of the supplied arguments.
SUMIF(range: array, criteria: any, sum_range: array) → number number variadic. Sums cells that match a condition.
SUMIFS(sum_range: array, ...criteria_range: array, ...criteria: any) → number number variadic. Sums cells that meet multiple criteria.
SUMPRODUCT(...array: number[]) → number number variadic. Returns the sum of element-wise products of arrays.
SUMSQ(...values: number[]) → number number variadic. Returns the sum of squares of the arguments.
SUMX2MY2(arr_x: number[], arr_y: number[]) → number number Returns the sum of the difference of squares of corresponding values.
SUMX2PY2(arr_x: number[], arr_y: number[]) → number number Returns the sum of the sum of squares of corresponding values.
SUMXMY2(arr_x: number[], arr_y: number[]) → number number Returns the sum of squares of differences of corresponding values.
TAN(v: number) → number number Returns the tangent of an angle in radians.
TANH(v: number) → number number Returns the hyperbolic tangent.
TRACE(matrix: array) → number number Returns the sum of the diagonal of a square matrix.
TRUNC(value: number, digits: number) → number number Truncates a number to an integer by removing the fractional part.

Text

String manipulation, parsing, regex, formatting, and template helpers.

Function count: 44.

Function Returns Notes
ARRAYTOTEXT(arr: array, format: number) → string string Returns an array of values as text (Excel 365).
CHAR(code: number) → string string Returns the character for a given character code.
CLEAN(value: string) → string string Removes non-printable characters from text.
CODE(text: string) → number number Returns the character code of the first character.
CONCAT(...values: string[]) → string string variadic. Concatenates text arguments.
DOLLAR(value: number, decimals: number) → string string Formats a number as currency text.
ENCODEURL(text: string) → string string URL-encodes a string.
EXACT(text1: string, text2: string) → boolean boolean Checks whether two strings are exactly equal (case-sensitive).
FIND(find_text: string, within_text: string, start_pos: number) → number number Finds the position of a substring (case-sensitive).
FINDB(find_text: string, within_text: string, start_pos: number) → number number Finds the byte position of text (same as FIND in UTF-8).
FIXED(value: number, decimals: number, no_commas: boolean) → string string Formats a number as text with a fixed number of decimal places.
HYPERLINK(url: string, friendly_name: string) → string string Returns the friendly name for a hyperlink (or the URL if no friendly name).
LEFT(value: string, count: number) → string string Returns the leftmost characters from a string.
LEFTB(value: string, count: number) → string string Returns the leftmost bytes (same as LEFT in UTF-8).
LEN(value: string) → number number Returns the length of a string.
LENB(value: string) → number number Returns the byte length of text (same as LEN in UTF-8).
LOWER(value: string) → string string Converts text to lowercase.
MID(value: string, start_pos: number, count: number) → string string Returns characters from the middle of a string.
MIDB(value: string, start_pos: number, count: number) → string string Returns bytes from the middle of text (same as MID in UTF-8).
NUMBERVALUE(text: string, decimal_sep: string, group_sep: string) → number number Converts text to a number in a locale-independent way.
PROPER(value: string) → string string Capitalizes the first letter of each word.
REGEXEXTRACT(text: string, pattern: string, group: number) → string string Extracts the first regex match or capture group from text.
REGEXMATCH(text: string, pattern: string) → boolean boolean Returns TRUE when text matches a supported regex pattern.
REGEXREPLACE(text: string, pattern: string, replacement: string) → string string Replaces all matches of a supported regex pattern.
REPLACE(old_text: string, start_pos: number, num_chars: number, new_text: string) → string string Replaces part of a string with another string based on position.
REPT(text: string, times: number) → string string Repeats text a given number of times.
RIGHT(value: string, count: number) → string string Returns the rightmost characters from a string.
RIGHTB(value: string, count: number) → string string Returns the rightmost bytes (same as RIGHT in UTF-8).
SEARCH(find_text: string, within_text: string, start_pos: number) → number number Finds the position of a substring (case-insensitive).
SEARCHB(find_text: string, within_text: string, start_pos: number) → number number Searches for byte position case-insensitively (same as SEARCH in UTF-8).
SPLIT(text: string, delimiter: string) → string string Splits text by a delimiter (Google Sheets).
SUBSTITUTE(text: string, old_text: string, new_text: string, instance: number) → string string Replaces occurrences of old_text with new_text. Optional instance number replaces only the Nth occurrence.
T(value: any) → string string Returns text if the value is text, otherwise empty string.
TEXT(value: number, format: string) → string string Formats a number as text with a format string (simplified).
TEXTAFTER(text: string, delimiter: string, instance: number) → string string Returns text after a delimiter (Excel 365).
TEXTBEFORE(text: string, delimiter: string, instance: number) → string string Returns text before a delimiter (Excel 365).
TEXTJOIN(delimiter: string, ignore_empty: boolean, ...text: string[]) → string string variadic. Joins text with a delimiter, optionally ignoring empty values.
TRIM(value: string) → string string Removes leading, trailing, and excess interior spaces.
UNICHAR(code: number) → string string Returns the Unicode character for a code point.
UNICODE(text: string) → number number Returns the Unicode code point of the first character.
UPPER(value: string) → string string Converts text to uppercase.
VALUE(text: string) → number number Converts a text string to a number.
VALUETOTEXT(value: any) → string string Converts any value to text (Excel 365).
WILDCARDMATCH(text: string, pattern: string, case_sensitive: boolean) → boolean boolean Returns TRUE when text matches a simple wildcard pattern using * and ?.

Logical

Boolean logic, conditional dispatch, and predicates.

Function count: 18.

Function Returns Notes
AND(...values: boolean[]) → boolean boolean variadic. Returns TRUE when all values are truthy.
CLAMP(value: number, lower: number, upper: number) → number number Constrains a value to lie within a lower and upper bound.
DELTA(value: any) → number number Returns the change from the previous value (value - value@-1). Requires temporal history.
FALSE() → boolean boolean Returns the logical value FALSE.
GROWTH(from_value: number, to_value: number) → number number Returns the growth rate from the first value to the second.
IF(condition: boolean, when_true: any, when_false: any) → any any Returns one of two values based on a condition.
IFERROR(value: any, alternative: any) → any any Returns a value if it is not an error, otherwise returns an alternative.
IFNA(value: any, alternative: any) → any any Returns a value if it is not #N/A, otherwise returns an alternative.
IFS(...logical_test: any[], ...value_if_true: any) → any any variadic. Evaluates conditions in order and returns the value for the first TRUE condition.
IN(value: any, ...set: any[]) → boolean boolean variadic. Returns TRUE when a value is contained in the supplied set or array.
NOT(value: boolean) → boolean boolean Negates a boolean value.
OR(...values: boolean[]) → boolean boolean variadic. Returns TRUE when any value is truthy.
PERCENTOF(value: number, total: number) → number number Returns what percentage the first value is of the second value.
SWITCH(expression: any[], ...value: any, ...result: any) → any any variadic. Evaluates an expression against a list of values and returns the matching result.
TAP(value: any, label: string) → any any Identity function that passes through its value unchanged. Useful for pipeline inspection.
TRUE() → boolean boolean Returns the logical value TRUE.
UNCERTAIN(mean: number, uncertainty: number) → object object Creates a value with uncertainty (mean ± uncertainty).
XOR(...values: boolean[]) → boolean boolean variadic. Returns TRUE when an odd number of arguments are truthy.

Date & Time

Date/time arithmetic, formatting, and calendar helpers.

Function count: 25.

Function Returns Notes
DATE(year: number, month: number, day: number) → date date Constructs a date from year, month, and day.
DATEDIF(start_date: date, end_date: date, unit: string) → number number Calculates the difference between two dates in various units.
DATEVALUE(value: string) → date date Converts a date string to a date value.
DAY(value: date) → number number Returns the day component of a date (1-31).
DAYS(end_date: date, start_date: date) → number number Returns the number of days between two dates.
DAYS360(start_date: date, end_date: date, method: boolean) → number number Returns the number of days between two dates based on a 360-day year.
EDATE(value: date, months: number) → date date Returns a date that is a specified number of months before or after a date.
EOMONTH(value: date, months: number) → date date Returns the last day of the month, a specified number of months before or after a date.
HOUR(value: date) → number number Returns the hour from a time value (0-23).
ISOWEEKNUM(value: date) → number number Returns the ISO week number of the year.
MINUTE(value: date) → number number Returns the minute from a time value (0-59).
MONTH(value: date) → number number Returns the month component of a date (1-12).
NETWORKDAYS(start_date: date, end_date: date) → number number Returns the number of working days between two dates.
NETWORKDAYS_INTL(start_date: date, end_date: date, weekend: number) → number number Returns working days between dates with custom weekend specification.
NOW() → date date volatile. Returns the current date and time.
SECOND(value: date) → number number Returns the second from a time value (0-59).
TIME(hour: number, minute: number, second: number) → string string Returns a time value from hour, minute, second.
TIMEVALUE(value: string) → number number Converts a time string to a decimal fraction of a day.
TODAY() → date date volatile. Returns the current date.
WEEKDAY(value: date) → number number Returns the day of the week (1=Sunday, 7=Saturday).
WEEKNUM(value: date) → number number Returns the week number of a date in the year.
WORKDAY(start_date: date, days: number) → date date Returns a date that is a given number of working days from a start date.
WORKDAY_INTL(start_date: date, days: number, weekend: number) → date date Returns a date offset by working days with custom weekend specification.
YEAR(value: date) → number number Returns the year component of a date.
YEARFRAC(start_date: date, end_date: date, basis: number) → number number Returns the year fraction between two dates.

Lookup & Reference

Range and table lookups, joins, sorting, filtering.

Function count: 45.

Function Returns Notes
ADDRESS(row: number, col: number, abs_type: number) → string string Returns a cell reference as text.
CHOOSE(index_num: number, ...value: any[]) → any any variadic. Returns a value from a list of values based on an index number.
CHOOSECOLS(array: array, ...col_num: number[]) → array array variadic. Returns specified columns from an array (Excel 365).
CHOOSEROWS(array: array, ...row_num: number[]) → array array variadic. Returns specified rows from an array (Excel 365).
COLUMN(value: number) → number number Returns the column number of a reference.
COLUMN_BY_HEADER(range: array, header: string) → array array Selects a column from a range by matching header name in the first row.
COLUMNS(arr: array) → number number Returns the number of columns in an array.
DROP(arr: array, rows: number, cols: number) → array array Drops rows or columns from the start or end of an array (Excel 365).
EXCEPT(a: array, b: array) → array array Returns elements from the first array not in the second.
EXCLUDE(a: array, b: any) → array array Returns elements from the first array excluding elements matching the second.
EXPAND(arr: array, rows: number, cols: number, pad: any) → array array Expands an array to specified dimensions, filling with a pad value (Excel 365).
FILL(value: any, rows: number, cols: number) → array array Builds a rows × cols array with every cell set to value.
FILTER(arr: array, include: array, if_empty: any) → array array Filters a range based on criteria (Excel 365 / Google Sheets).
HLOOKUP(lookup: any, table_array: array, row_index: number, range_lookup: boolean) → any any Searches the first row of a range for a key and returns a value from a specified row.
HSTACK(...values: array[]) → array array variadic. Horizontally stacks arrays (Excel 365).
INDEX(rows: array, row_index: number, column_index: number) → any any Returns a value from a rectangular array.
INTERSECT(a: array, b: array) → array array Returns elements present in both arrays.
MATCH(lookup: any, range: array, match_type: number) → number number Returns the relative position of a value in a range.
OBJECTS(table: array) → array array Converts a 2D-array-with-headers into a 1D column of objects, one per data row keyed by the header names. Pairs with comprehensions: [ {id: r.id, total: r.amount * r.fx} FOR r IN OBJECTS(data) IF r.status = "active" ]. The inverse of laying out a table as [headers; row1; row2; …].
OMIT(source: any, ...key: string) → any any variadic. Returns a copy of the source object or 2D-array-with-headers with the listed keys removed. Missing keys are silently ignored. Backs the postfix @![…] operator and the WITHOUT KEYS clause.
ONES(rows: number, cols: number) → array array Builds a rows × cols array of ones. Equivalent to FILL(1, rows, cols).
PICK(source: any, ...key: string) → any any variadic. Projects an object or 2D-array-with-headers onto the listed keys, preserving the order in which the keys appear. Missing keys are silently skipped. Backs the postfix @[…] operator and the WITH KEYS clause.
QUERY(data: array, query_str: string) → array array Runs a SQL-like query over a 2D array. Supports SELECT, WHERE, ORDER BY, and LIMIT.
RENAME(source: any, ...from: string, ...to: string) → any any variadic. Renames keys in an object or headers in a 2D array. Takes a source followed by alternating old/new key pairs. Unknown old keys are silently ignored. Object key order is preserved; 2D-array column order is preserved.
REPEAT(value: any, count: number) → array array Vertically stacks count copies of value. A scalar produces a count × 1 column; a row vector produces count rows; a 2D array tiles the whole block count times.
ROW(value: number) → number number Returns the row number of a reference.
ROWS(arr: array) → number number Returns the number of rows in an array.
SEQUENCE(rows: number, columns: number, start: number, step: number) → array array Generates a sequence of numbers (Excel 365 / Google Sheets).
SLICE(source: any, start_idx: number, end_idx: number, step: number) → any any Returns a sub-array or substring from start to end index.
SORT(arr: array, sort_index: number, sort_order: number) → array array Sorts the contents of a range or array (Excel 365 / Google Sheets).
SORTBY(arr: array, by_arr: array, order: number) → array array Sorts an array based on values in a corresponding array (Excel 365).
TAKE(arr: array, rows: number, cols: number) → array array Returns rows or columns from the start or end of an array (Excel 365).
TEXTSPLIT(text: string, col_delimiter: string, row_delimiter: string) → array array Splits text by column and row delimiters into a 2D array (Excel 365).
TOCOL(arr: array) → array array Converts an array to a single column (Excel 365).
TOROW(arr: array) → array array Converts an array to a single row (Excel 365).
TRANSPOSE(arr: array) → array array Transposes the rows and columns of an array.
UNION(a: array, b: array) → array array Returns the unique combined elements from two arrays.
UNIQUE(arr: array) → array array Returns unique values from a range (Excel 365 / Google Sheets).
VLOOKUP(lookup: any, table_array: array, col_index: number, range_lookup: boolean) → any any Searches the first column of a range for a key and returns a value from a specified column.
VSTACK(...values: array[]) → array array variadic. Vertically stacks arrays (Excel 365).
WRAPCOLS(arr: array, wrap_count: number, pad: any) → array array Wraps a row/column vector into columns of a given length (Excel 365).
WRAPROWS(arr: array, wrap_count: number, pad: any) → array array Wraps a row/column vector into rows of a given length (Excel 365).
XLOOKUP(value: any, array: array, array_2: array, value_2: any, number: number, number_2: number) → any any Searches a range and returns a corresponding item from a second range (Excel 365).
XMATCH(lookup: any, lookup_arr: array, match_mode: number) → number number Returns the relative position of an item in an array (Excel 365).
ZEROS(rows: number, cols: number) → array array Builds a rows × cols array of zeros. Equivalent to FILL(0, rows, cols).

Financial

Time-value-of-money, depreciation, bond math, and other finance helpers.

Function count: 55.

Function Returns Notes
ACCRINT(issue: date, first_interest: date, settlement: date, rate: number, par: number, frequency: number) → number number Returns the accrued interest for a security that pays periodic interest.
ACCRINTM(issue: date, settlement: date, rate: number, par: number, basis: number) → number number Returns the accrued interest for a security that pays at maturity.
AMORDEGRC(cost: number, date_purchased: date, first_period: date, salvage: number, period: number, rate: number) → number number Returns the depreciation for each accounting period (French degressive).
AMORLINC(cost: number, date_purchased: date, first_period: date, salvage: number, period: number, rate: number) → number number Returns the depreciation for each accounting period (French linear).
COUPDAYBS(settlement: date, maturity: date, frequency: number, basis: number) → number number Returns the number of days from the beginning of the coupon period to settlement.
COUPDAYS(settlement: date, maturity: date, frequency: number, basis: number) → number number Returns the number of days in the coupon period containing the settlement date.
COUPDAYSNC(settlement: date, maturity: date, frequency: number, basis: number) → number number Returns the number of days from settlement to the next coupon date.
COUPNCD(settlement: date, maturity: date, frequency: number, basis: number) → date date Returns the next coupon date after the settlement date.
COUPNUM(settlement: date, maturity: date, frequency: number, basis: number) → number number Returns the number of coupons payable between settlement and maturity.
COUPPCD(settlement: date, maturity: date, frequency: number, basis: number) → date date Returns the previous coupon date before the settlement date.
CUMIPMT(rate: number, nper: number, pv: number, start_period: number, end_period: number) → number number Returns the cumulative interest paid between two periods.
CUMPRINC(rate: number, nper: number, pv: number, start_period: number, end_period: number) → number number Returns the cumulative principal paid between two periods.
DB(cost: number, salvage: number, life: number, period: number, month: number) → number number Returns fixed-declining balance depreciation.
DDB(cost: number, salvage: number, life: number, period: number, factor: number) → number number Returns double-declining balance depreciation for a specific period.
DISC(settlement: date, maturity: date, pr: number, redemption: number, basis: number) → number number Returns the discount rate for a security.
DOLLARDE(frac_dollar: number, fraction: number) → number number Converts a dollar price from fraction to decimal.
DOLLARFR(dec_dollar: number, fraction: number) → number number Converts a dollar price from decimal to fraction.
DURATION(settlement: date, maturity: date, coupon: number, yld: number, frequency: number, basis: number) → number number Returns the Macaulay duration of a security with periodic interest payments.
EFFECT(nominal: number, npery: number) → number number Returns the effective annual interest rate.
FV(rate: number, nper: number, pmt: number, pv: number) → number number Returns the future value of an investment.
FVSCHEDULE(principal: number, schedule: number[]) → number number Returns the future value of an initial principal after applying a series of rates.
INTRATE(settlement: date, maturity: date, investment: number, redemption: number, basis: number) → number number Returns the interest rate for a fully invested security.
IPMT(rate: number, per: number, nper: number, pv: number) → number number Returns the interest payment for a given period.
IRR(...values: number[]) → number number variadic. Returns the internal rate of return for a series of cash flows.
ISPMT(rate: number, per: number, nper: number, pv: number) → number number Returns the interest paid during a specific period (simple interest method).
MDURATION(settlement: date, maturity: date, coupon: number, yld: number, frequency: number, basis: number) → number number Returns the modified Macaulay duration.
MIRR(values: number[], finance_rate: number, reinvest_rate: number) → number number variadic. Returns the modified internal rate of return.
NOMINAL(effect_rate: number, npery: number) → number number Returns the nominal annual interest rate.
NPER(rate: number, pmt: number, pv: number, fv: number) → number number Returns the number of periods for an investment.
NPV(rate: number, ...value: number[]) → number number variadic. Returns the net present value of a series of cash flows.
ODDFPRICE(settlement: date, maturity: date, issue: date, first_coupon: date, rate: number, yld: number, redemption: number, frequency: number) → number number Returns the price of a security with an odd first period.
ODDFYIELD(settlement: date, maturity: date, issue: date, first_coupon: date, rate: number, pr: number, redemption: number, frequency: number) → number number Returns the yield of a security with an odd first period (Newton's method).
ODDLPRICE(settlement: date, maturity: date, last_interest: date, rate: number, yld: number, redemption: number, frequency: number) → number number Returns the price of a security with an odd last period.
ODDLYIELD(settlement: date, maturity: date, last_interest: date, rate: number, pr: number, redemption: number, frequency: number) → number number Returns the yield of a security with an odd last period.
PDURATION(rate: number, pv: number, fv: number) → number number Returns the number of periods for an investment to reach a specified value.
PMT(rate: number, periods: number, principal: number) → number number Calculates a loan payment amount.
PPMT(rate: number, per: number, nper: number, pv: number) → number number Returns the principal payment for a given period.
PRICE(settlement: date, maturity: date, rate: number, yld: number, redemption: number, frequency: number) → number number Returns the price per $100 face value of a security that pays periodic interest.
PRICEDISC(settlement: date, maturity: date, discount: number, redemption: number, basis: number) → number number Returns the price per $100 face value for a discounted security.
PRICEMAT(settlement: date, maturity: date, issue: date, rate: number, yld: number, basis: number) → number number Returns the price per $100 face value for a security that pays at maturity.
PV(rate: number, nper: number, pmt: number, fv: number) → number number Returns the present value of an investment.
RATE(nper: number, pmt: number, pv: number, fv: number) → number number Returns the interest rate per period (Newton's method approximation).
RECEIVED(settlement: date, maturity: date, investment: number, discount: number, basis: number) → number number Returns the amount received at maturity for a fully invested security.
RRI(nper: number, pv: number, fv: number) → number number Returns an equivalent interest rate for growth of an investment.
SLN(cost: number, salvage: number, life: number) → number number Returns straight-line depreciation for one period.
SYD(cost: number, salvage: number, life: number, period: number) → number number Returns sum-of-years-digits depreciation for a specific period.
TBILLEQ(settlement: date, maturity: date, discount: number) → number number Returns the bond-equivalent yield for a Treasury bill.
TBILLPRICE(settlement: date, maturity: date, discount: number) → number number Returns the price per $100 face value for a Treasury bill.
TBILLYIELD(settlement: date, maturity: date, pr: number) → number number Returns the yield for a Treasury bill.
VDB(cost: number, salvage: number, life: number, start_period: number, end_period: number, factor: number) → number number Returns variable declining balance depreciation for any period.
XIRR(values: number[], ...dates: date[]) → number number variadic. Returns IRR for cash flows at irregular intervals (Newton's method).
XNPV(rate: number, values: number[], dates: date[]) → number number Returns NPV for cash flows at irregular intervals.
YIELD(settlement: date, maturity: date, rate: number, pr: number, redemption: number, frequency: number) → number number Returns the yield on a security that pays periodic interest (Newton's method).
YIELDDISC(settlement: date, maturity: date, pr: number, redemption: number, basis: number) → number number Returns the annual yield for a discounted security.
YIELDMAT(settlement: date, maturity: date, issue: date, rate: number, pr: number, basis: number) → number number Returns the annual yield for a security that pays at maturity.

Statistical

Descriptive statistics, distributions, regression, and hypothesis tests.

Function count: 115.

Function Returns Notes
AVEDEV(...values: number[]) → number number variadic. Returns the average of the absolute deviations from the mean.
BETA.DIST(x: number, alpha: number, beta: number, cumulative: boolean) → number number Beta distribution (Excel 2010+).
BETA.INV(p: number, alpha: number, beta: number) → number number Inverse beta (Excel 2010+).
BETADIST(x: number, alpha: number, beta: number) → number number Returns the beta distribution CDF.
BETAINV(p: number, alpha: number, beta: number) → number number Returns the inverse of the beta distribution CDF.
BINOM.DIST(s: number, n: number, p: number, cumulative: boolean) → number number Binomial distribution (Excel 2010+).
BINOM.INV(trials: number, prob: number, alpha: number) → number number Inverse binomial (Excel 2010+).
BINOMDIST(s: number, n: number, p: number, cumulative: boolean) → number number Returns the binomial distribution probability.
CHIDIST(x: number, df: number) → number number Returns the right-tailed chi-squared distribution.
CHIINV(p: number, df: number) → number number Returns the inverse of the right-tailed chi-squared distribution.
CHISQ.DIST(x: number, df: number, cumulative: boolean) → number number Chi-squared CDF (Excel 2010+).
CHISQ.DIST.RT(x: number, df: number) → number number Right-tailed chi-squared (Excel 2010+).
CHISQ.INV(p: number, df: number) → number number Inverse chi-squared left-tailed (Excel 2010+).
CHISQ.INV.RT(p: number, df: number) → number number Inverse chi-squared right-tailed (Excel 2010+).
CHISQ.TEST(observed: number[], expected: number[]) → number number Returns the chi-squared test p-value for independence.
CONFIDENCE(alpha: number, stdev: number, size: number) → number number Returns the confidence interval for a population mean.
CONFIDENCE.NORM(alpha: number, stdev: number, size: number) → number number Confidence interval using normal distribution (Excel 2010+).
CONFIDENCE.T(alpha: number, stdev: number, size: number) → number number Confidence interval using t-distribution (Excel 2010+).
CORREL(arr_x: number[], arr_y: number[]) → number number Returns the Pearson correlation coefficient between two data sets.
COVAR(arr_x: number[], arr_y: number[]) → number number Returns the covariance between two data sets.
COVARIANCE.P(x: number[], y: number[]) → number number Population covariance (Excel 2010+ alias).
COVARIANCE.S(x: number[], y: number[]) → number number Sample covariance (Excel 2010+ alias).
CRITBINOM(trials: number, prob: number, alpha: number) → number number Returns the smallest value for which the cumulative binomial distribution >= criterion.
DEVSQ(...values: number[]) → number number variadic. Returns the sum of squares of deviations from the mean.
EXPON.DIST(x: number, lambda: number, cumulative: boolean) → number number Exponential distribution (Excel 2010+).
EXPONDIST(x: number, lambda: number, cumulative: boolean) → number number Returns the exponential distribution.
F.DIST(x: number, df1: number, df2: number, cumulative: boolean) → number number F-distribution CDF (Excel 2010+).
F.DIST.RT(x: number, df1: number, df2: number) → number number Right-tailed F-distribution (Excel 2010+).
F.INV(p: number, df1: number, df2: number) → number number Inverse F-distribution left-tailed (Excel 2010+).
F.INV.RT(p: number, df1: number, df2: number) → number number Inverse F-distribution right-tailed (Excel 2010+).
F.TEST(arr1: number[], arr2: number[]) → number number Returns the p-value from an F-test for equality of variances.
FDIST(x: number, df1: number, df2: number) → number number Returns the right-tailed F-distribution.
FINV(p: number, df1: number, df2: number) → number number Returns the inverse of the right-tailed F-distribution.
FISHER(x: number) → number number Returns the Fisher transformation.
FISHERINV(y: number) → number number Returns the inverse of the Fisher transformation.
FORECAST(x: number, known_ys: number[], known_xs: number[]) → number number Predicts a future value using linear regression.
FORECAST_ETS(target_date: number, values: number[], timeline: number[], seasonality: number, data_completion: number, aggregation: number) → number number Predicts a future value using exponential smoothing (Holt-Winters additive model).
FORECAST_ETS_CONFINT(number: number, number_2: number[], number_3: number[], number_4: number, number_5: number, number_6: number, number_7: number) → number number Returns the confidence interval for a FORECAST.ETS prediction.
FORECAST_ETS_SEASONALITY(values: number[], timeline: number[]) → number number Returns the detected seasonality period for FORECAST.ETS.
FORECAST_ETS_STAT(number: number[], number_2: number[], number_3: number, number_4: number) → number number Returns ETS model statistics (alpha, beta, gamma, MASE, SMAPE, MAE, RMSE).
FORECAST.LINEAR(x: number, known_ys: number[], known_xs: number[]) → number number Linear forecast (Excel 2016+ alias).
FREQUENCY(data: number[], bins: number[]) → array array Returns a frequency distribution as an array.
GAMMA.DIST(x: number, alpha: number, beta: number, cumulative: boolean) → number number Gamma distribution (Excel 2010+).
GAMMA.INV(p: number, alpha: number, beta: number) → number number Inverse gamma (Excel 2010+).
GAMMADIST(x: number, alpha: number, beta: number, cumulative: boolean) → number number Returns the gamma distribution.
GAMMAINV(p: number, alpha: number, beta: number) → number number Returns the inverse of the gamma CDF.
GEOMEAN(...values: number[]) → number number variadic. Returns the geometric mean.
GROWTH(known_ys: number[], known_xs: number[], new_xs: number[]) → array array Returns values along an exponential trend (array output).
HARMEAN(...values: number[]) → number number variadic. Returns the harmonic mean.
HYPGEOM.DIST(s: number, n: number, m: number, n_2: number, cumulative: boolean) → number number Hypergeometric distribution (Excel 2010+).
HYPGEOMDIST(s: number, n: number, m: number, n_2: number) → number number Returns the hypergeometric distribution.
INTERCEPT(ys: number[], xs: number[]) → number number Returns the intercept of a linear regression line.
KURT(...values: number[]) → number number variadic. Returns the kurtosis of a data set.
LARGE(values: number[], k: number) → number number Returns the k-th largest value in a data set.
LINEST(number: number[], number_2: number[], logical: boolean, logical_2: boolean) → array array Returns linear regression statistics as a 5x2 array (slope, intercept, std errors, R², F, df, SS regression, SS residual).
LOGEST(number: number[], number_2: number[], logical: boolean, logical_2: boolean) → array array Returns exponential regression statistics as a 5x2 array.
LOGNORM.DIST(x: number, mean: number, stdev: number, cumulative: boolean) → number number Log-normal distribution (Excel 2010+).
LOGNORM.INV(p: number, mean: number, stdev: number) → number number Inverse log-normal (Excel 2010+).
LOGNORMDIST(x: number, mean: number, stdev: number) → number number Returns the log-normal CDF.
MODE(...values: number[]) → number number variadic. Returns the most frequently occurring value.
MODE.MULT(...values: number[]) → array array variadic. Returns a vertical array of the most frequently occurring values.
MODE.SNGL(...values: number[]) → number number variadic. Mode single value (Excel 2010+ alias).
NEGBINOM.DIST(f: number, s: number, p: number, cumulative: boolean) → number number Negative binomial (Excel 2010+).
NEGBINOMDIST(f: number, s: number, p: number) → number number Returns the negative binomial distribution.
NORM.DIST(x: number, mean: number, stdev: number, cumulative: boolean) → number number Normal distribution (Excel 2010+).
NORM.INV(p: number, mean: number, stdev: number) → number number Inverse normal (Excel 2010+).
NORM.S.DIST(z: number, cumulative: boolean) → number number Standard normal CDF (Excel 2010+).
NORM.S.INV(p: number) → number number Inverse standard normal (Excel 2010+).
NORMDIST(x: number, mean: number, stdev: number, cumulative: boolean) → number number Returns the normal distribution CDF or PDF.
NORMINV(p: number, mean: number, stdev: number) → number number Returns the inverse of the normal CDF.
NORMSDIST(z: number) → number number Returns the standard normal CDF.
NORMSINV(p: number) → number number Returns the inverse of the standard normal CDF.
PERCENTILE(values: number[], k: number) → number number Returns the k-th percentile of values in a range.
PERCENTILE.EXC(values: number[], k: number) → number number Returns the k-th percentile (exclusive).
PERCENTILE.INC(values: number[], k: number) → number number Returns the k-th percentile (inclusive, same as PERCENTILE).
PERCENTRANK(values: number[], x: number) → number number Returns the rank of a value as a percentage of the data set.
PERCENTRANK.EXC(values: number[], x: number) → number number Percent rank exclusive (Excel 2010+).
PERCENTRANK.INC(values: number[], x: number) → number number Percent rank inclusive (Excel 2010+).
PERMUTA(n: number, k: number) → number number Returns the number of permutations with repetitions.
POISSON(x: number, mean: number, cumulative: boolean) → number number Returns the Poisson distribution.
POISSON.DIST(x: number, mean: number, cumulative: boolean) → number number Poisson distribution (Excel 2010+).
PROB(x_range: number[], prob_range: number[], lower: number, upper: number) → number number Returns the probability that values fall within a range.
QUARTILE(values: number[], quart: number) → number number Returns the quartile of a data set (0=min, 1=Q1, 2=median, 3=Q3, 4=max).
QUARTILE.EXC(values: number[], quart: number) → number number Returns the quartile (exclusive).
QUARTILE.INC(values: number[], quart: number) → number number Returns the quartile (inclusive, same as QUARTILE).
RANK(number: number, values: number[], order: number) → number number Returns the rank of a number in a list of numbers.
RANK.AVG(number: number, values: number[], order: number) → number number Returns the rank of a number, averaging ties.
RANK.EQ(number: number, values: number[], order: number) → number number Returns the rank of a number (same as RANK).
RSQ(ys: number[], xs: number[]) → number number Returns the R-squared value of a linear regression.
SKEW(...values: number[]) → number number variadic. Returns the skewness of a distribution.
SLOPE(ys: number[], xs: number[]) → number number Returns the slope of a linear regression line.
SMALL(values: number[], k: number) → number number Returns the k-th smallest value in a data set.
STANDARDIZE(x: number, mean: number, stdev: number) → number number Returns a normalized value (z-score).
STDEV(...values: number[]) → number number variadic. Estimates standard deviation based on a sample.
STDEV.P(...values: number[]) → number number variadic. Population standard deviation (Excel 2010+ alias).
STDEV.S(...values: number[]) → number number variadic. Sample standard deviation (Excel 2010+ alias).
STDEVP(...values: number[]) → number number variadic. Calculates standard deviation based on the entire population.
STEYX(ys: number[], xs: number[]) → number number Returns the standard error of the predicted y-value for each x.
T.DIST(x: number, df: number, cumulative: boolean) → number number Student t-distribution (Excel 2010+).
T.DIST.2T(x: number, df: number) → number number Two-tailed t-distribution (Excel 2010+).
T.DIST.RT(x: number, df: number) → number number Right-tailed t-distribution (Excel 2010+).
T.INV(p: number, df: number) → number number Inverse t-distribution left-tailed (Excel 2010+).
T.INV.2T(p: number, df: number) → number number Inverse t-distribution two-tailed (Excel 2010+).
T.TEST(arr1: number[], arr2: number[], tails: number, test_type: number) → number number Returns the p-value from a Student t-test.
TDIST(x: number, df: number, tails: number) → number number Returns the Student t-distribution (two-tailed).
TINV(p: number, df: number) → number number Returns the inverse of the two-tailed Student t-distribution.
TREND(known_ys: number[], known_xs: number[], new_xs: number[]) → array array Returns values along a linear trend (array output).
TRIMMEAN(values: number[], percent: number) → number number Returns the mean of the interior of a data set, trimming a percentage from both ends.
VAR(...values: number[]) → number number variadic. Estimates variance based on a sample.
VAR.P(...values: number[]) → number number variadic. Population variance (Excel 2010+ alias).
VAR.S(...values: number[]) → number number variadic. Sample variance (Excel 2010+ alias).
VARP(...values: number[]) → number number variadic. Calculates variance based on the entire population.
WEIBULL(x: number, alpha: number, beta: number, cumulative: boolean) → number number Returns the Weibull distribution.
WEIBULL.DIST(x: number, alpha: number, beta: number, cumulative: boolean) → number number Weibull distribution (Excel 2010+).
Z.TEST(arr: number[], x: number, sigma: number) → number number Returns the p-value for a z-test.

Information

Type predicates, error inspection, and metadata accessors.

Function count: 20.

Function Returns Notes
CELL(info_type: string, value: any) → any any Returns information about a cell. Supports info_type: address, row, col, type, contents.
ERROR_TYPE(value: any) → number number Returns a number corresponding to an error type (1=#NULL!, 2=#DIV/0!, 3=#VALUE!, 4=#REF!, 5=#NAME?, 6=#NUM!, 7=#N/A).
ISBLANK(value: any) → boolean boolean Returns TRUE if the value is blank.
ISDATE(value: any) → boolean boolean Returns TRUE if the value is a date.
ISDATETIME(value: any) → boolean boolean Returns TRUE if the value is a datetime.
ISDURATION(value: any) → boolean boolean Returns TRUE if the value is a duration.
ISERR(value: any) → boolean boolean Returns TRUE if the value is any error except #N/A.
ISERROR(value: any) → boolean boolean Returns TRUE if the value is an error.
ISFORMULA(value: any) → boolean boolean Returns TRUE if there is a formula in the referenced cell. (Returns TRUE for all calculation cells.)
ISLOGICAL(value: any) → boolean boolean Returns TRUE if the value is a logical (boolean) value.
ISNA(value: any) → boolean boolean Returns TRUE if the value is the #N/A error.
ISNONTEXT(value: any) → boolean boolean Returns TRUE if the value is not text.
ISNUMBER(value: any) → boolean boolean Returns TRUE if the value is a number.
ISREF(value: any) → boolean boolean Returns TRUE if the value is a reference. (Always returns TRUE in formula context.)
ISTEXT(value: any) → boolean boolean Returns TRUE if the value is text.
N(value: any) → number number Converts a value to a number.
NA() → error error Returns the #N/A error value.
SHEET() → number number Returns the sheet number (always 1 in single-sheet mode).
SHEETS() → number number Returns the number of sheets (always 1 in single-sheet mode).
TYPE(value: any) → number number Returns a number indicating the data type: 1=number, 2=text, 4=logical, 16=error, 64=array.

Engineering

Bit operations, base conversions, complex numbers, and engineering helpers.

Function count: 57.

Function Returns Notes
ARGUMENT(c: complex) → number number Returns the argument (angle in radians) of a complex number. Type-aware version of IMARGUMENT.
BESSELI(x: number, n_order: number) → number number Returns the modified Bessel function In(x).
BESSELJ(x: number, n_order: number) → number number Returns the Bessel function Jn(x).
BESSELK(x: number, n_order: number) → number number Returns the modified Bessel function Kn(x).
BESSELY(x: number, n_order: number) → number number Returns the Bessel function Yn(x).
BIN2DEC(v: string) → number number Converts a binary number to decimal.
BIN2HEX(v: string) → string string Converts binary to hexadecimal.
BIN2OCT(v: string) → string string Converts binary to octal.
BITAND(a: number, b: number) → number number Returns the bitwise AND of two integers (Apple Numbers / Google Sheets).
BITLSHIFT(number: number, shift: number) → number number Returns the number shifted left by the specified number of bits.
BITOR(a: number, b: number) → number number Returns the bitwise OR of two integers.
BITRSHIFT(number: number, shift: number) → number number Returns the number shifted right by the specified number of bits.
BITXOR(a: number, b: number) → number number Returns the bitwise XOR of two integers.
COMPLEX(real: number, imag: number, suffix: string) → string string Creates a complex number from real and imaginary parts.
CONJUGATE(c: complex) → complex complex Returns the complex conjugate as a typed complex value. Type-aware version of IMCONJUGATE.
CONVERT(number: number, from_unit: string, to_unit: string) → number number Converts a number from one unit to another.
DEC2BIN(v: number) → string string Converts a decimal number to binary.
DEC2HEX(v: number) → string string Converts a decimal number to hexadecimal.
DEC2OCT(v: number) → string string Converts a decimal number to octal.
DELTA(a: number, b: number) → number number Tests whether two values are equal. Returns 1 if equal, 0 otherwise.
ERF(x: number) → number number Returns the error function.
ERF_PRECISE(x: number) → number number Returns the error function (alias for ERF).
ERFC(x: number) → number number Returns the complementary error function.
ERFC_PRECISE(x: number) → number number Returns the complementary error function (alias for ERFC).
GESTEP(number: number, step: number) → number number Tests whether a number is greater than or equal to a step value.
HEX2BIN(v: string) → string string Converts hexadecimal to binary.
HEX2DEC(v: string) → number number Converts a hexadecimal number to decimal.
HEX2OCT(v: string) → string string Converts hexadecimal to octal.
IMABS(c: complex) → number number Returns the absolute value (modulus) of a complex number.
IMAGINARY(c: complex) → number number Returns the imaginary part of a complex number. Accepts a typed complex value, a plain number, or the legacy "a+bi" string form.
IMARGUMENT(c: complex) → number number Returns the argument (angle in radians) of a complex number.
IMCONJUGATE(c: complex) → string string Returns the complex conjugate.
IMCOS(c: string) → string string Returns the cosine of a complex number.
IMCOSH(c: string) → string string Returns the hyperbolic cosine of a complex number.
IMCOT(c: string) → string string Returns the cotangent of a complex number.
IMCSC(c: string) → string string Returns the cosecant of a complex number.
IMDIV(a: string, b: string) → string string Returns the quotient of complex numbers.
IMEXP(c: string) → string string Returns the exponential of a complex number.
IMLN(c: string) → string string Returns the natural logarithm of a complex number.
IMLOG10(c: string) → string string Returns the base-10 logarithm of a complex number.
IMLOG2(c: string) → string string Returns the base-2 logarithm of a complex number.
IMPOWER(c: string, power: number) → string string Returns a complex number raised to a power.
IMPRODUCT(a: string, b: string) → string string Returns the product of complex numbers.
IMREAL(c: complex) → number number Returns the real part of a complex number. Accepts a typed complex value, a plain number, or the legacy "a+bi" string form.
IMSEC(c: string) → string string Returns the secant of a complex number.
IMSIN(c: string) → string string Returns the sine of a complex number.
IMSINH(c: string) → string string Returns the hyperbolic sine of a complex number.
IMSQRT(c: string) → string string Returns the square root of a complex number.
IMSUB(a: string, b: string) → string string Returns the difference of complex numbers.
IMSUM(a: string, b: string) → string string Returns the sum of complex numbers.
IMTAN(c: string) → string string Returns the tangent of a complex number.
MAKE_COMPLEX(re: number, im: number) → complex complex Constructs a typed complex value from a real and imaginary part. Modern alternative to COMPLEX, which returns a string.
MODULUS(c: complex) → number number Returns the modulus (magnitude) of a complex number. Type-aware version of IMABS.
OCT2BIN(v: string) → string string Converts octal to binary.
OCT2DEC(v: string) → number number Converts an octal number to decimal.
OCT2HEX(v: string) → string string Converts octal to hexadecimal.
REAL(c: complex) → number number Returns the real part of a complex number. Type-aware version of IMREAL.

Domain Types

URL, molecule, DNA, color, musical note, and bytes accessors and constructors.

Function count: 39.

Function Returns Notes
BYTES_FROM_BASE64(s: string) → bytes bytes Decodes a base64 string to a typed bytes value.
BYTES_FROM_TEXT(s: string) → bytes bytes Encodes a UTF-8 string as a typed bytes value.
BYTES_HEX(b: bytes) → string string Returns the canonical lower-case hex string of a bytes value.
BYTES_LENGTH(b: bytes) → number number Returns the number of bytes in a bytes value.
BYTES_TO_BASE64(b: bytes) → string string Returns the base64 encoding of a bytes value.
BYTES_TO_TEXT(b: bytes) → string string Decodes a bytes value to a UTF-8 string.
COLOR_A(c: color) → number number Returns the alpha channel of a color value as a fraction in [0,1].
COLOR_B(c: color) → number number Returns the blue channel of a color value as an integer in [0,255].
COLOR_G(c: color) → number number Returns the green channel of a color value as an integer in [0,255].
COLOR_HEX(c: color) → string string Returns the canonical lower-case #RRGGBBAA hex string of a color value.
COLOR_LUMINANCE(c: color) → number number Returns the relative luminance (Rec. 709) of a color value in [0,1].
COLOR_R(c: color) → number number Returns the red channel of a color value as an integer in [0,255].
DNA_COMPLEMENT(d: dna) → dna dna Returns the complementary strand of a DNA value (A<->T, C<->G).
DNA_GC(d: dna) → number number Returns the GC content of a DNA value (fraction in [0,1]).
DNA_LENGTH(d: dna) → number number Returns the number of bases in a DNA value.
DNA_REVCOMP(d: dna) → dna dna Returns the reverse complement of a DNA value.
DNA_SEQUENCE(d: dna) → string string Returns the underlying nucleotide string of a DNA value.
DNA_TO_RNA(d: dna) → string string Returns the RNA transcription of a DNA value (T -> U).
DNA_TRANSLATE(d: dna) → string string Translates a DNA sequence to its protein single-letter codes (stops at first stop codon).
MAKE_COLOR(r: number, g: number, b: number, a: number) → color color Constructs a color value from 0..255 RGB channels and an optional 0..1 alpha.
MOL_ATOM_COUNT(m: molecule, sym: string) → number number Returns the count of a specific element in a molecule (0 if absent).
MOL_ATOMIC_MASS(sym: string) → number number Returns the standard atomic mass (g/mol) of a chemical element symbol.
MOL_FORMULA(m: molecule) → string string Returns the canonical formula string of a molecule value.
MOL_MASS(m: molecule) → number number Returns the molar mass (g/mol) of a molecule value.
NOTE_ACCIDENTAL(n: note) → string string Returns the accidental string ("#", "b", "##", "bb", or "") of a note.
NOTE_FREQUENCY(n: note) → number number Returns the frequency (Hz) of a musical-note value (A4 = 440 Hz reference).
NOTE_FROM_FREQUENCY(hz: number) → note note Constructs the closest musical-note value for a frequency in Hz (A4 = 440 Hz reference).
NOTE_FROM_MIDI(midi: number) → note note Constructs a musical-note value from a MIDI integer (0..127).
NOTE_MIDI(n: note) → number number Returns the MIDI number (0..127) of a musical-note value.
NOTE_OCTAVE(n: note) → number number Returns the octave (integer) of a musical-note value.
NOTE_PITCH(n: note) → string string Returns the pitch letter (A..G) of a musical-note value.
URL_FRAGMENT(u: url) → string string Returns the fragment (hash) of a URL value (without leading "#").
URL_HOST(u: url) → string string Returns the hostname of a URL value.
URL_LENGTH(u: url) → number number Returns the length of the canonical URL string.
URL_PATH(u: url) → string string Returns the path component of a URL value.
URL_PORT(u: url) → string string Returns the port of a URL value as a string ("" if no explicit port).
URL_QUERY(u: url) → string string Returns the raw query string (without leading "?") of a URL value.
URL_QUERY_PARAM(u: url, key: string) → string string Returns the value of a single query parameter from a URL value.
URL_SCHEME(u: url) → string string Returns the scheme (e.g. "https") of a URL value.

Database

Database-style aggregations over criteria-defined ranges.

Function count: 12.

Function Returns Notes
DAVERAGE(database: array, field: any, criteria: array) → number number Averages values in a database field that match criteria.
DCOUNT(database: array, field: any, criteria: array) → number number Counts numeric values in a database field that match criteria.
DCOUNTA(database: array, field: any, criteria: array) → number number Counts non-blank values in a database field that match criteria.
DGET(database: array, field: any, criteria: array) → any any Extracts a single value from a database field that matches criteria.
DMAX(database: array, field: any, criteria: array) → number number Returns the maximum value in a database field that matches criteria.
DMIN(database: array, field: any, criteria: array) → number number Returns the minimum value in a database field that matches criteria.
DPRODUCT(database: array, field: any, criteria: array) → number number Multiplies values in a database field that match criteria.
DSTDEV(database: array, field: any, criteria: array) → number number Sample standard deviation of database field values matching criteria.
DSTDEVP(database: array, field: any, criteria: array) → number number Population standard deviation of database field values matching criteria.
DSUM(database: array, field: any, criteria: array) → number number Sums values in a database field that match criteria.
DVAR(database: array, field: any, criteria: array) → number number Sample variance of database field values matching criteria.
DVARP(database: array, field: any, criteria: array) → number number Population variance of database field values matching criteria.

External (Async)

Functions that execute asynchronously in worker processes.

Function count: 3.

Function Returns Notes
FX_RATE(base: currency_code, quote: currency_code) → fx_rate fx_rate async. Retrieves an exchange rate for a currency pair.
HTTP_JSON(url: string) → object object async. Fetches JSON from an external API and materializes it as an object value.
ML_SCORE(features: number[]) → score score async. Delegates a feature vector to an external scoring engine.

FX_RATE

Retrieves an exchange rate for a currency pair.

Signature: FX_RATE(base: currency_code, quote: currency_code) → fx_rate

External contract:

  • worker route: market-data.fx
  • cache TTL: 30000ms
  • max staleness: 300000ms
  • refresh mode: background
  • timeout: 5000ms
  • max retries: 3

HTTP_JSON

Fetches JSON from an external API and materializes it as an object value.

Signature: HTTP_JSON(url: string) → object

External contract:

  • worker route: network.http-json
  • cache TTL: 60000ms
  • max staleness: 600000ms
  • refresh mode: background
  • timeout: 10000ms
  • max retries: 2

ML_SCORE

Delegates a feature vector to an external scoring engine.

Signature: ML_SCORE(features: number[]) → score

External contract:

  • worker route: ml.scoring
  • cache TTL: 300000ms
  • max staleness: 900000ms
  • refresh mode: background
  • timeout: 15000ms
  • max retries: 2

Notes On The Catalog

  • Variadic tail. When a parameter is marked ..., the function accepts any number of additional arguments of that type. For example, SUM(values: number[]) accepts SUM(1, 2, 3) or SUM(A1:A10).
  • Volatile functions. Marked volatile recompute every time any input in the model changes (not just their declared inputs). Examples: NOW, TODAY, RAND, RANDBETWEEN.
  • Async functions. Marked async execute via the external job queue, not synchronously. See external-functions.md.
  • Lua source. Every lua_sync function ships with a Lua implementation that runs inside Redis Functions. Outputs are byte-equivalent to the TypeScript implementation for the documented contract.
  • Naming. Function names are case-insensitive at parse time (SUM, sum, Sum all bind to the same definition). The canonical style writes them uppercase.