Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
average of different rows climate Excel Worksheet Functions 1 April 6th 08 09:49 AM
How to average every 48 rows of data for 20,000 rows? akoskelo Excel Discussion (Misc queries) 7 November 17th 07 03:03 AM
Average every 20 rows Karen K Excel Worksheet Functions 4 February 3rd 06 11:46 PM
Average every 20 rows JMB Excel Worksheet Functions 0 February 3rd 06 11:28 AM
average on rows justamailman Excel Discussion (Misc queries) 5 December 13th 04 01:51 AM


All times are GMT +1. The time now is 07:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"