Skip to main content
Table of Contents

TTMSFNCDataGridData.ColumnAverage Method

Computes the average of a column over a row range.

API unit family: TMSFNCDataGridData Declaring type: TTMSFNCDataGridData

Syntax

FMX.TMSFNCDataGridData.hppPascalC++
function ColumnAverage(AColumn: Integer; AFromRow: Integer = -1; AToRow: Integer = -1): Double;
double __fastcall ColumnAverage(int AColumn, int AFromRow = 0xffffffff, int AToRow = 0xffffffff);

Remarks

Empty and non-numeric cells count as 0 and are included in the divisor. Only normal data rows and base cells of merges take part; hidden rows take part unless TTMSFNCDataGridDataCalculationOptions.IncludeHiddenRows is False. The value is returned, not written to the grid; use ColumnCalculation to show a result.

Parameters

Name Description
AColumn Zero-based column index.
AFromRow First zero-based row of the range. When this or AToRow is -1 (the default), all rows between the fixed top and bottom rows are used.
AToRow Last zero-based row of the range, inclusive.

Returns

The sum divided by ColumnCounting, or 0 when no row participates.