worksheet_write_array_formula

@brief Write an array formula to a worksheet cell.

@param worksheet @param first_row The first row of the range. (All zero indexed.) @param first_col The first column of the range. @param last_row The last row of the range. @param last_col The last col of the range. @param formula Array formula to write to cell. @param format A pointer to a Format instance or NULL.

@return A #lxw_error code.

* The %worksheet_write_array_formula() function writes an array formula to a cell range. In Excel an array formula is a formula that performs a calculation on a set of values.

In Excel an array formula is indicated by a pair of braces around the formula: {=SUM(A1:B1*A2:B2)}.

Array formulas can return a single value or a range or values. For array formulas that return a range of values you must specify the range that the return values will be written to. This is why this function has first_ and last_ row/column parameters. The RANGE() macro can also be used to specify the range:

@code worksheet_write_array_formula(worksheet, 4, 0, 6, 0, "{=TREND(C5:C7,B5:B7)}", NULL);

// Same as above using the RANGE() macro. worksheet_write_array_formula(worksheet, RANGE("A5:A7"), "{=TREND(C5:C7,B5:B7)}", NULL); @endcode

If the array formula returns a single value then the first_ and last_ parameters should be the same:

@code worksheet_write_array_formula(worksheet, 1, 0, 1, 0, "{=SUM(B1:C1*B2:C2)}", NULL); worksheet_write_array_formula(worksheet, RANGE("A2:A2"), "{=SUM(B1:C1*B2:C2)}", NULL); @endcode

Meta