NamedRange::Subtotal Method (Int32, XlConsolidationFunction, Object^, Object^, Object^, XlSummaryRow)

 

Creates subtotals for the NamedRange control.

Namespace:   Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Object^ Subtotal(
	int GroupBy,
	XlConsolidationFunction Function,
	Object^ TotalList,
	Object^ Replace,
	Object^ PageBreaks,
	XlSummaryRow SummaryBelowData = XlSummaryRow::xlSummaryBelow
)

Parameters

GroupBy
Type: System::Int32

The field to group by, as a one-based integer offset.

Function
Type: Microsoft.Office.Interop.Excel::XlConsolidationFunction

The subtotal function.

Can be one of the following XlConsolidationFunction values:

xlAverage

xlCount

xlCountNums

xlMax

xlMin

xlProduct

xlStDev

xlStDevP

xlSum

xlUnknown

xlVar

xlVarP

TotalList
Type: System::Object^

An array of 1-based field offsets, indicating the fields to which the subtotals are added.

Replace
Type: System::Object^

true to replace existing subtotals. The default value is false.

PageBreaks
Type: System::Object^

true to add page breaks after each group. The default value is false.

SummaryBelowData
Type: Microsoft.Office.Interop.Excel::XlSummaryRow

Places the summary data relative to the subtotal.

Can be one of the following XlSummaryRow values:

xlSummaryAbove

xlSummaryBelow (default)

Return Value

Type: System::Object^

For information on optional parameters, see Optional Parameters in Office Solutions.

The following code example creates subtotals for a NamedRange. The subtotals are the sum of all three fields in the NamedRange.

This example is for a document-level customization.

No code example is currently available or this language may not be supported.
Return to top
Show: