View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Domenic[_2_] Domenic[_2_] is offline
external usenet poster
 
Posts: 265
Default Sumproduct array

In article ,
Domenic wrote:

In article ,
Jumbo Jock wrote:

Hi there,
I have a vertical data array that begins in cell C5 and ends at cell C214.
Each pair of consecutive lines contains data applicable to a single country
and I need to be able to calculate a global weighted average in cell C215.
So
the data array looks like this:-

Country A data 95.4
Country A number 1026
Country B data 101.2
Country B number 504
Country C data 100.9
Country C number 14526
etc
etc

I want to use the sumproduct formula but can't seem to make it work. There
must be a quicker way than creating a formula that multiplies each pair of
lines together and divides the sum by the sum of the "number" lines but I
can't figure it out? Anyone out there help?
Thanks


Is this what you mean?

=AVERAGE(SUBTOTAL(9,OFFSET(C5:C214,ROW(INDIRECT("1 :"&ROWS(C5:C214)/2))*2-
2,0,2)))

...confirmed with CONTROL+SHIFT+ENTER.


Misunderstood... It looks like the solution provided by Ashish Mathur
will provide you with the desired result. However, for robustness, his
formula can be modified as follows...

=SUMPRODUCT(--(MOD(ROW(C5:C213)-ROW(C5),2)=0),C5:C213,C6:C214)/SUMPRODUCT
(--(MOD(ROW(C5:C213)-ROW(C5),2)=0),C6:C214)

--
Domenic
http://www.xl-central.com