Table of Contents

Method SetArrayFormula

Namespace
DocWright.Spreadsheet
Assembly
DocWright.Spreadsheet.dll

SetArrayFormula(string, string)

Enters an array formula over a range, as Excel's Ctrl+Shift+Enter does (Phase 210): every cell of the range computes it, a single value filling them all, a row or a column repeated across, #N/A where the result is smaller. An array formula already in the range is replaced when it lies wholly inside it.

public void SetArrayFormula(string range, string formula)

Parameters

range string

The range, such as B2:D4.

formula string

The formula, with or without its leading =, as Excel stores it: English function names, commas between arguments.

Remarks

The cells hold no results until Calculate(XlsxCalculationOptions?) is run; a workbook saved before asks Excel to calculate when it is opened.

Exceptions

ArgumentNullException

range or formula is null.

ArgumentException

The range is not a range of the worksheet grid or holds more than 2,097,152 cells, or the formula is empty, too long or not one Excel would read.

InvalidOperationException

The sheet is not a worksheet.

UnsupportedFeatureException

The range holds part of an array formula reaching outside it, or a header or totals cell of a table.

InvalidDocumentException

The sheet's part is malformed.