在C#中掌握Excel聚合函数

The code example above shows how to easily get aggregate values from a range of cells in an Excel spreadsheet. However, please note that any non-numerical cell will be left out.

Sum

The method Sum() returns the total sum of the selected range of cells.

Average

The method Average() returns the average of the selected range of cells.

Minimum

The method Min() returns the minimum number among the selected range of cells.

Maximum

The method Max() returns the maximum number among the selected range of cells.

For more flexibility, the above functions can also be applied to single/multiple rows or columns. Learn more about selecting rows and columns.

Explore Math Functions in Excel Using C#

准备开始了吗?
Nuget 下载 1,686,155 | 版本: 2025.11 刚刚发布