#1   Report Post  
Farrel
 
Posts: n/a
Default Date X Data

I have,
A B
1 5/1/2005
2 5/2/2005
3 5/3/2005
4 6/1/2005
5 6/2/2005
6 6/3/2005
7 7/1/2005
8 7/2/2005
9 7/3/2005
10 7/4/2005

I want the Average of the different months, May for example, why this:

=SUMPRODUCT(SUBTOTAL(1,A1:A10)*(MONTH(B1:B10)=5)*( YEAR(B1:B10)=2005))

is giving me 16.5 ?

TXS

  #2   Report Post  
Dave R.
 
Posts: n/a
Default

You can use array entered:
=AVERAGE(IF(MONTH(B1:B6)=5,A1:A6))
(enter with ctrl-shift-enter at once)
or

if you want to use sumproduct, one way is:
=SUMPRODUCT((MONTH(B1:B6)=5)*(A1:A6))/SUMPRODUCT(--(MONTH(B1:B6)=5))
which does not need to be array entered.

"Farrel" wrote in message
...
I have,
A B
1 5/1/2005
2 5/2/2005
3 5/3/2005
4 6/1/2005
5 6/2/2005
6 6/3/2005
7 7/1/2005
8 7/2/2005
9 7/3/2005
10 7/4/2005

I want the Average of the different months, May for example, why this:

=SUMPRODUCT(SUBTOTAL(1,A1:A10)*(MONTH(B1:B10)=5)*( YEAR(B1:B10)=2005))

is giving me 16.5 ?

TXS



  #3   Report Post  
bj
 
Posts: n/a
Default

the subtotal (1... will give you 5.5 effectively as a constant
you have three times when the rest of the equaiton is met, therefore you
are adding three 5.5 to give you 16.5

to use sumproduct to get the average
=SUMPRODUCT(A1:A10*(MONTH(B1:B10)=5)*(YEAR(B1:B10) =2005))/
=SUMPRODUCT((MONTH(B1:B10)=5)*(YEAR(B1:B10)=2005))

"Farrel" wrote:

I have,
A B
1 5/1/2005
2 5/2/2005
3 5/3/2005
4 6/1/2005
5 6/2/2005
6 6/3/2005
7 7/1/2005
8 7/2/2005
9 7/3/2005
10 7/4/2005

I want the Average of the different months, May for example, why this:

=SUMPRODUCT(SUBTOTAL(1,A1:A10)*(MONTH(B1:B10)=5)*( YEAR(B1:B10)=2005))

is giving me 16.5 ?

TXS

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
Problems with DATE data type dmplacebo New Users to Excel 0 July 12th 05 08:40 AM
Extracting data from the current date Cali00 Excel Worksheet Functions 2 April 14th 05 05:49 AM
extract date from the most current date Cali00 Excel Discussion (Misc queries) 1 April 13th 05 02:05 PM
Help with data not getting plotted Scott Ehrlich Charts and Charting in Excel 1 January 23rd 05 05:15 PM
Count data entries and date problem Gef Excel Worksheet Functions 5 November 4th 04 02:30 PM


All times are GMT +1. The time now is 06:16 AM.

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

About Us

"It's about Microsoft Excel"