View Single Post
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming
Charles Charles is offline
external usenet poster
 
Posts: 62
Default Weighted average UDF... a bit more complex

Hello

I know the question has already been asked. But I am looking for
something specific. I would like to create a weighted average function,
but that would work (also) with array formula, i.e. I would like to be
able to do that:

EXCEL:
A B C
1 100 Blue 50
2 100 Green 20
3 100 Blue 10

{=WA(A1:A3,C1:C3*(B1:B3="Blue"))}
that would calculate the weighted average of the column A, weighted by
the column C, but only taking into consideration the items with a
column B = "Blue".

I am less interested in the way to create the weighted average function
itself than the syntax to create a user defined forumla that is able to
handle array arguments and return an array.

Thanks for your help
Charles