Tables

public class Tables

A class for developing Excel-like software / parser.

Common Formulas + Trigonometry

TODO: AGGREGATE + ARABIC

  • Arc-Sinus of a number.

    Declaration

    Swift

    func ASIN(_ number: BigNumber) throws -> BigNumber

    Parameters

    number

    Any BigDouble less than 2pi

  • Hyperbolic Arc-Sinus of a number.

    Declaration

    Swift

    func ASINH(_ number: BigNumber) throws -> BigNumber

    Parameters

    number

    Any BigDouble

  • Arc-Tangent of a number.

    Declaration

    Swift

    func ATAN(_ number: BigNumber) throws -> BigNumber

    Parameters

    number

    Any BigDouble

  • ATAN2(Y,X) returns the four-quadrant inverse tangent (tan-1) of Y and X, which must be real. The atan2 function follows the convention that atan2(x,x) returns 0 when x is mathematically zero (either 0 or -0).

    Declaration

    Swift

    func ATAN2(_ n1: BigNumber, _ n2: BigNumber) throws -> BigNumber

    Parameters

    n1

    X coordinate

    n2

    Y coordinate

  • Hyperbolic Arc-Tangent of a number.

    Declaration

    Swift

    func ATANH(_ number: BigNumber) throws -> BigNumber

    Parameters

    number

    Any BigDouble

  • Convert number to any base

    Declaration

    Swift

    func BASE(_ number: BigInt, _ radix: BigInt) -> String

    Parameters

    number

    The number you want to use

    radix

    The base / radix

  • Returns number rounded up, away from zero, to the nearest multiple of significance.

    For example, if you want to avoid using pennies in your prices and your product is priced at $4.42, use the formula =CEILING(4.42,0.05) to round prices up to the nearest nickel.

    Declaration

    Swift

    func CEILING(_ number: BigDouble, significance: BigDouble = 1, mode: Int = 0) throws -> BigDouble

    Parameters

    number

    The number you want to use

    significance

    The multiple to which you want to round.

    mode

    Either 0 or 1 (0 by default, flooring). It will choose between flooring or ceiling the number if it’s negative.

  • Returns the number of combinations for a given number of items. Use COMBIN to determine the total possible number of groups for a given number of items.

    It uses combinations with repetitions: n! / (k! * (n - k)!)

    Declaration

    Swift

    func COMBIN(_ n: BigInt, k: BigInt) throws -> BigInt

    Parameters

    n

    The number of items.

    k

    The number of items in each combination.

  • Returns the number of combinations (with repetitions) for a given number of items.

    It uses combinations with repetitions: (n + k - 1)! / (k! * (n - 1)!)

    Declaration

    Swift

    func COMBINA(_ n: BigInt, k: BigInt) throws -> BigInt

    Parameters

    n

    The number of items.

    k

    The number of items in each combination.

  • Cosinus of a number.

    Declaration

    Swift

    func COS(_ number: BigNumber) throws -> BigNumber

    Parameters

    number

    Any BigDouble less than 2pi

  • Hyperbolic Cosinus of a number.

    Declaration

    Swift

    func COSH(_ number: BigNumber) throws -> BigNumber

    Parameters

    number

    Any BigDouble

  • Cotangent of a number.

    Declaration

    Swift

    func COT(_ number: BigNumber) throws -> BigNumber

    Parameters

    number

    Any BigDouble

  • Hyperbolic Cotangent of a number.

    Declaration

    Swift

    func COTH(_ number: BigNumber) throws -> BigNumber

    Parameters

    number

    Any BigDouble

  • Cosecant of a number.

    Declaration

    Swift

    func CSC(_ number: BigNumber) throws -> BigNumber

    Parameters

    number

    Any BigDouble

  • Hyperbolic Cosecant of a number.

    Declaration

    Swift

    func CSCH(_ number: BigNumber) throws -> BigNumber

    Parameters

    number

    Any BigDouble

  • Converts a text representation of a number in a given base into a decimal number.

    Declaration

    Swift

    func DECIMAL(_ str: String, _ radix: Int) -> BigNumber

    Parameters

    str

    Required

    radix

    Radix must be an integer.

  • Converts radians into degrees.

    Declaration

    Swift

    func DEGREES(_ rad: BigDouble) -> BigNumber

    Parameters

    rad

    The angle in radians that you want to convert.

  • Returns number rounded up to the nearest even integer.

    You can use this function for processing items that come in twos. For example, a packing crate accepts rows of one or two items. The crate is full when the number of items, rounded up to the nearest two, matches the crate’s capacity.

    Declaration

    Swift

    func EVEN(_ number: BigDouble) throws -> BigInt

    Parameters

    number

    The value to round.

  • Returns e raised to the power of number. The constant e equals 2.71828182845904, the base of the natural logarithm.

    Declaration

    Swift

    func EXP(_ number: BigDouble) -> BigDouble

    Parameters

    number

    The exponent applied to the base e.

  • Returns the factorial of a number. The factorial of a number is equal to 1*2*3*...* number.

    Declaration

    Swift

    func FACT(_ int: BigInt) throws -> BigInt

    Parameters

    int

    The nonnegative number for which you want the factorial. If number is not an integer, it is truncated.

  • Returns the double factorial of a number. The factorial of a number is equal to 1*2*3*...* number.

    Declaration

    Swift

    func FACTDOUBLE(_ int: BigInt) throws -> BigInt

    Parameters

    int

    The value for which to return the double factorial. If number is not an integer, it is truncated.

  • Rounds number down, toward zero, to the nearest multiple of significance.

    For example, if you want to avoid using pennies in your prices and your product is priced at $4.42, use the formula =FLOOR(4.42,0.05) to round prices up to the nearest nickel.

    Declaration

    Swift

    func FLOOR(_ number: BigDouble, significance: BigDouble = 1, mode: Int = 0) throws -> BigDouble

    Parameters

    number

    The numeric value you want to round.

    significance

    The multiple to which you want to round.

    mode

    Either 0 or 1 (0 by default, ceiling). It will choose between flooring or ceiling the number if it’s negative.

  • Returns the greatest common divisor of two or more integers.

    The greatest common divisor is the largest integer that divides both number1 and number2 without a remainder.

    Declaration

    Swift

    func GCD(_ n: BigInt...) throws -> BigInt

    Parameters

    n

    Number1 and 2 are required, subsequent numbers are optional. 1 to 255 values. If any value is not an integer, it is truncated.

  • Returns the greatest common divisor of two or more integers.

    The greatest common divisor is the largest integer that divides both number1 and number2 without a remainder.

    Declaration

    Swift

    func GCD(array n: [BigInt]) throws -> BigInt

    Parameters

    n

    Number1 and 2 are required, subsequent numbers are optional. 1 to 255 values. If any value is not an integer, it is truncated.

  • Rounds a number down to the nearest integer.

    Declaration

    Swift

    func INT(_ n: BigDouble) throws -> BigInt

    Parameters

    n

    The real number you want to round down to an integer.

  • Returns the least common multiple of integers. The least common multiple is the smallest positive integer that is a multiple of all integer arguments number1, number2, and so on. Use LCM to add fractions with different denominators.

    Declaration

    Swift

    func LCM(_ n: BigInt...) throws -> BigInt

    Parameters

    n

    Number1 and 2 are required, subsequent numbers are optional. 1 to 255 values. If any value is not an integer, it is truncated.

  • Returns the least common multiple of integers. The least common multiple is the smallest positive integer that is a multiple of all integer arguments number1, number2, and so on. Use LCM to add fractions with different denominators.

    Declaration

    Swift

    func LCM(array n: [BigInt]) throws -> BigInt

    Parameters

    n

    Number1 and 2 are required, subsequent numbers are optional. 1 to 255 values. If any value is not an integer, it is truncated.

  • Returns the natural logarithm of a number. Natural logarithms are based on the constant e (2.71828182845904)

    LN is the inverse of the EXP function.

    Declaration

    Swift

    func LN(_ n: BigDouble) -> BigDouble

    Parameters

    n

    The positive real number for which you want the natural logarithm.

  • Returns the logarithm of a number to the base you specify.

    Declaration

    Swift

    func LOG(_ n: BigDouble, base: BigDouble = 10) throws -> BigDouble

    Parameters

    n

    The positive real number for which you want the logarithm.

    base

    The base of the logarithm. If base is omitted, it is assumed to be 10.

  • Returns the logarithm base 10

    Declaration

    Swift

    func LOG10(_ n: BigDouble) throws -> BigDouble

    Parameters

    n

    The positive real number for which you want the logarithm.

