Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to average up rows in Excel using VB6
I am trying to create subtotals in a spreadsheet, like a
group by in SQL, but I cannot find an equivalent command in Excel. I would like to roll up all columns based on the values of one or more columns. Any ideas would be greatly appreciated. Thanks in advance, WayneM |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to average up rows in Excel using VB6
Hi Wayne,
From VBA help. Subtotal Method Creates subtotals for the range (or the current region, if the range is a single cell). For information about using the Subtotal worksheet function in Visual Basic, see Using Worksheet Functions in Visual Basic. Syntax expression.Subtotal(GroupBy, Function, TotalList, Replace, PageBreaks, SummaryBelowData) expression Required. An expression that returns a Range object. GroupBy Required Long. The field to group by, as a 1-based integer offset. For more information, see the example. Function Required Long. The subtotal function. Can be one of the following XlConsolidationFunction constants: xlAverage, xlCount, xlCountNums, xlMax, xlMin, xlProduct, xlStDev, xlStDevP, xlSum, xlVar, or xlVarP. TotalList Required Variant. An array of 1-based field offsets, indicating the fields to which the subtotals are added. For more information, see the example. Replace Optional Variant. True to replace existing subtotals. The default value is False. PageBreaks Optional Variant. True to add page breaks after each group. The default value is False. SummaryBelowData Optional Variant. Can be one of the following xlSummaryRow constants: xlSummaryAbove or xlSummaryBelow. The default value is xlSummaryBelow. Subtotal Method Example This example creates subtotals for the selection on Sheet1. The subtotals are sums grouped by each change in field one, with the subtotals added to fields two and three. Worksheets("Sheet1").Activate Selection.Subtotal groupBy:=1, function:=xlSum, _ totalList:=Array(2, 3) -- John johnf202 at hotmail dot com "WayneM" wrote in message ... I am trying to create subtotals in a spreadsheet, like a group by in SQL, but I cannot find an equivalent command in Excel. I would like to roll up all columns based on the values of one or more columns. Any ideas would be greatly appreciated. Thanks in advance, WayneM |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
average of different rows | Excel Worksheet Functions | |||
How to average every 48 rows of data for 20,000 rows? | Excel Discussion (Misc queries) | |||
Average every 20 rows | Excel Worksheet Functions | |||
Average every 20 rows | Excel Worksheet Functions | |||
average on rows | Excel Discussion (Misc queries) |