'宣言 Public Overloads Function Aggregate( _ ByVal aggType As AggregateEnum _ ) As System.Double
public System.double Aggregate( AggregateEnum aggType )
パラメータ
- aggType
- 計算する集計の種類を指定する AggregateEnum値。
戻り値の型
集計値を表す System.Double。
'宣言 Public Overloads Function Aggregate( _ ByVal aggType As AggregateEnum _ ) As System.Double
public System.double Aggregate( AggregateEnum aggType )
次のコードは、 Aggregate(AggregateEnum,CellRange,AggregateFlags)メソッドを使用して、現在の選択範囲の集計値を計算します。選択範囲を変更すると、新しい集計値が計算されてコンソールに書き込まれます。
Private Sub flex_SelChange(sender As Object, e As System.EventArgs) Dim fmt As String = "Count {0:0}, Sum {1:#,##0.00}, " & _ "Avg {2:#,##0.00}, Stdev {3:#,##0.00}" Dim agg As String = String.Format(fmt, _ flex.Aggregate(AggregateEnum.Count), _ flex.Aggregate(AggregateEnum.Sum), _ flex.Aggregate(AggregateEnum.Average), _ flex.Aggregate(AggregateEnum.Std)) Console.WriteLine(agg) End Sub
private void flex_SelChange(object sender, System.EventArgs e) { string fmt = "Count {0:0}, Sum {1:#,##0.00}, " + "Avg {2:#,##0.00}, Stdev {3:#,##0.00}"; Console.WriteLine(fmt, flex.Aggregate(AggregateEnum.Count), flex.Aggregate(AggregateEnum.Sum), flex.Aggregate(AggregateEnum.Average), flex.Aggregate(AggregateEnum.Std)); }