Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Collapse]Spreadsheet
   [Expand]Product Information
    Product Structure
    Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
   [Collapse]Spreadsheet Formulas
    [Expand]Functions
     Operators
     Array Formulas
     Calculation
     Formula Engine
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
    Data Grouping
   [Expand]Pivot Table Overview
   [Expand]Charting Overview
    Printing
    Events
   [Expand]Mail Merge Overview
    Protection
    Find and Replace
   [Expand]Visual Elements
    Services
   [Expand]Shortcuts
   [Expand]Examples
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Array Formulas

Expanded What is an Array Formula

An Array formula is a formula that performs actions on two or more sets of values, which are called array arguments. Each array argument must have the same number of rows and columns. The result of an array formula can be either a single value or multiple values.

Array arguments can be cell ranges or array constants.

An array formula that returns a single value typically processes a series of data, and aggregates it using the SUM, COUNT or AVERAGE functions. The resulting value is written into a cell to which the formula belongs. Usually, an array formula returns a series of data. Returned values are distributed among the cells of the array formula range. If the number of values exceeds the number of cells, excessive values are not shown. If the number of cells is greater than the number of values, excessive cells are not left blank - they are filled with the same values repeatedly.

An individual cell or group of cells that is part of the array formula range is read-only. Any attempt to change the cell value results in an exception. An array formula range only allows you to change the formula for the entire range. However, you can change cell formatting (color, font, etc.) for each cell individually.

Expanded How to Create an Array Formula

This example demonstrates how to create an array formula.

The Range object provides the Range.ArrayFormula property to specify the array formula for a range of cells. The range of cells containing the same array formula is treated as a single entity. Thus, you can only modify data for the entire range.

To determine the array formula range, use the Cell.GetArrayFormulaRange method. If a cell is not a part of the range specified by the array formula, this method returns null .

All array formulas in a worksheet are accessible via the Worksheet.ArrayFormulas property that returns the ArrayFormulaCollection object. This object is a collection of ArrayFormula type items. Therefore, you can easily determine the ArrayFormula.Range of cells that contain the array formula, as well as the text of the ArrayFormula.Formula itself.

Expanded How to Modify an Array Formula

Array formulas can be modified for the entire formula range only. To change the formula, get its range via the Cell.GetArrayFormulaRange method or the ArrayFormula.Range property. You can also access the required range using the Worksheet.Range property. The Range.ArrayFormula property will allow you to get or set the array formula for the created range.

For each cell that belongs to the array formula range, the Range.ArrayFormula property returns a formula string, and throws a System.InvalidOperationException when trying to set its value.

To check whether or not the cell is the top left cell in the range, use the Cell.IsTopLeftCellInArrayFormulaRange property.

Cells have the Range.Formula property, which gets or sets ordinary formulas. If a cell belongs to the array formula range, the Range.Formula property returns the same string as the Range.ArrayFormula property. An attempt to set the Formula property for any cell(s) in the array formula range results in an exception indicating that a portion of the array cannot be changed.

Expanded How to Delete an Array Formula

To delete an array formula, assign an empty string to the Range.ArrayFormula property of the entire array formula range.

Expanded See Also

How would you rate this topic?​​​​​​​