PC Review


Reply
Thread Tools Rate Thread

AVERAGE / STD of groups in a table?

 
 
robotman
Guest
Posts: n/a
 
      29th Jun 2007
I have a list of differerent-sized groups and values in a table. I am
trying to determine the Average and Stdev for each group. The formula
would need to reference the entire data range since the number of data
points in each group is continually changes.

For example in Col A1:B8 ....


Col A Col B
Group 1 500
Group 1 230
Group 1 102
Group 1 402
Group 2 300
Group 2 222
Group 3 134
Group 3 153

On the spreadsheet level, I can do a formula like:

=AVERAGE(IF(A1:A8="Group 1",B1:B8))
(entered as an array formula)

Is there a way to do a similar one-liner in VBA to get the same
results? I can't figure out how to enter an "array" type formula in
VBA.

Thanks.


John

 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmVycnkgVy4gTGV3aXM=?=
Guest
Posts: n/a
 
      29th Jun 2007
VBA does not have array formulas, but Evaluate() will pass a string to Excel
for evaluation as an array formaula, thus
Evaluate("AVERAGE(IF(A1:A8=""Group 1"",B1:B8))")
would work.

Jerry

"robotman" wrote:

> I have a list of differerent-sized groups and values in a table. I am
> trying to determine the Average and Stdev for each group. The formula
> would need to reference the entire data range since the number of data
> points in each group is continually changes.
>
> For example in Col A1:B8 ....
>
>
> Col A Col B
> Group 1 500
> Group 1 230
> Group 1 102
> Group 1 402
> Group 2 300
> Group 2 222
> Group 3 134
> Group 3 153
>
> On the spreadsheet level, I can do a formula like:
>
> =AVERAGE(IF(A1:A8="Group 1",B1:B8))
> (entered as an array formula)
>
> Is there a way to do a similar one-liner in VBA to get the same
> results? I can't figure out how to enter an "array" type formula in
> VBA.
>
> Thanks.
>
>
> John
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with Access query to average groups of numbers stephentimko@my-deja.com Microsoft Access 5 18th Feb 2009 09:44 PM
Calculating average within groups =?Utf-8?B?TmVlZEFjY2Vzc0hlbHAh?= Microsoft Access Queries 4 14th Nov 2007 02:53 PM
Sum group totals and then average by # of groups =?Utf-8?B?VGFtbXk=?= Microsoft Access Reports 2 1st Nov 2007 05:12 PM
average and stdev from groups of data Charlie Microsoft Excel Worksheet Functions 2 9th Jan 2006 03:56 AM
MAX, MIN, MEAN, AVERAGE, MODE for multiple groups...how? || cypher || Microsoft Excel Worksheet Functions 2 14th Jul 2005 06:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:24 AM.