Class Formula

Represents a formula for a cell or group of cells.

Formulas provide a way to show dynamic values in a cell. The value could be based any number of factors, such as the values of other cells and the time of day. Those alternate cells can even exist in different workbook files on the user's machine or on the internet.

See Microsoft Excel help for more information on formulas.

Use one of the Parse or TryParse overloads to create a new formula.

Hierarchy

Constructors

constructor

  • Parameters

    • a: number
    • b: number
    • c: FormulaType

    Returns Formula

  • Parameters

    Returns Formula

  • Parameters

    Returns Formula

  • Parameters

    • a: number
    • b: Formula
    • Optional c: boolean

    Returns Formula

  • Parameters

    • a: number
    • Rest ..._rest: any[]

    Returns Formula

Properties

$type

$type: Type

Static $t

$t: Type = markType(Formula, 'Formula')

Static nextHashCode

nextHashCode: number

Methods

applyTo

  • Applies the formula to all specified regions of cells.

    This method, or one of the other ApplyTo overrides must be used to set the value of a cell to a formula.

    After this method returns, the WorksheetCell.formula of all cells in all specified regions will return the formula.

    throws

    [[ArgumentNullException]] 'regions' is null.

    throws

    [[ArgumentException]] 'regions' has a length of 0.

    throws

    [[ArgumentException]] Not all regions specified are from the same worksheet.

    throws

    [[InvalidOperationException]] One or more regions specified contain array formulas or data tables which extend outside the region.

    see

    applyTo

    see

    applyTo

    see

    WorksheetCell.applyFormula

    see

    WorksheetRegion.applyFormula

    Parameters

    Returns void

  • Applies the formula to the specified cell.

    This method, or one of the other ApplyTo overrides must be used to set the value of a cell to a formula.

    After this method returns, the WorksheetCell.formula of the specified cell will return the formula.

    throws

    [[ArgumentNullException]] 'cell' is null.

    throws

    [[InvalidOperationException]] 'cell' is part of an array formula or data table which is not confined to just the cell.

    see

    WorksheetCell.value

    see

    applyTo

    see

    applyTo

    see

    WorksheetCell.applyFormula

    see

    WorksheetRegion.applyFormula

    see

    WorksheetRegion.applyArrayFormula

    Parameters

    Returns void

  • Applies the formula to the specified region of cells.

    This method, or one of the other ApplyTo overrides must be used to set the value of a cell to a formula.

    After this method returns, the WorksheetCell.formula of all cells in the specified region will return the formula.

    throws

    [[ArgumentNullException]] 'region' is null.

    throws

    [[InvalidOperationException]] 'region' contains an array formula or data table which extends outside the region.

    see

    applyTo

    see

    applyTo

    see

    WorksheetCell.applyFormula

    see

    WorksheetRegion.applyFormula

    see

    WorksheetRegion.applyArrayFormula

    Parameters

    Returns void

equals

  • equals(other: any): boolean
  • Parameters

    • other: any

    Returns boolean

getHashCode

  • getHashCode(): number
  • Returns number

memberwiseClone

  • memberwiseClone(): Base
  • Returns Base

toString

  • Converts the formula to a string representation, similar to the string with which it was created. This uses the CellReferenceMode with which the formula was created to create cell reference strings.

    Returns string

    The string representing the formula.

  • Converts the formula to a string representation, similar to the string with which it was created.

    Parameters

    • cellReferenceMode: CellReferenceMode

      The cell reference mode used to create cell reference strings.

    Returns string

    The string representing the formula.

  • Converts the formula to a string representation, similar to the string with which it was created.

    Parameters

    • cellReferenceMode: CellReferenceMode

      The cell reference mode used to create cell reference strings.

    • culture: string | CultureInfo

      The culture used to generate the formula string.

    Returns string

    The string representing the formula.

Static areEqual

  • Determines whether two Formula instances are equal using the specified cell reference mode. This essentially performs a case-insensitive string comparison, ignoring the white space in the formula.

    Parameters

    • formulaA: Formula

      The first Formula to compare.

    • formulaB: Formula

      The second Formula to compare.

    • cellReferenceMode: CellReferenceMode

      The cell reference mode to use when comparing the two formulas.

    Returns boolean

    True if the formulas are both null or both equivalent; False otherwise.