TODO MATRICES

  • Returns the matrix determinant

    Declaration

    Swift

    func MDETERM(_ lhs: Matrix) throws -> BigDouble

    Parameters

    lhs

    The Matrix you want to use.

  • The MINVERSE function returns the inverse matrix for a matrix stored in a Matrix object (Tables will convert that when using the parser).

    Declaration

    Swift

    func MINVERSE(_ m: Matrix) -> Matrix

    Parameters

    m

    A numeric Matrix with an equal number of rows and columns.

  • The MMULT function returns the matrix product of two Matrix. The result is an array with the same number of rows as lhs and the same number of columns as rhs.

    Declaration

    Swift

    func MMULT(_ lhs: Matrix, _ rhs: Matrix) -> Matrix

    Parameters

    lhs

    The Matrix you want to multiply.

    rhs

    The Matrix you want to multiply.

  • MROUND returns a number rounded to the desired multiple.

    Declaration

    Swift

    func MROUND(_ n: BigDouble, _ m: BigDouble) throws -> BigDouble

    Parameters

    n

    The value to round.

    m

    The multiple to which you want to round number.

  • Returns the remainder after number is divided by divisor.

    The result has the same sign as divisor.

    Declaration

    Swift

    func MOD(_ a: BigDouble, _ b: BigDouble) -> BigDouble

    Parameters

    a

    The number for which you want to find the remainder.

    b

    The number by which you want to divide number.

  • Returns the ratio of the factorial of a sum of values to the product of factorials.

    Declaration

    Swift

    func MULTINOMIAL(_ numbers: BigInt...) throws -> BigDouble

    Parameters

    numbers

    Number1 is required, subsequent numbers are optional. 1 to 255 values for which you want the multinomial.

  • Returns the ratio of the factorial of a sum of values to the product of factorials.

    Declaration

    Swift

    func MULTINOMIAL(array numbers: [BigInt]) throws -> BigDouble

    Parameters

    numbers

    Number1 is required, subsequent numbers are optional. 1 to 255 values for which you want the multinomial.

  • Returns number rounded up to the nearest odd integer.

    Regardless of the sign of number, a value is rounded up when adjusted away from zero. If number is an odd integer, no rounding occurs.

    Declaration

    Swift

    func ODD(_ n: BigDouble) -> BigInt

    Parameters

    n

    The value to round.

  • Returns the mathematical constant

    Originally defined as the ratio of a circle’s circumference to its diameter, it now has various equivalent definitions and appears in many formulas in all areas of mathematics and physics. It is approximately equal to 3.14159. It has been represented by the Greek letter “π” since the mid-18th century, though it is also sometimes spelled out as “pi”. It is also called Archimedes’ constant.

    Declaration

    Swift

    func PI() -> BigDouble
  • Returns the result of a number raised to a power.

    Let’s say you want to calculate an extremely small tolerance level for a machined part or the vast distance between two galaxies. To raise a number to a power, use the POWER function.

    The “^” operator can be used instead of POWER to indicate to what power the base number is to be raised, such as in 5^2.

    Declaration

    Swift

    func POWER(_ a: BigDouble, _ b: BigDouble) -> BigDouble

    Parameters

    a

    The base number. It can be any real number.

    b

    The exponent to which the base number is raised.

  • The PRODUCT function multiplies all the numbers given as arguments and returns the product. For example, if cells A1 and A2 contain numbers, you can use the formula =PRODUCT(A1, A2) to multiply those two numbers together. You can also perform the same operation by using the multiply (*) mathematical operator; for example, =A1 * A2. The PRODUCT function is useful when you need to multiply many cells together. For example, the formula =PRODUCT(A1:A3, C1:C3) is equivalent to =A1 * A2 * A3 * C1 * C2 * C3.

    Declaration

    Swift

    func PRODUCT(_ ns: BigDouble...) -> BigDouble

    Parameters

    ns

    The first number or range that you want to multiply. Continue by adding additional numbers or ranges that you want to multiply, up to a maximum of 255 arguments.

  • The PRODUCT function multiplies all the numbers given as arguments and returns the product. For example, if cells A1 and A2 contain numbers, you can use the formula =PRODUCT(A1, A2) to multiply those two numbers together. You can also perform the same operation by using the multiply (*) mathematical operator; for example, =A1 * A2. The PRODUCT function is useful when you need to multiply many cells together. For example, the formula =PRODUCT(A1:A3, C1:C3) is equivalent to =A1 * A2 * A3 * C1 * C2 * C3.

    Declaration

    Swift

    func PRODUCT(_ ns: [BigDouble]) -> BigDouble

    Parameters

    ns

    The first number or range that you want to multiply. Continue by adding additional numbers or ranges that you want to multiply, up to a maximum of 255 arguments.

  • Returns the integer portion of a division. Use this function when you want to discard the remainder of a division.

    Tip: If you want to divide numeric values, you should use the “/” operator as there isn’t a DIVIDE function in Euler.Tables. For example, to divide 5 by 2, you would type =5/2 into a cell, which returns 2.5. The QUOTIENT function for these same numbers =QUOTIENT(5,2) returns 2, since QUOTIENT doesn’t return a remainder.

    Declaration

    Swift

    func QUOTIENT(_ numerator: BigDouble, _ denominator: BigDouble) throws -> BigInt

    Parameters

    numerator

    The dividend.

    denominator

    The divisor.

  • Converts degrees to radians.

    Declaration

    Swift

    func RADIANS(_ angle: BigDouble) -> BigDouble

    Parameters

    angle

    An angle in degrees that you want to convert.

  • RAND returns an evenly distributed random real number greater than or equal to 0 and less than 1.

    A new random real number is returned every time the worksheet is calculated.

    Declaration

    Swift

    func RAND() -> BigDouble
  • Returns a random integer number between the numbers you specify. A new random integer number is returned every time the worksheet is calculated.

    Declaration

    Swift

    func RANDBETWEEN(_ a: BigDouble, _ b: BigDouble) -> BigDouble

    Parameters

    a

    The smallest integer RANDBETWEEN will return.

    b

    The largest integer RANDBETWEEN will return.

