Aggregate Excel Functions
Shows how to easily get aggregate vales from a Range of Cells in Excel.
Includes: Sum. Average, Min and Max.
Includes: Sum. Average, Min and Max.
using IronXL; using System.Linq; WorkBook workBook = WorkBook.Load("sample.xls"); WorkSheet workSheet = workBook.WorkSheets.First(); // Get range from worksheet var range = workSheet["A1:A8"]; // Apply sum of all numeric cells within the range decimal sum = range.Sum(); // Apply average value of all numeric cells within the range decimal avg = range.Avg(); // Identify maximum value of all numeric cells within the range decimal max = range.Max(); // Identify minimum value of all numeric cells within the range decimal min = range.Min();
Imports IronXL Imports System.Linq Private workBook As WorkBook = WorkBook.Load("sample.xls") Private workSheet As WorkSheet = workBook.WorkSheets.First() ' Get range from worksheet Private range = workSheet("A1:A8") ' Apply sum of all numeric cells within the range Private sum As Decimal = range.Sum() ' Apply average value of all numeric cells within the range Private avg As Decimal = range.Avg() ' Identify maximum value of all numeric cells within the range Private max As Decimal = range.Max() ' Identify minimum value of all numeric cells within the range Private min As Decimal = range.Min()
Install-Package IronXL.Excel