RangeExtensions.Count(CellRange, Boolean, Boolean) Method
In This Article
Returns the number of cells in the current cell range that contain data.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.2.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
#Declaration
public static int Count(
this CellRange range,
bool ignoreHiddenRows,
bool ignoreHiddenColumns
)
#Parameters
Name | Type | Description |
---|---|---|
range | Cell |
A cell range for which the count is calculated. |
ignore |
Boolean | true to exclude hidden rows from calculation; otherwise, false. |
ignore |
Boolean | true to exclude hidden columns from calculation; otherwise, false. |
#Returns
Type | Description |
---|---|
Int32 | The number of cells with data. |
#Remarks
Use the following extension methods to summarize data in a cell range. You can call these methods in the same way as instance methods of the CellRange object.
Method | Description |
---|---|
Range |
Returns the average of numerical values in a cell range. |
Range |
Returns the number of cells that contain data. |
Range |
Returns the number of cells that contain numerical data. |
Range |
Returns the sum of numerical values in a cell range. |
Range |
Returns the maximum numerical value in a cell range. |
Range |
Returns the minimum numerical value in a cell range. |
The following code example shows how to obtain summary values for selected cells in the Spreadsheet control.
CellRange selectedCells = spreadsheetControl1.Selection;
double average = selectedCells.Average(true, true);
double sum = selectedCells.Sum(true, true);
double count = selectedCells.Count(true, true);
double numCount = selectedCells.NumericalCount(true, true);
See Also