Static compare

  • compare(item1: any, item2: any): number
  • Parameters

    • item1: any
    • item2: any

    Returns number

Static compareSimple

  • compareSimple(item1: any, item2: any): number
  • Parameters

    • item1: any
    • item2: any

    Returns number

Static equalsSimple

  • equalsSimple(item1: any, item2: any): boolean
  • Parameters

    • item1: any
    • item2: any

    Returns boolean

Static equalsStatic

  • equalsStatic(a: any, b: any): boolean
  • Parameters

    • a: any
    • b: any

    Returns boolean

Static getArrayOfProperties

  • getArrayOfProperties(obj: any): any[]
  • Parameters

    • obj: any

    Returns any[]

Static getArrayOfValues

  • getArrayOfValues(obj: any): any[]
  • Parameters

    • obj: any

    Returns any[]

Static getHashCodeStatic

  • getHashCodeStatic(obj: any): number
  • Parameters

    • obj: any

    Returns number

Static parse

  • Parses the specified formula value and returns the formula which was created from it.

    throws

    [[ArgumentNullException]] 'value' is null or empty.

    throws

    InvalidEnumArgumentException 'cellReferenceMode' is not defined in the CellReferenceMode enumeration.

    throws

    FormulaParseException 'value' is not a valid formula.

    Parameters

    • value: string

      The string which defines the formula to parse.

    • cellReferenceMode: CellReferenceMode

      The mode used to interpret cell references in the formula.

    Returns Formula

    A Formula instance which represents the formula specified.

  • Parses the specified formula value and returns the formula which was created from it.

    throws

    [[ArgumentNullException]] 'value' is null or empty.

    throws

    InvalidEnumArgumentException 'cellReferenceMode' is not defined in the CellReferenceMode enumeration.

    throws

    InvalidEnumArgumentException 'fileFormat' is not defined in the WorkbookFormat enumeration.

    throws

    FormulaParseException 'value' is not a valid formula.

    Parameters

    • value: string

      The string which defines the formula to parse.

    • cellReferenceMode: CellReferenceMode

      The mode used to interpret cell references in the formula.

    • fileFormat: WorkbookFormat

      The file format to use when parsing the formula. This will be used to determine certain limits which are format dependant.

    Returns Formula

    A Formula instance which represents the formula specified.

  • Parses the specified formula value and returns the formula which was created from it.

    throws

    [[ArgumentNullException]] 'value' is null or empty.

    throws

    InvalidEnumArgumentException 'cellReferenceMode' is not defined in the CellReferenceMode enumeration.

    throws

    InvalidEnumArgumentException 'fileFormat' is not defined in the WorkbookFormat enumeration.

    throws

    FormulaParseException 'value' is not a valid formula.

    Parameters

    • value: string

      The string which defines the formula to parse.

    • cellReferenceMode: CellReferenceMode

      The mode used to interpret cell references in the formula.

    • fileFormat: WorkbookFormat

      The file format to use when parsing the formula. This will be used to determine certain limits which are format dependant.

    • culture: string | CultureInfo

      The culture used to parse the formula.

    Returns Formula

    A Formula instance which represents the formula specified.

  • Parses the specified formula value and returns the formula which was created from it.

    throws

    [[ArgumentNullException]] 'value' is null or empty.

    throws

    InvalidEnumArgumentException 'cellReferenceMode' is not defined in the CellReferenceMode enumeration.

    throws

    FormulaParseException 'value' is not a valid formula.

    Parameters

    • value: string

      The string which defines the formula to parse.

    • cellReferenceMode: CellReferenceMode

      The mode used to interpret cell references in the formula.

    • culture: string | CultureInfo

      The culture used to parse the formula.

    Returns Formula

    A Formula instance which represents the formula specified.

Static referenceEquals

  • referenceEquals(a: any, b: any): boolean
  • Parameters

    • a: any
    • b: any

    Returns boolean

Static staticInit

  • staticInit(): void
  • Returns void