# Set Array Formula

DsExcel allows you to set an array formula that executes multiple calculations on a cell or a range of cells to display a column or a row of subtotals.

## Content

Array formula is a formula that can execute multiple calculations on individual cells or a range of cells to display a column or a row of subtotals. The array formula can consist of array of row of values, column of values or simply a combination of rows and columns of values that may return either multiple results or a single result.
Array formulas can be used to simplify the following tasks in a worksheet:

1. You can count the number of characters in a range of cells.
2. You can sum numeric values in cells that meet a specified criteria. For instance,the highest value in a range or values that fall between an upper and lower boundary.
3. You can sum every nth value in a range of cell values in a spreadsheet.

In DsExcel .NET, you can use [FormulaArray property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IRange.FormulaArray.html) of the [IRange interface](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IRange.html) to set array formula for a range. In case, you want to find out whether a range has array formula or not, you can use the [HasArray property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IRange.HasArray.html) of the IRange interface. In order to get an entire array if specified range is part of an array, you can use [CurrentArray property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IRange.CurrentArray.html).
Refer to the following example code to set array formula and get entire array:

```csharp
// Setting cell value using arrays
worksheet.Range["E4:J5"].Value = new object[,]
{
    {1, 2, 3},
    {4, 5, 6}
};

worksheet.Range["I6:J8"].Value = new object[,]
{
    {2, 2},
    {3, 3},
    {4, 4}
};
// To set array formula for range.
//O     P      Q
//2     4      #N/A
//12    15     #N/A
//#N/A  #N/A   #N/A
worksheet.Range["O9:Q11"].FormulaArray = "=E4:G5*I6:J8";
            
//O9's current array is "O9:Q11". Current array gets the entire array.
var currentarray = worksheet.Range["O9"].CurrentArray.ToString();
```