# Using the Array Formula

Learn how to use array formulas in Spread to perform multiple calculations on one or more items in an array. Discover how array formulas can return multiple results or a single result using Ctrl + Shift + Enter or the SetFormulaArray method.

## Content

You can use array formulas in Spread.
An array formula is a formula that can perform multiple calculations on one or more items in an array. Array formulas can return multiple results or a single result.
Use Ctrl + Shift + Enter to create an array formula after entering the formula at run time if the users are allowed to create formulas, or you can use the **SetFormulaArray** method.
The following image displays an array formula in the Total column.
![Example of Array Formula](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/arrayformula.png)

## Using Code

The following example creates an array formula.

```csharp
fpSpread1.ActiveSheet.ColumnHeader.Cells[0, 0].Text = "Units";
fpSpread1.ActiveSheet.ColumnHeader.Cells[0, 1].Text = "Price";
fpSpread1.ActiveSheet.ColumnHeader.Cells[0, 2].Text = "Total";
fpSpread1.ActiveSheet.Cells[0, 0].Value = 2;
fpSpread1.ActiveSheet.Cells[1, 0].Value = 5;
fpSpread1.ActiveSheet.Cells[2, 0].Value = 1;
fpSpread1.ActiveSheet.Cells[3, 0].Value = 9;
fpSpread1.ActiveSheet.Cells[0, 1].Value = 40;
fpSpread1.ActiveSheet.Cells[1, 1].Value = 100;
fpSpread1.ActiveSheet.Cells[2, 1].Value = 25;
fpSpread1.ActiveSheet.Cells[3, 1].Value = 80;
fpSpread1.AllowUserFormulas = true;
fpSpread1.ActiveSheet.Cells[0, 2, 3, 2].FormulaArray = "A1:A4*B1:B4";
```

```vbnet
fpSpread1.ActiveSheet.ColumnHeader.Cells(0, 0).Text = "Units"
fpSpread1.ActiveSheet.ColumnHeader.Cells(0, 1).Text = "Price"
fpSpread1.ActiveSheet.ColumnHeader.Cells(0, 2).Text = "Total"
fpSpread1.ActiveSheet.Cells(0, 0).Value = 2
fpSpread1.ActiveSheet.Cells(1, 0).Value = 5
fpSpread1.ActiveSheet.Cells(2, 0).Value = 1
fpSpread1.ActiveSheet.Cells(3, 0).Value = 9
fpSpread1.ActiveSheet.Cells(0, 1).Value = 40
fpSpread1.ActiveSheet.Cells(1, 1).Value = 100
fpSpread1.ActiveSheet.Cells(2, 1).Value = 25
fpSpread1.ActiveSheet.Cells(3, 1).Value = 80
fpSpread1.AllowUserFormulas = True
fpSpread1.ActiveSheet.Cells[0, 2, 3, 2].FormulaArray = "A1:A4*B1:B4"
```

## See Also

[Formulas in Cells](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula)
[Placing a Formula in Cells](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulaplace)
[Specifying a Cell Reference in a Formula](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulacellref)
[Specifying a Sheet Reference in a Formula](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulasheetref)
[Specifying an External Reference in a Formula](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-externalref)
[Using a Circular Reference in a Formula](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulacircref)
[Nesting Functions in a Formula](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulanested)
[Recalculating and Updating Formulas Automatically](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formularecalc)
[Finding a Value Using GoalSeek](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formula-goalseek)
[Allowing the User to Enter Formulas](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulaallowuser)
[Creating and Using a Custom Name](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulacustomname)
[Creating and Using a Custom Function](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulacustomfunc)
[Creating and Using External Variable](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-external-variable)
[Working with the Formula Text Box](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulabar)
[Setting up the Name Box](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-namebox)
[Using Language Package](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/UsingLanguagePackage)
[Accessing Data from Header or Footer](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-headerfooterformula)
[Managing External Reference](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-extrenalreference)
[Working With Dynamic Array Formulas](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/WorkingWithDynamicArrayFormulas)