Todo Roman

  • The ROUND function rounds a number to a specified number of digits.

    For example, if cell A1 contains 23.7825, and you want to round that value to two decimal places, you can use the following formula:

    =ROUND(A1, 2) The result of this function is 23.78.

    • If digits is greater than 0 (zero), then number is rounded to the specified number of decimal places.
    • If digits is 0, the number is rounded to the nearest integer.
    • If digits is less than 0, the number is rounded to the left of the decimal point.
    • To always round up (away from zero), use the ROUNDUP function.
    • To always round down (toward zero), use the ROUNDDOWN function.
    • To round a number to a specific multiple (for example, to round to the nearest 0.5), use the MROUND function.

    Declaration

    Swift

    func ROUND(_ n: BigDouble, digits: BigInt) -> BigDouble

    Parameters

    n

    The number that you want to round.

    digits

    The number of digits to which you want to round the number argument.

  • Rounds a number down, toward zero.

    Declaration

    Swift

    func ROUNDDOWN(_ n: BigDouble, digits: BigInt) -> BigDouble

    Parameters

    n

    Any real number that you want rounded down.

    digits

    The number of digits to which you want to round number.

  • Rounds a number up, away from zero.

    Declaration

    Swift

    func ROUNDUP(_ n: BigDouble, digits: BigInt) -> BigDouble

    Parameters

    n

    Any real number that you want rounded up.

    digits

    The number of digits to which you want to round number.

  • Returns the secant of an angle.

    Declaration

    Swift

    func SEC(_ n: BigDouble) throws -> BigDouble

    Parameters

    n

    Number is the angle in radians for which you want the secant.

  • Returns the hyperbolic secant of an angle.

    Declaration

    Swift

    func SECH(_ n: BigDouble) -> BigDouble

    Parameters

    n

    Number is the angle in radians for which you want the hyperbolic secant.

  • Many functions can be approximated by a power series expansion. Returns the sum of a power series based on the formula:

    SERIES(x, n, m, a)=a_1x^n+a_2x^{n+m}+…+a_ix^{n+(i-1)m}

    Declaration

    Swift

    func SERIESSUM(_ x: BigDouble, _ n: BigDouble, _ m: BigDouble, _ coefficients: BigDouble...) throws -> BigDouble

    Parameters

    x

    The input value to the power series.

    n

    The initial power to which you want to raise x.

    m

    The step by which to increase n for each term in the series.

    coefficients

    A set of coefficients by which each successive power of x is multiplied. The number of values in coefficients determines the number of terms in the power series. For example, if there are three values in coefficients, then there will be three terms in the power series.

  • Many functions can be approximated by a power series expansion. Returns the sum of a power series based on the formula:

    SERIES(x, n, m, a)=a_1x^n+a_2x^{n+m}+…+a_ix^{n+(i-1)m}

    Declaration

    Swift

    func SERIESSUM(_ x: BigDouble, _ n: BigDouble, _ m: BigDouble, _ coefficients: [BigDouble]) throws -> BigDouble

    Parameters

    x

    The input value to the power series.

    n

    The initial power to which you want to raise x.

    m

    The step by which to increase n for each term in the series.

    coefficients

    A set of coefficients by which each successive power of x is multiplied. The number of values in coefficients determines the number of terms in the power series. For example, if there are three values in coefficients, then there will be three terms in the power series.

  • Determines the sign of a number. Returns 1 if the number is positive, zero (0) if the number is 0, and -1 if the number is negative.

    Declaration

    Swift

    func SIGN(_ n: BigDouble) -> BigInt

    Parameters

    n

    Any real number.

  • Sinus function

    Declaration

    Swift

    func SIN(_ n: BigDouble) throws -> BigDouble

    Parameters

    n

    Any real less than 2pi

  • Hyperbolic sinus function

    Declaration

    Swift

    func SINH(_ n: BigDouble) -> BigDouble

    Parameters

    n

    Any real

  • Returns a positive square root.

    Declaration

    Swift

    func SQRT(_ n: BigDouble) throws -> BigDouble

    Parameters

    n

    The number for which you want the square root.

  • Returns a positive nth root.

    Declaration

    Swift

    func ROOT(_ n: BigDouble, _ base: Int) throws -> BigDouble

    Parameters

    n

    The number for which you want the square root.

    base

    The nth root (ex: 2, 3,…).

  • Returns the square root of (number * pi).

    Declaration

    Swift

    func SQRTPI(_ n: BigDouble) throws -> BigDouble

    Parameters

    n

    The number by which pi is multiplied.

