A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Non-contiguous range and Sumproduct to average



 
 
Thread Tools Display Modes
  #1  
Old April 11th, 2010, 09:27 PM posted to microsoft.public.excel.worksheet.functions
Mifty
external usenet poster
 
Posts: 65
Default Non-contiguous range and Sumproduct to average

Hi,

I'm using the following to average data in K if value in F = value in E5.

=SUMPRODUCT(($F$52:$F$107=$E$5)*$K$52:$K$107)/SUMPRODUCT(--($F$52:$F$107=$E$5))

I'm intending to use the same formula to calculate averages in columns I to
N in about 45 sheets all with the same layout and different data.

Column F is gender and I to N contain a series of datapoints (some of which
are missing).
I've tried as far as possible to sort the data so that the missing points
are at the bottom of rows and then I alter the range in the formula to suit.

I'm on sheet 5 now and I'm stumped, L109 to N111 and K108 have no data but
there is data in K109 to K111.

I've tried adding a second range to the formula but not having much luck
(although I'm guessing I'm lucky to have got to sheet 5 without this problem).

Hoping some kind soul can help :-)

Cheers
Mifty

--
Mifty
  #3  
Old April 11th, 2010, 11:29 PM posted to microsoft.public.excel.worksheet.functions
Charabeuh[_5_]
external usenet poster
 
Posts: 3
Default Non-contiguous range and Sumproduct to average

Try this :

=SUMPRODUCT( ($F$52:$F$111=$E$5) * ($K$52:$K$111) ) / SUMPRODUCT(
($F$52:$F$111=$E$5) * (ISNUMBER($K$52:$K$111) ) )





"Mifty" wrote:

Hi,

I'm using the following to average data in K if value in F = value in E5.

=SUMPRODUCT(($F$52:$F$107=$E$5)*$K$52:$K$107)/SUMPRODUCT(--($F$52:$F$107=$E$5))

I'm intending to use the same formula to calculate averages in columns I to
N in about 45 sheets all with the same layout and different data.

Column F is gender and I to N contain a series of datapoints (some of which
are missing).
I've tried as far as possible to sort the data so that the missing points
are at the bottom of rows and then I alter the range in the formula to suit.

I'm on sheet 5 now and I'm stumped, L109 to N111 and K108 have no data but
there is data in K109 to K111.

I've tried adding a second range to the formula but not having much luck
(although I'm guessing I'm lucky to have got to sheet 5 without this problem).

Hoping some kind soul can help :-)

Cheers
Mifty

--
Mifty

  #4  
Old April 12th, 2010, 02:29 AM posted to microsoft.public.excel.worksheet.functions
T. Valko
external usenet poster
 
Posts: 15,759
Default Non-contiguous range and Sumproduct to average

By missing data points I assume you numbers to average.

Try this array formula** :


=AVERAGE(IF(F52:F107=E5,IF(ISNUMBER(K52:K107),K52: K107)))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"Mifty" wrote in message
...
Hi,

I'm using the following to average data in K if value in F = value in E5.

=SUMPRODUCT(($F$52:$F$107=$E$5)*$K$52:$K$107)/SUMPRODUCT(--($F$52:$F$107=$E$5))

I'm intending to use the same formula to calculate averages in columns I
to
N in about 45 sheets all with the same layout and different data.

Column F is gender and I to N contain a series of datapoints (some of
which
are missing).
I've tried as far as possible to sort the data so that the missing points
are at the bottom of rows and then I alter the range in the formula to
suit.

I'm on sheet 5 now and I'm stumped, L109 to N111 and K108 have no data but
there is data in K109 to K111.

I've tried adding a second range to the formula but not having much luck
(although I'm guessing I'm lucky to have got to sheet 5 without this
problem).

Hoping some kind soul can help :-)

Cheers
Mifty

--
Mifty



  #5  
Old April 12th, 2010, 06:00 AM posted to microsoft.public.excel.worksheet.functions
Harlan Grove[_2_]
external usenet poster
 
Posts: 1,439
Default Non-contiguous range and Sumproduct to average

"T. Valko" wrote...
By missing data points I assume you numbers to average.

....
=AVERAGE(IF(F52:F107=E5,IF(ISNUMBER(K52:K107),K52 :K107)))

....

Why the IF call? With the following data in A1:B8,

F 1
F blank
M 3
M 4
F 5
F 6
F 7
M 8

and F in A10, the array formula

=AVERAGE(IF(A1:A8=A10,B1:B8))

returns 4.75 (as per specs) rather than 3.8. The AVERAGE function
ignores cells which don't contain numbers.
  #6  
Old April 13th, 2010, 03:03 AM posted to microsoft.public.excel.worksheet.functions
T. Valko
external usenet poster
 
Posts: 15,759
Default Non-contiguous range and Sumproduct to average

Why the IF call?
F blank


Define blank.

If blank is an EMPTY cell then ISNUMBER prevents the empty cell from being
included in the average as numeric 0. If the logical test is TRUE the
corresponding cell in the value_if_true argument is included in the average
and if that cell is empty it's evaluated as numeric 0.

If BLANK is a formula blank then it would be ignored as a text entry in an
array reference.

Are you sure you just didn't have a "senior moment"? It's ok, I have them
sometimes and I'm not technically a senior just yet!

--
Biff
Microsoft Excel MVP


"Harlan Grove" wrote in message
...
"T. Valko" wrote...
By missing data points I assume you numbers to average.

...
=AVERAGE(IF(F52:F107=E5,IF(ISNUMBER(K52:K107),K5 2:K107)))

...

Why the IF call? With the following data in A1:B8,

F 1
F blank
M 3
M 4
F 5
F 6
F 7
M 8

and F in A10, the array formula

=AVERAGE(IF(A1:A8=A10,B1:B8))

returns 4.75 (as per specs) rather than 3.8. The AVERAGE function
ignores cells which don't contain numbers.



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:21 AM.


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