PC Review


Reply
Thread Tools Rate Thread

How to Average a Sumproduct() formula

 
 
Vacuum Sealed
Guest
Posts: n/a
 
      23rd Jun 2011
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.


 
Reply With Quote
 
 
 
 
Vacuum Sealed
Guest
Posts: n/a
 
      23rd Jun 2011
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.


 
Reply With Quote
 
Pete_UK
Guest
Posts: n/a
 
      23rd Jun 2011
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" <noodn...@gmail.com> 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.


 
Reply With Quote
 
Vacuum Sealed
Guest
Posts: n/a
 
      23rd Jun 2011
Thx Pete

You have cleared it up very nicely.

Cheers
Mick


 
Reply With Quote
 
joeu2004
Guest
Posts: n/a
 
      23rd Jun 2011
On Jun 23, 5:06*am, Pete_UK <pashu...@auditel.net> 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 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
Average using Sumproduct or .... heater Microsoft Excel Misc 7 16th Apr 2010 03:13 AM
Average while using SumProduct Srikanth Microsoft Excel Worksheet Functions 0 30th Jun 2009 08:51 PM
sumproduct & average junoon Microsoft Excel Worksheet Functions 5 25th May 2006 07:12 AM
Need to bring back Average using either Sumproduct or CSE formula =?Utf-8?B?SmltIE1heQ==?= Microsoft Excel Misc 3 7th Nov 2005 09:45 PM
sumproduct combine with average formula xtrmhyper Microsoft Excel Programming 1 25th Oct 2005 09:30 AM


Features
 

Advertising
 

Newsgroups
 


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