Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 279
Default Sumproduct in matrix means


I have some data on which I calculate row and column means.
There are discrepancies when the data is incomplete.
I have simplified the data to show the problem.

I believe it may be possible to use Sumproduct to calculate correct
results. I hope some reader can say how.

I have simple data
A B C D
1 AM PM Means
2 Tuesday 2 2
3 Monday 3 4 3.5
4 Means 2.5 4 3.25/2.75

R2C4 is =Average(B2:C2) and copied down
R4C2 is =Average(B2:B3) and copied across
R4C4 shows the row and column means, and is =Average(B4:C4) & "/" &
Average(D2:D3)

The true value for R4C4 should be 3/3
3 is the result of =Average(B2:C3) and is one way of getting true
values. I want to use row and column means also to produce a true value.
3 is also the result of (R4C2*2+R4C3*1)/3
3 is also the result of (R2C4*1+R3C4*2)/3
=sumproduct(B4:C4,[count(B2:B3),count(C2:C3)])/count(B2:C3)
is roughly what I want in place of =Average(B4:C4).

I could use auxiliary cells in sumproduct but would prefer not to do so.

That is not quite right. ;)

My true data refers to 7 days and 4 time periods -
blood sugars for a week. ;)
--
Walter Briscoe
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 829
Default Sumproduct in matrix means

"Walter Briscoe" wrote:
I have simple data
A B C D
1 AM PM Means
2 Tuesday 2 2
3 Monday 3 4 3.5
4 Means 2.5 4 3.25/2.75

R2C4 is =Average(B2:C2) and copied down
R4C2 is =Average(B2:B3) and copied across
R4C4 shows the row and column means, and is =Average(B4:C4) & "/" &
Average(D2:D3)
The true value for R4C4 should be 3/3


(Why complicate things by oscillating between R1C1 and A1 reference styles?
Rhetorical question. The point is: don't!)

The real problem is with your math: the average of averages is not
necessarily the same as the average of all. They are equal only with the
divisors of each average are the same, which is not true in your example.

Column D is the average daily number. Row 4 is the average AM or PM number
across days.

If you want D4 to be the overall average, it should be written as
=AVERAGE(B2:C3).

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 829
Default Sumproduct in matrix means

PS.... I wrote wrote:
The real problem is with your math: the average of averages is not
necessarily the same as the average of all. They are equal only with the
divisors of each average are the same, which is not true in your example.

Column D is the average daily number. Row 4 is the average AM or PM
number across days.

If you want D4 to be the overall average, it should be written as
=AVERAGE(B2:C3).


After reading your original posting in more detail, I see that you
understand that to some degree.

The alternative method is: multiply each average by the number of items
averaged (the original divisor), add all of those products, and divide by
the total number of items (the sum of the original divisors).

Without translating that into a proper format -- it can be done, but it
seems unnecessary -- let me just comment this way....


"Walter Briscoe" wrote:
=sumproduct(B4:C4,[count(B2:B3),count(C2:C3)])/count(B2:C3)
is roughly what I want in place of =Average(B4:C4).


Yes, that is close to the correct alternative conceptually.

But I don't see the point of it since, without helper cells, you must do
COUNT(B2:C3) as you noted. And that is no less trouble than AVERAGE(B2:C3).
In fact, the whole thing is a lot more trouble.

"Everything should be made as simple as possible, but not simpler." --
Albert Einstein

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 829
Default Sumproduct in matrix means

Minor errata (nitpicking)....

I wrote:
The real problem is with your math: the average of averages
is not necessarily the same as the average of all. They are
equal only [when] the divisors of each average are the same,
which is not true in your example.


I shouldn't say that is the "only" time they are equal. Of course, there
are examples when they are equal by coincidence (e.g. when all the numbers
to be averaged are equal). And there are examples when they are "close
enough" to equal; for example, equal to 1 decimal place.

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
Is This a Pivot? A SumProduct? A SumPivot? Matrix? RJB Excel Discussion (Misc queries) 1 May 13th 09 07:31 AM
How can I transpose nXm matrix to mXn Matrix MIHir Excel Worksheet Functions 2 August 9th 08 11:44 AM
Use SUMPRODUCT for a matrix Learn-more Excel Worksheet Functions 3 May 23rd 08 10:26 AM
K-Means, X-Means or other Clustering Algorithms Jim[_65_] Excel Programming 0 June 9th 07 09:46 PM
Matrix multiplication using sumproduct Rasoul Khoshravan Excel Worksheet Functions 3 October 16th 06 11:55 PM


All times are GMT +1. The time now is 06:11 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"