Todo: SUBTOTAL

TODO: SUMIF(s)

Date & Time

  • The DATE function returns the sequential serial number that represents a particular date.

    Declaration

    Swift

    func DATE(_ year: Int, _ month: Int, _ day: Int) throws -> BigDouble

    Parameters

    year

    The year of your date

    month

    The month of your date

    day

    The day of your date

    Return Value

    Serial Date

  • The DATEVALUE function converts a date that is stored as text to a serial number.

    For example, the formula =DATEVALUE(“1/1/2008”) returns 39448, the serial number of the date 1/1/2008. Remember, though, that your computer’s system date setting may cause the results of a DATEVALUE function to vary from this example The DATEVALUE function is helpful in cases where a worksheet contains dates in a text format that you want to filter, sort, or format as dates, or use in date calculations.

    Declaration

    Swift

    func DATEVALUE(_ str: String) throws -> BigDouble

    Parameters

    str

    Text that represents a date in an Euler date format, or a reference to a cell that contains text that represents a date in an Euler date format. For example, “1/30/2008” is a text string within quotation marks that represent a date.

    Return Value

    Serial Date

  • YEARFRAC calculates the fraction of the year represented by the number of whole days between two dates (the start and the end).

    For instance, you can use YEARFRAC to identify the proportion of a whole year’s benefits, or obligations to assign to a specific term.

    Declaration

    Swift

    func YEARFRAC(start: BigDouble, end: BigDouble, basis: Int = 0) throws -> BigDouble

    Parameters

    start

    A date that represents the start date.

    end

    A date that represents the end date.

    basis

    The type of day count basis to use.

    Return Value

    The proportion of the year

