Skip to content

Legacy array formulas

EPPlus has support for legacy array formulas and support for several new functions that depends on this functionality from version 7 and up. We have also improved the support for handling of complex addresses and usage of operators with ranges/addresses.

Legacy array formulas

Legacy arrayformulas are added with the function CreateArrayFormula on the ExcelRangeBase class - this corresponds to selecting a range in Excel, enter the formula in the top-left cell and then pressing CTRL+SHIFT+ENTER to confirm it.

With legacy array formulas you must specify the target range of the array, see example below:

sheet.Cells["A1"].Value = 1;
sheet.Cells["A2"].Value = 2;
sheet.Cells["A3"].Value = 3;

sheet.Cells["A4:C4"].CreateArrayFormula("TRANSPOSE(A1:A3)");
sheet.Calculate();
// A4:C4 will now contain 1, 2, 3
sheet.Cells("A1").Value = 1
sheet.Cells("A2").Value = 2
sheet.Cells("A3").Value = 3

sheet.Cells("A4:C4").CreateArrayFormula("TRANSPOSE(A1:A3)")
sheet.Calculate()
' A4:C4 will now contain 1, 2, 3

See also