Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 259
Default How to Average a Sumproduct() formula

Hi all

I use the following:

=SUMPRODUCT(--(Historical!$A$2:$A$10000="Jun"),--(Historical!$C$2:$C$10000="Braybrook"),--(Historical!$K$2:$K$10000))

Rather than returning the sum of Column "K", is there a way for the formula
to return the average over the given criteria.

As always

TIA
Mick.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 259
Default How to Average a Sumproduct() formula

Cancel that request

I added another column and inserted the following:

=COUNTA(Historical!$K$3:$K$10000,Historical!$A$3:$ A$10000="Jan"&Historical!$B$3:$B$10000="Braybrook" )

It returns the number of rows that match so I can then use that number to
divide my sumproduct by.

The interesting thing is that when I start the formula like:

=COUNTA(Historical!$K$2:$K$10000,Historical!$A$2:$ A$10000="Jan"&Historical!$B$2:$B$10000="Braybrook" )

It returns a value of 4 when I only have 3 rows of data for testing.

The 1st row is the Header, I cleared all the cells below the 3 populated
ones and it still returns 4. Am I missing something here, does the CountA()
count the entire column regardless of specified range or else...??

If I use the 1st formula at the very top of this post, it returns my desired
3 count, even though that is not an accurate reflection of the true range.

TIA
Mick.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,856
Default How to Average a Sumproduct() formula

Going back to your original request, if you want to sum the values
that meet your criteria you can use this:

=SUMPRODUCT(--(Historical!$A$2:$A$10000="Jun"),--(Historical!$C$2:$C
$10000=*"Braybrook"),Historical!$K$2:$K$10000)

and if you want to count the number of times the criteria are met you
can use this:

=SUMPRODUCT(--(Historical!$A$2:$A$10000="Jun"),--(Historical!$C$2:$C
$10000=*"Braybrook"))

So, you can just divide one by the other to get the average.

I don't understand the formulae you quote using COUNTA - you seem to
be trying to set up a condition, but COUNTA doesn't work that way.

If you are using XL2007 or later you can make use of SUMIFS and
COUNTIFS (which allow more than one criteria), and you can even try
AVERAGEIF.

Hope this helps.

Pete

On Jun 23, 12:41*pm, "Vacuum Sealed" wrote:
Cancel that request

I added another column and inserted the following:

=COUNTA(Historical!$K$3:$K$10000,Historical!$A$3:$ A$10000="Jan"&Historical!*$B$3:$B$10000="Braybrook ")

It returns the number of rows that match so I can then use that number to
divide my sumproduct by.

The interesting thing is that when I start the formula like:

=COUNTA(Historical!$K$2:$K$10000,Historical!$A$2:$ A$10000="Jan"&Historical!*$B$2:$B$10000="Braybrook ")

It returns a value of 4 when I only have 3 rows of data for testing.

The 1st row is the Header, I cleared all the cells below the 3 populated
ones and it still returns 4. Am I missing something here, does the CountA()
count the entire column regardless of specified range or else...??

If I use the 1st formula at the very top of this post, it returns my desired
3 count, even though that is not an accurate reflection of the true range..

TIA
Mick.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 259
Default How to Average a Sumproduct() formula

Thx Pete

You have cleared it up very nicely.

Cheers
Mick


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,059
Default How to Average a Sumproduct() formula

On Jun 23, 5:06*am, Pete_UK wrote:
if you want to sum the values that meet your criteria
you can use this:
=SUMPRODUCT(--(Historical!$A$2:$A$10000="Jun"),
--(Historical!$C$2:$C$10000=*"Braybrook"),
Historical!$K$2:$K$10000)

and if you want to count the number of times the criteria
are met you can use this:
=SUMPRODUCT(--(Historical!$A$2:$A$10000="Jun"),
--(Historical!$C$2:$C$10000=*"Braybrook"))

So, you can just divide one by the other to get the average.


Alternatively, the following array formula (press ctrl+shift+Enter
instead of Enter):

=AVERAGE(IF(Historical!$A$2:$A$10000="Jun",
IF(Historical!$C$2:$C$10000=*"Braybrook",
Historical!$K$2:$K$10000)))

Or use AVERAGEIFS if you have XL2007 or later.
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 & SUMPRODUCT Dave F[_2_] Excel Discussion (Misc queries) 6 July 31st 07 11:53 PM
Sumproduct Average heater Excel Discussion (Misc queries) 2 June 2nd 06 10:32 PM
sumproduct & average junoon Excel Worksheet Functions 5 May 25th 06 07:12 AM
Need to bring back Average using either Sumproduct or CSE formula Jim May Excel Discussion (Misc queries) 3 November 7th 05 09:45 PM
sumproduct combine with average formula xtrmhyper[_3_] Excel Programming 1 October 25th 05 09:30 AM


All times are GMT +1. The time now is 10:14 AM.

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"