Add Bessel functions

  • Converts a binary number to decimal.

    Throws

    If number isn’t composed of 1s or 0s, the function will fail

    Declaration

    Swift

    func BIN2DEC(_ number: BigDouble) throws -> BigDouble

    Parameters

    number

    Input number to be converted (has to be composed of 1s and 0s)

    Return Value

    The converted number

  • Converts a binary number to hexadecimal.

    Throws

    If number isn’t composed of 1s or 0s, the function will fail

    Declaration

    Swift

    func BIN2HEX(_ number: BigDouble) throws -> String

    Parameters

    number

    Input number to be converted (has to be composed of 1s and 0s)

    Return Value

    The converted number

  • Converts a binary number to octal.

    Throws

    If number isn’t composed of 1s or 0s, the function will fail

    Declaration

    Swift

    func BIN2OCT(_ number: BigDouble) throws -> BigDouble

    Parameters

    number

    Input number to be converted (has to be composed of 1s and 0s)

    Return Value

    The converted number

  • Returns a bitwise ‘AND’ of two numbers.

    Declaration

    Swift

    func BITAND(_ lhs: BigInt, _ rhs: BigInt) -> BigInt
  • Returns a bitwise ‘OR’ of two numbers.

    Declaration

    Swift

    func BITOR(_ lhs: BigInt, _ rhs: BigInt) -> BigInt
  • Returns a bitwise ‘XOR’ of two numbers.

    Declaration

    Swift

    func BITXOR(_ lhs: BigInt, _ rhs: BigInt) -> BigInt
  • Returns a number shifted left by the specified number of bits.

    Declaration

    Swift

    func BITLSHIFT(_ n: BigInt, _ amount: BigInt) -> BigInt

    Parameters

    n

    Number must be an integer greater than or equal to 0.

    amount

    Shift amount

    Return Value

    Number shifted to the left

  • Returns a number shifted right by the specified number of bits.

    Declaration

    Swift

    func BITRSHIFT(_ n: BigInt, _ amount: BigInt) -> BigInt

    Parameters

    n

    Number must be an integer greater than or equal to 0.

    amount

    Shift amount

    Return Value

    Number shifted to the right

  • Converts a number from one measurement system to another. For example, CONVERT can translate a table of distances in miles to a table of distances in kilometers.

    Declaration

    Swift

    func CONVERT(_ n: BigDouble, from_unit: String, to_unit: String) throws -> BigDouble

    Parameters

    n

    It is the value in from_unit units to convert.

    from_unit

    It is the units for number.

    to_unit

    The units for the result.

  • Converts a decimal number to binary.

    Declaration

    Swift

    func DEC2BIN(_ number: BigDouble) -> BigDouble

    Parameters

    number

    Input number to be converted

    Return Value

    The converted number

  • Converts a decimal number to hexadecimal.

    Declaration

    Swift

    func DEC2HEX(_ number: BigDouble) -> String

    Parameters

    number

    Input number to be converted

    Return Value

    The converted number

  • Converts a decimal number to octal.

    Declaration

    Swift

    func DEC2OCT(_ number: BigDouble) -> BigDouble

    Parameters

    number

    Input number to be converted

    Return Value

    The converted number

  • Tests whether two values are equal. Returns 1 if number1 = number2; returns 0 otherwise. Use this function to filter a set of values. For example, by summing several DELTA functions you calculate the count of equal pairs. This function is also known as the Kronecker Delta function.

    Declaration

    Swift

    func DELTA(_ number1: BigDouble, _ number2: BigDouble) -> Int

    Parameters

    number1

    Any number

    number2

    Any number

    Return Value

    Returns 1 if number1 = number2; returns 0 otherwise

