officefileapi-devexpress-dot-spreadsheet-dot-rangeextensions-dot-max-x28-devexpress-dot-spreadsheet-dot-cellrange-system-dot-boolean-system-dot-boolean-x29.md
Returns the maximum numerical value in the current cell range.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
public static double? Max(
this CellRange range,
bool ignoreHiddenRows,
bool ignoreHiddenColumns
)
<ExtensionAttribute>
Public Shared Function Max(
range As CellRange,
ignoreHiddenRows As Boolean,
ignoreHiddenColumns As Boolean
) As Double?
| Name | Type | Description |
|---|---|---|
| range | CellRange |
A cell range for which the maximum value is calculated.
| | ignoreHiddenRows | Boolean |
true to exclude hidden rows from calculation; otherwise, false.
| | ignoreHiddenColumns | Boolean |
true to exclude hidden columns from calculation; otherwise, false.
|
| Type | Description |
|---|---|
| Nullable<Double> |
The maximum cell value. Null ( Nothing in Visual Basic), if the cell range doesn’t contain numeric values.
|
Use the following extension methods to summarize values in a cell range. You can call these methods in the same way as instance methods of the CellRange object.
| Method | Description |
|---|---|
| RangeExtensions.Average | Returns the average of numerical values in a cell range. |
| RangeExtensions.Count | Returns the number of cells that contain data. |
| RangeExtensions.NumericalCount | Returns the number of cells that contain numerical data. |
| RangeExtensions.Sum | Returns the sum of numerical values in a cell range. |
| RangeExtensions.Max | Returns the maximum numerical value in a cell range. |
| RangeExtensions.Min | Returns the minimum numerical value in a cell range. |
The following code example shows how to obtain the minimum and maximum values for selected cells in the Spreadsheet control.
double? max = spreadsheetControl.Selection.Max(true, true);
double? min = spreadsheetControl.Selection.Min(true, true);
Dim max? As Double = spreadsheetControl.Selection.Max(True, True)
Dim min? As Double = spreadsheetControl.Selection.Min(True, True)
See Also