'Write a formula to a worksheet cell.
Args:
row:         The cell row (zero indexed).
col:         The cell column (zero indexed).
formula:     Cell formula.
cell_format: An optional cell Format object.
value:       An optional value for the formula. Default is 0.
Returns:
0:  Success.
-1: Row or column is out of worksheet bounds.'

@convert_cell_args
def write_formula(self, row, col, formula, cell_format=None, value=0):

    if self._check_dimensions(row, col):
        return (-1)
    if (formula.startswith('{') and formula.endswith('}')):
        return self.write_array_formula(row, col, row, col, formula, cell_format, value)
    if formula.startswith('='):
        formula = formula.lstrip('=')
    if (self.constant_memory and (row > self.previous_row)):
        self._write_single_row(row)
    self.table[row][col] = cell_formula_tuple(formula, cell_format, value)
    return 0