Todo: Error functions

  • Converts an hexadecimal number to binary

    Declaration

    Swift

    func HEX2BIN(_ str: String) throws -> BigInt

    Parameters

    number

    Input number to be converted

    Return Value

    The converted number

  • Converts an hexadecimal number to decimal

    Declaration

    Swift

    func HEX2DEC(_ str: String) throws -> BigInt

    Parameters

    number

    Input number to be converted

    Return Value

    The converted number

  • Converts an hexadecimal number to octal

    Declaration

    Swift

    func HEX2OCT(_ str: String) throws -> BigInt

    Parameters

    number

    Input number to be converted

    Return Value

    The converted number

Financial functions

  • Returns the accrued interest for a security that pays periodic interest.

    Throws

    TablesError

    Declaration

    Swift

    func ACCRINT(_ issue: Int, _ first: Int, _ settlement: Int, _ rate: BigDouble, _ par: BigDouble = 1000, _ frequency: Int = 1, _ basis: Int = 0) throws -> BigDouble

    Parameters

    issue

    The security’s issue date.

    first

    The security’s first interest date.

    settlement

    The security’s settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.

    rate

    The security’s annual coupon rate.

    par

    The security’s par value. If you omit par, ACCRINT uses $1,000.

    frequency

    The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.

    basis

    The type of day count basis to use.

    Return Value

    Accrued interest for a security that pays periodic interest

Logical operators

  • AND operator.

    If argument list contains a false statement, it returns false, otherwise it returns true

    Declaration

    Swift

    func AND(_ b: Bool...) -> Bool
  • AND operator.

    If argument list contains a false statement, it returns false, otherwise it returns true

    Declaration

    Swift

    func AND(_ b: [Bool]) -> Bool
  • Use CHOOSE to select one of up to 256 values based on the index number.

    For example, if value1 through value7 are the days of the week, CHOOSE returns one of the days when a number between 1 and 7 is used as i.

    Declaration

    Swift

    func CHOOSE<T>(_ i: Int, _ b: T...) throws -> T

    Parameters

    i

    Specifies which value argument is selected.

    b

    1 to 254 value arguments from which CHOOSE selects a value or an action to perform based on index.

  • Use CHOOSE to select one of up to 256 values based on the index number.

    For example, if value1 through value7 are the days of the week, CHOOSE returns one of the days when a number between 1 and 7 is used as i.

    Declaration

    Swift

    func CHOOSE<T>(_ i: Int, _ b: [T]) throws -> T

    Parameters

    i

    Specifies which value argument is selected.

    b

    1 to 254 value arguments from which CHOOSE selects a value or an action to perform based on index.

  • The IF function allows you to make a logical comparison between a value and what you expect by testing for a condition and returning a result if that condition is True or False.

    Declaration

    Swift

    func IF<T>(_ c: Bool, _ a: T, _ b: T) -> T

    Parameters

    c

    Condition

    a

    Value to return if c is true

    b

    Value to return if c is false

  • OR operator.

    If argument list contains at least one true statement, it returns true, otherwise it returns false

    Declaration

    Swift

    func OR(_ b: Bool...) -> Bool
  • OR operator.

    If argument list contains at least one true statement, it returns true, otherwise it returns false

    Declaration

    Swift

    func OR(_ b: [Bool]) -> Bool
  • The XOR function returns a logical Exclusive Or of all arguments.

    Declaration

    Swift

    func XOR(_ b: Bool...) -> Bool

    Parameters

    b

    Conditions

  • The XOR function returns a logical Exclusive Or of all arguments.

    Declaration

    Swift

    func XOR(_ b: [Bool]) -> Bool

    Parameters

    b

    Conditions

