Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
hmm hmm is offline
external usenet poster
 
Posts: 175
Default Formula for variable-height group average

In column A there is a series of numbers; for each number, in column B is its
associated category. For each grouping of adjacent rows with identical
category, I want a formula in column C that will return the average of the
numbers for that grouping. It could be, say, at the top of each grouping;
for other cells the formula would return a blank. Not all groupings are
equal in height. The same category may appear in more than one grouping; in
this case, the formula will return the average for each separated grouping.

Can I make a formula that will yield this result?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 694
Default Formula for variable-height group average

try this assuming that you want the whole column, otherwise adjust the
reference:

[c1]=SUMIF($B:$B,B1,$A:$A)/COUNTIF($B:$B,B1)

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"hmm" wrote:

In column A there is a series of numbers; for each number, in column B is its
associated category. For each grouping of adjacent rows with identical
category, I want a formula in column C that will return the average of the
numbers for that grouping. It could be, say, at the top of each grouping;
for other cells the formula would return a blank. Not all groupings are
equal in height. The same category may appear in more than one grouping; in
this case, the formula will return the average for each separated grouping.

Can I make a formula that will yield this result?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
hmm hmm is offline
external usenet poster
 
Posts: 175
Default Formula for variable-height group average

Thanks Martin.

The formula works fine where you need to aveage all the cells in column A
with the same value in their column B. However, I only want the average for
continguous rows with the same value in column B; if the same column B value
appears in a non-contiguous row, it would not be included.

Is there such a formula?

"Martin Fishlock" wrote:

try this assuming that you want the whole column, otherwise adjust the
reference:

[c1]=SUMIF($B:$B,B1,$A:$A)/COUNTIF($B:$B,B1)

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"hmm" wrote:

In column A there is a series of numbers; for each number, in column B is its
associated category. For each grouping of adjacent rows with identical
category, I want a formula in column C that will return the average of the
numbers for that grouping. It could be, say, at the top of each grouping;
for other cells the formula would return a blank. Not all groupings are
equal in height. The same category may appear in more than one grouping; in
this case, the formula will return the average for each separated grouping.

Can I make a formula that will yield this result?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,726
Default Formula for variable-height group average

Try this

=AVERAGE(B1:INDEX(B1:$B$20,MIN(IF(A1:$A$20<A1,ROW (A1:$A$20)-1))))

which is an array formula, so commit with Ctrl-Shift-Enter, not just Enter

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"hmm" wrote in message
...
Thanks Martin.

The formula works fine where you need to aveage all the cells in column A
with the same value in their column B. However, I only want the average
for
continguous rows with the same value in column B; if the same column B
value
appears in a non-contiguous row, it would not be included.

Is there such a formula?

"Martin Fishlock" wrote:

try this assuming that you want the whole column, otherwise adjust the
reference:

[c1]=SUMIF($B:$B,B1,$A:$A)/COUNTIF($B:$B,B1)

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"hmm" wrote:

In column A there is a series of numbers; for each number, in column B
is its
associated category. For each grouping of adjacent rows with identical
category, I want a formula in column C that will return the average of
the
numbers for that grouping. It could be, say, at the top of each
grouping;
for other cells the formula would return a blank. Not all groupings
are
equal in height. The same category may appear in more than one
grouping; in
this case, the formula will return the average for each separated
grouping.

Can I make a formula that will yield this result?



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
Function Key for Calculating Average? robin Excel Worksheet Functions 17 November 2nd 06 11:47 PM
Average Array help with a formula chedd via OfficeKB.com Excel Worksheet Functions 2 January 30th 06 11:30 PM
Help! How do you get excel to find the x(changes daily, marked in a cell from another formula) highest numbers in a group of numbers and sum them up? C-Man23 Excel Worksheet Functions 1 January 9th 06 01:23 PM
Need help w/ Weight Formula Tom Excel Discussion (Misc queries) 3 March 4th 05 05:23 PM
Subtotal of Subtotal displays Grand Total in wrong row Thomas Born Excel Worksheet Functions 5 January 6th 05 01:46 PM


All times are GMT +1. The time now is 06:05 PM.

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

About Us

"It's about Microsoft Excel"