Statistical functions

  • Returns the average of the absolute deviations of data points from their mean. AVEDEV is a measure of the variability in a data set.

    Declaration

    Swift

    func AVEDEV(_ array: [BigDouble]) -> BigDouble
  • Returns the average (arithmetic mean) of the arguments. For example, if the range A1:A20 contains numbers, the formula =AVERAGE(A1:A20) returns the average of those numbers.

    Declaration

    Swift

    func AVERAGE(_ array: [BigDouble]) -> BigDouble
  • The CORREL function returns the correlation coefficient of two arrays. Use the correlation coefficient to determine the relationship between two properties. For example, you can examine the relationship between a location’s average temperature and the use of air conditioners.

    Declaration

    Swift

    func CORREL(_ array1: [BigDouble], _ array2: [BigDouble]) throws -> BigDouble

    Parameters

    array1

    A an array of values

    array2

    A an array of values

    Return Value

    Correlation coefficient of two arrays

  • Counts the element of the given array

    Declaration

    Swift

    func COUNT(_ array: [Any]) -> Int

    Parameters

    array

    Any array composed of random elements

    Return Value

    Counted value

  • Counts the unique element of the given array

    Declaration

    Swift

    func COUNTUNIQUE(_ array: [AnyHashable]) -> Int

    Parameters

    array

    Any array composed of random Hashable elements

    Return Value

    Counted value

  • Returns the sum of squares of deviations of data points from their sample mean.

    Declaration

    Swift

    func DEVSQ(_ array: [BigDouble]) -> BigDouble
  • Returns the Fisher transformation at x. This transformation produces a function that is normally distributed rather than skewed. Use this function to perform hypothesis testing on the correlation coefficient.

    Declaration

    Swift

    func FISHER(_ x: BigDouble) -> BigDouble
  • Returns the inverse of the Fisher transformation. Use this transformation when analyzing correlations between ranges or arrays of data. If y = FISHER(x), then FISHERINV(y) = x.

    Declaration

    Swift

    func FISHERINV(_ y: BigDouble) -> BigDouble
  • The gamma function (represented by \Gamma, the capital letter gamma from the Greek alphabet) is one commonly used extension of the factorial function to complex numbers. The gamma function is defined for all complex numbers except the non-positive integers. For any positive integer n: \Gamma (n)=(n-1)!

    Declaration

    Swift

    func GAMMA(_ x: BigDouble) throws -> BigDouble

    Parameters

    x

    Any number

    Return Value

    The gamma function value.

  • Returns the natural logarithm of the gamma function, \Gamma (x).

    Declaration

    Swift

    func GAMMALN(_ x: BigDouble) throws -> BigDouble

    Parameters

    x

    Any number

  • Integral of the Gauss function

    Computed using:

    \int_{0}^{x}\frac{1}{\sqrt{2\pi}}*e^{-\frac{x^{2}}{2}}dx = \frac{1}{2}\cdot \operatorname{erf}\left( \frac{x}{\sqrt{2}} \right)

    Declaration

    Swift

    func GAUSS(_ x: BigDouble) -> BigDouble

    Parameters

    x

    Any number

  • Returns the geometric mean.

    In mathematics, the geometric mean is a mean or average, which indicates the central tendency or typical value of a set of numbers by using the product of their values (as opposed to the arithmetic mean which uses their sum). The geometric mean is defined as the nth root of the product of n numbers, i.e., for a set of numbers x_1, x_2, …, x_n, the geometric mean is defined as

    \left(\prod_{i=1}^n x_i\right)^\frac{1}{n} = \sqrt[n]{x_1 x_2 \cdots x_n}

    Declaration

    Swift

    func GEOMEAN(_ array: [BigDouble]) -> BigDouble
  • Returns the harmonic mean

    In mathematics, the harmonic mean (sometimes called the subcontrary mean) is one of several kinds of average, and in particular, one of the Pythagorean means. Typically, it is appropriate for situations when the average of rates is desired.

    The harmonic mean can be expressed as the reciprocal of the arithmetic mean of the reciprocals of the given set of observations. As a simple example, the harmonic mean of 1, 4, and 4 is

    \left(\frac{1^{-1} + 4^{-1} + 4^{-1}}{3}\right)^{-1} = \frac{3}{\frac{1}{1} + \frac{1}{4} + \frac{1}{4}} = \frac{3}{1.5} = 2

    Declaration

    Swift

    func HARMEAN(_ array: [BigDouble]) -> BigDouble
  • Returns the kurtosis of a data set. Kurtosis characterizes the relative peakedness or flatness of a distribution compared with the normal distribution. Positive kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a relatively flat distribution.

    Declaration

    Swift

    func KURT(_ array: [BigDouble]) -> BigDouble
  • Returns the maximum element in the sequence.

    Declaration

    Swift

    func MAX(_ array: [BigDouble]) -> BigDouble?

    Parameters

    array

    Any BigDouble array

    Return Value

    The sequence’s maximum element. If the sequence has no elements, returns nil.

  • The median is the number in the middle of a set of numbers.

    If there is an even number of numbers in the set, then MEDIAN calculates the average of the two numbers in the middle.

    Declaration

    Swift

    func MEDIAN(_ array: [BigDouble]) -> BigDouble

    Parameters

    array

    Any BigDouble array

    Return Value

    The median of the given numbers.

  • Returns the minimum element in the sequence.

    Declaration

    Swift

    func MIN(_ array: [BigDouble]) -> BigDouble?

    Parameters

    array

    Any BigDouble array

    Return Value

    The sequence’s minimum element. If the sequence has no elements, returns nil.

  • Returns the number of permutations for a given number of objects that can be selected from number objects.

    A permutation is any set or subset of objects or events where internal order is significant. Permutations are different from combinations, for which the internal order is not significant. Use this function for lottery-style probability calculations.

    Declaration

    Swift

    func PERMUT(_ number: Int, _ numberChosen: Int) throws -> BigInt

    Parameters

    number

    An integer that describes the number of objects.

    numberChosen

    An integer that describes the number of objects in each permutation.

  • Phi function

    Declaration

    Swift

    func PHI(_ x: BigDouble) -> BigDouble

    Parameters

    x

    the number for which you want the density of the standard normal distribution.

    Return Value

    the value of the density function for a standard normal distribution.

  • Returns the k-th percentile of values in a range. You can use this function to establish a threshold of acceptance. For example, you can decide to examine candidates who score above the 90th percentile.

    Declaration

    Swift

    func PERCENTILE(_ array: [BigDouble], percent: Double) throws -> BigDouble

    Parameters

    array

    The array or range of data that defines relative standing.

    percent

    The percentile value in the range 0..1, exclusive.

  • Returns the skewness of a distribution. Skewness characterizes the degree of asymmetry of a distribution around its mean. Positive skewness indicates a distribution with an asymmetric tail extending toward more positive values. Negative skewness indicates a distribution with an asymmetric tail extending toward more negative values.

    Declaration

    Swift

    func SKEW(_ array: [BigDouble]) -> BigDouble
  • Returns a normalized value from a distribution characterized by mean and standard deviation.

    Declaration

    Swift

    func STANDARDIZE(_ x: BigDouble, _ mean: BigDouble, _ sd: BigDouble) -> BigDouble

    Parameters

    x

    The value you want to normalize

    mean

    The arithmetic mean of the distribution

    sd

    The standard deviation of the distribution

  • Returns the standard deviation of the list

    The standard deviation (SD, also represented by the lower case Greek letter sigma σ for the population standard deviation or the Latin letter s for the sample standard deviation) is a measure of the amount of variation or dispersion of a set of values. A low standard deviation indicates that the values tend to be close to the mean (also called the expected value) of the set, while a high standard deviation indicates that the values are spread out over a wider range.

    Computed using:

    \sigma = \sqrt{\frac{\sum_{}^{}(x-\bar{x})^2}{n-1}}

    Declaration

    Swift

    func STDEV(_ array: [BigDouble]) -> BigDouble
  • Returns the variance of the list

    In probability theory and statistics, variance is the expectation of the squared deviation of a random variable from its mean. Informally, it measures how far a set of (random) numbers are spread out from their average value.

    Computed using:

    V = \sigma^2 = \frac{\sum_{}^{}(x-\bar{x})^2}{n-1}

    Declaration

    Swift

    func VAR(_ array: [BigDouble]) -> BigDouble
  • Interprets the given command

    Declaration

    Swift

    func interpret(command: String) throws -> CellValue

    Parameters

    command

    The command you want to execute. Example: =SUM(1, 2, 3, 4)

  • Huge list of all Tables functions.

    While this is public, it’s not intended for use.

    Declaration

    Swift

    static var functions: [String : (([CellValue]) throws -> CellValue)] { get }
  • Common Formulas Functions (for parser)

    Declaration

    Swift

    var commonFormulas: [String : (([CellValue]) throws -> CellValue)] { get }
  • Date/Time related Formulas Functions (for parser)

    Declaration

    Swift

    var dateFormulas: [String : (([CellValue]) throws -> CellValue)] { get }
  • Engineering Formulas Functions (for parser)

    Declaration

    Swift

    var engineeringFormulas: [String : (([CellValue]) throws -> CellValue)] { get }
  • Financial Formulas Functions (for parser)

    Declaration

    Swift

    var financialFormulas: [String : (([CellValue]) throws -> CellValue)] { get }
  • Logical Formulas Functions (for parser)

    Declaration

    Swift

    var logicalFormulas: [String : (([CellValue]) throws -> CellValue)] { get }
  • Statistical Formulas Functions (for parser)

    Declaration

    Swift

    var statsFormulas: [String : (([CellValue]) throws -> CellValue)] { get }